Method 1:
<JSP: usebean id = "userform" class = "com. wgh. userform" Scope = "page"/> set get in this class
<JSP: setproperty name = "userform" property = "*"/>
The input box <input name = "PWD" type = "password" id = "PWD"> </TD> must have the same class
$ {Userform. pwd} gets the attribute
Method 2:
<Form name = "form1" method = "Post" Action = "pollservlet">
In the configuration file
<Servlet>
<Servlet-Name> pollservlet </servlet-Name>
<Servlet-class> com. wgh. servlet. pollservlet </servlet-class>
</Servlet>
<Servlet-mapping>
<Servlet-Name> pollservlet </servlet-Name>
<URL-pattern>/pollservlet </url-pattern>
</Servlet-mapping>
Use the map element in the class
String [] arr = {"Basic tutorial class", "instance collection class", "experience and skill class", "Quick Reference Manual class", and "case analysis class "};
Map = new hashmap ();
For (INT I = 0; I <arr. length; I ++ ){
If (item. Equals (ARR [I]) {// determines whether the vote is selected
Map. Put (ARR [I], 1 );
} Else {
Map. Put (ARR [I], 0 );
}
Out. println ("<SCRIPT> alert ('vote successful! '); Window. Location. href = 'showresult. jsp'; </SCRIPT> "); // The page is displayed after voting.
Then obtain the result in the 'showresult. jsp' interface.
($ {Empty applicationscope. pollresult ["Case Analysis"]? 0: applicationscope. pollresult ["Case Analysis"]})
<Input name = "button" type = "button" class = "btn_grey" value = "return" onclick = "window. location. href = 'index. JSP '"> </TD>