Passing parameters between pages

Source: Internet
Author: User

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.