Web Services and the Validator and Tile Packages : Struts « J2EE « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » J2EE » StrutsScreenshots 
Web Services and the Validator and Tile Packages
Web Services and the Validator and Tile Packages

/*
Title:       Struts : Essential Skills (Essential Skills)
Authors:     Steven Holzner
Publisher:   McGraw-Hill Osborne Media
ISBN:       0072256591
*/

//ch10_01.jsp

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="Layout.jsp" flush="true">
  <tiles:put name="title"  value="Using Tiles" />
  <tiles:put name="header" value="header.jsp" />
  <tiles:put name="footer" value="footer.jsp" />
  <tiles:put name="menu"   value="menu.jsp" />
  <tiles:put name="body"   value="body.jsp" />
</tiles:insert>

//ch10_02.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="Layout.jsp" flush="true">
  <tiles:put name="title"  value="Using putList" />
  <tiles:put name="header" value="header.jsp" />
  <tiles:put name="footer" value="footer.jsp" />
  <tiles:put name="menu"   value="menu.jsp" />
  <tiles:put name="body"   value="list.jsp" />
</tiles:insert>

//ch10_03.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:definition id="theDefinition" template="/Layout.jsp" >
  <tiles:put name="title"  value="My first page" />
  <tiles:put name="header" value="/header.jsp" />
  <tiles:put name="footer" value="/footer.jsp" />
  <tiles:put name="menu"   value="/menu.jsp" />
  <tiles:put name="body"   value="/body.jsp" />
</tiles:definition>

<tiles:insert beanName="theDefinition" flush="true" />

//ch10_04.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert definition="tilesDefinition" flush="true" />

//ch10_05.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert definition="tilesDefinition" flush="true" >
  <tiles:put name="title" value="Overloading Definitions" />
  <tiles:put name="header" value="/overloadedHeader.jsp" />
</tiles:insert>

//ch10_06.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert definition="tilesExtendedDefinition" flush="true" />

//ch10_07.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert definition="attributeDefinition" flush="true" />

//ch10_08.jsp
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<html:html>
    <head>
        <title>Using &lt;logic&gt; Tags</title>
    </head>
    
    <body>
        <h1>Using &lt;logic&gt; Tags</h1>

        <html:form action="ch10_09.do">

            <h2>Enter your data:</h2>
            <html:text property="text"/>

            <br>
            <br>

            <html:submit value="Submit"/>
            <html:cancel/>
        </html:form>
    </body>
</html:html>

package ch10;

import java.io.*;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import org.apache.struts.action.*;

public class ch10_09 extends Action 
{
  public ActionForward execute(ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response)
    throws IOException, ServletException {

        return mapping.findForward("success");
    }
}

package ch10;

import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ch10_10 extends ActionForm 
{
    
    private String empty = "";
    private String text = "";
    private int number;
    
    public String getEmpty() 
    {
        return empty;
    }
    
    public void setEmpty(String text
    {
    }
    
    public String getText() 
    {
        return text;
    }
    
    public void setText(String text
    {
        this.text = text;
        this.number = Integer.parseInt(text);
    }
    
    public int getNumber() 
    {
        return number;
    }
    
    public void setNumber(int number
    {
        this.number = number;
    }
}

           
       
Struts-Essential-Skills-ch10.zip( 1,451 k)
Related examples in the same category
1. Exercise 1: Building your first Struts ApplicationExercise 1: Building your first Struts Application
2. Exercise 2: Improving your first Struts Application Exercise 2: Improving your first Struts Application
3. Exercise 3: Using JSTL, Struts-EL etcExercise 3: Using JSTL, Struts-EL etc
4. Struts Recipes: Build Struts with Ant
5. Using bean:resource to expose the struts.config.xml to your view
6. Create a pluggable validator for cross-form validation 2Create a pluggable validator for cross-form validation 2
7. Struts: Generate a response with XSL
8.  Hibernate and Struts  Hibernate and Struts
9.  In-container testing with StrutsTestCase and Cactus
10. Exercise 4: Applying Gof and J2EE Patterns:Deploy to WebLogic and Test
11. Exercise 5: Search, List, Action Chaining, Editable List Form
12. Exercise 6: Paging
13. Exercise 7: Better Form and Action Handling
14. Exercise 8: Creating Struts Modules
15. Exercise 9: Using Commons Validator with Struts
16. Exercise 10: Using Struts and Tiles
17. Essential Struts ActionEssential Struts Action
18. A Full Struts ApplicationA Full Struts Application
19. Struts Creating the ViewStruts Creating the View
20. Struts: Creating the ModelStruts: Creating the Model
21. Struts: Creating the ControllerStruts: Creating the Controller
22. Creating Custom TagsCreating Custom Tags
23. The Struts TagsThe Struts Tags
24. The Struts and TagsThe Struts and Tags
25. Struts Framework: A Sample Struts ApplicationStruts Framework: A Sample Struts Application
26. Struts Framework Validator
27. Struts Framework: TilesStruts Framework: Tiles
28. Struts Framework: Declarative Exception Handling
29. Struts: Internationalizing Struts Applications
30. Securing Struts Applications
31. Testing Struts Applications
32. Struts exampleStruts example
33. Blank Struts templateBlank Struts template
34. Struts Framework
35. Struts: bank application
36. Struts applicationStruts application
37. Struts application 2Struts application 2
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.