11<%@ page language =" java" contentType =" text/html; charset=ISO-8859-1" pageEncoding =" ISO-8859-1" %>
22<%@ taglib prefix =" form" uri =" http://www.springframework.org/tags/form" %>
33<html >
4- <head >
5- <meta http-equiv =" Content-Type" content =" text/html; charset=ISO-8859-1" >
6- <title >Form Example - Register a Person</title >
7- </head >
8- <body >
9- <h3 >Welcome, Enter The Person Details</h3 >
10-
11- <form:form method =" POST" action =" /spring-mvc-xml/addPerson" modelAttribute =" person" >
12- <table >
13- <tr >
14- <td ><form:label path =" name" >Name</form:label ></td >
15- <td ><form:input path =" name" /></td >
16- </tr >
17- <tr >
18- <td ><form:label path =" password" >Password</form:label ></td >
19- <td ><form:password path =" password" /></td >
20- </tr >
21- <tr >
22- <td ><form:label path =" sex" >Sex</form:label ></td >
23- <td >
24- Male: <form:radiobutton path =" sex" value =" M" /> <br />
25- Female: <form:radiobutton path =" sex" value =" F" />
26- </td >
27- </tr >
28- <tr >
29- <td ><form:label path =" job" >Job</form:label ></td >
30- <td >
31- <form:radiobuttons items =" ${ job } " path =" job" />
32- </td >
33- </tr >
34- <tr >
35- <td ><form:label path =" country" >Country</form:label ></td >
36- <td >
37- <form:select path =" country" items =" ${ country } " />
38- </td >
39- </tr >
40- <tr >
41- <td ><form:label path =" book" >Book</form:label ></td >
42- <td >
43- <form:select path =" book" >
44- <form:option value =" -" label =" --Please Select" />
45- <form:options items =" ${ books } " />
46- </form:select >
47- </td >
48- </tr >
49- <tr >
50- <td ><form:label path =" fruit" >Fruit</form:label ></td >
51- <td >
52- <form:select path =" fruit" items =" ${ fruit } " multiple =" true" />
53- </td >
54- </tr >
55- <tr >
56- <td ><form:label path =" receiveNewsletter" >Receive newsletter</form:label ></td >
57- <td ><form:checkbox path =" receiveNewsletter" rows =" 3" cols =" 20" /></td >
58- </tr >
59- <tr >
60- <td ><form:label path =" hobbies" >Hobbies</form:label ></td >
61- <td >
62- Bird watching: <form:checkbox path =" hobbies" value =" Bird watching" />
63- Astronomy: <form:checkbox path =" hobbies" value =" Astronomy" />
64- Snowboarding: <form:checkbox path =" hobbies" value =" Snowboarding" />
65- </td >
66- </tr >
67- <tr >
68- <td ><form:label path =" favouriteLanguage" >Favourite languages</form:label ></td >
69- <td >
70- <form:checkboxes items =" ${ favouriteLanguage } " path =" favouriteLanguage" />
71- </td >
72- </tr >
73- <tr >
74- <td ><form:label path =" notes" >Notes</form:label ></td >
75- <td ><form:textarea path =" notes" rows =" 3" cols =" 20" /></td >
76- </tr >
77- <tr >
78- <td ><form:hidden path =" id" value =" 12345" /></td >
79- </tr >
80- <tr >
81- <td ><input type =" submit" value =" Submit" /></td >
82- </tr >
83- </table >
84- </form:form >
85-
86- </body >
4+ <head >
5+ <meta http-equiv =" Content-Type" content =" text/html; charset=ISO-8859-1" >
6+ <title >Form Example - Register a Person</title >
7+ </head >
8+
9+ <style >
10+
11+ .error {
12+ color : #ff0000 ;
13+ }
14+
15+ </style >
16+
17+ <body >
18+
19+ <h3 >Welcome, Enter The Person Details</h3 >
20+
21+ <form:form method =" POST" action =" /spring-mvc-xml/addPerson" modelAttribute =" person" enctype =" multipart/form-data" >
22+
23+ <form:errors path =" *" cssClass =" error" />
24+
25+ <table >
26+ <tr >
27+ <td ><form:label path =" name" >Name</form:label ></td >
28+ <td ><form:input path =" name" /></td >
29+ <td ><form:errors path =" name" cssClass =" error" /></td >
30+ </tr >
31+ <tr >
32+ <td ><form:label path =" password" >Password</form:label ></td >
33+ <td ><form:password path =" password" /></td >
34+ <td ><form:errors path =" password" cssClass =" error" /></td >
35+ </tr >
36+ <tr >
37+ <td ><form:label path =" sex" >Sex</form:label ></td >
38+ <td >
39+ Male: <form:radiobutton path =" sex" value =" M" /> <br />
40+ Female: <form:radiobutton path =" sex" value =" F" />
41+ </td >
42+ </tr >
43+ <tr >
44+ <td ><form:label path =" job" >Job</form:label ></td >
45+ <td >
46+ <form:radiobuttons items =" ${ job } " path =" job" />
47+ </td >
48+ </tr >
49+ <tr >
50+ <td ><form:label path =" country" >Country</form:label ></td >
51+ <td >
52+ <form:select path =" country" items =" ${ country } " />
53+ </td >
54+ </tr >
55+ <tr >
56+ <td ><form:label path =" book" >Book</form:label ></td >
57+ <td >
58+ <form:select path =" book" >
59+ <form:option value =" -" label =" --Please Select" />
60+ <form:options items =" ${ books } " />
61+ </form:select >
62+ </td >
63+ </tr >
64+ <tr >
65+ <td ><form:label path =" fruit" >Fruit</form:label ></td >
66+ <td >
67+ <form:select path =" fruit" items =" ${ fruit } " multiple =" true" />
68+ </td >
69+ </tr >
70+ <tr >
71+ <td ><form:label path =" receiveNewsletter" >Receive newsletter</form:label ></td >
72+ <td ><form:checkbox path =" receiveNewsletter" rows =" 3" cols =" 20" /></td >
73+ </tr >
74+ <tr >
75+ <td ><form:label path =" hobbies" >Hobbies</form:label ></td >
76+ <td >
77+ Bird watching: <form:checkbox path =" hobbies" value =" Bird watching" />
78+ Astronomy: <form:checkbox path =" hobbies" value =" Astronomy" />
79+ Snowboarding: <form:checkbox path =" hobbies" value =" Snowboarding" />
80+ </td >
81+ </tr >
82+ <tr >
83+ <td ><form:label path =" favouriteLanguage" >Favourite languages</form:label ></td >
84+ <td >
85+ <form:checkboxes items =" ${ favouriteLanguage } " path =" favouriteLanguage" />
86+ </td >
87+ </tr >
88+ <tr >
89+ <td ><form:label path =" notes" >Notes</form:label ></td >
90+ <td ><form:textarea path =" notes" rows =" 3" cols =" 20" /></td >
91+ </tr >
92+ <tr >
93+ <td ><form:label path =" file" >Select a file to upload</form:label ></td >
94+ <td ><input type =" file" name =" file" /></td >
95+ </tr >
96+ <tr >
97+ <td ><form:hidden path =" id" value =" 12345" /></td >
98+ </tr >
99+ <tr >
100+ <td ><input type =" submit" value =" Submit" /></td >
101+ </tr >
102+
103+ </table >
104+
105+ </form:form >
106+
107+ </body >
87108
88109</html >
0 commit comments