FormPage.jsp Sample

This topic inludes the source code for the FormPage.jsp Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/struts/validation/validator/

Sample Source Code


01 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
02 <%@ taglib uri="netui-tags-html.tld" prefix="netui" %>
03 
04 <html>
05     <head>
06         <netui:base/>
07         <title>Form Validation with Page Flow and Struts ValidatorPlugin: Form Page</title>
08         <link href="../../../resources/css/style.css" type="text/css" rel="stylesheet"/>        
09     </head>
10     
11     <body>
12 
13     <jsp:include page="/resources/jsp/header.jsp"/> <br/> 
14     <blockquote>
15     
16     <h3>Form Validation with Page Flow and Struts ValidatorPlugin</h3>    
17     <h4>Form Page</h4>
18     
19     <p>Like the basic validation example, the validation for this form's 
20     fields is deliberately simple. By keeping the validation rules 
21     simple, we can focus on the following:</p>
22     
23     <ul type="square">
24     <li>The form bean that's defined in the /validator/Controller.jpf 
25     page flow class used the Struts ValidatorPlugIn.</li>
26     
27     <li>The validation rules were defined in /WEB-INF/strutsValidator-validation.xml. 
28     This XML was made available to the current /validator/Controller.jpf page flow via 
29     a merged Struts module, /WEB-INF/strutsValidator-merge-config.xml.
30     </li>
31     
32     <li>Error text came from the Messages.properties file in  
33     /WEB-INF/classes/validator.</li>
34     
35     </ul>
36   
37 
38     <netui:form action="submitForm">
39         <table>
40             <tr>
41                 <td><p>Enter E-mail address:</p></td>
42                 <td>
43                     <netui:textBox dataSource="{actionForm.email}"/>
44                 </td>
45                 <td>
46                     <netui:error value="email"/>
47                 </td>
48             </tr>
49         
50             <tr>
51                 <td><p>Enter Age:</p></td>
52                 <td>
53                     <netui:textBox dataSource="{actionForm.age}"/>
54                 </td>
55                 <td>
56                 <netui:error value="age"/>
57                 </td>
58             </tr>
59         </table>
60 
61         <netui:button>Submit</netui:button>
62         <netui:button action="exit">Exit</netui:button>
63     </netui:form>
64 
65     <netui:errors/>
66 
67     </blockquote>
68 
69     </body>
70 </html>