js| Array | page
In the forum often see someone asked how to pass the array between JSP pages, in fact, with JavaBean is very easy to achieve.
Here's a simple example of what type of data structure can be passed as long as you follow JavaBean's game rules:
1: Write a test for Javabean:package Com.infoearth;public class jobbean{private int[] b;
/** * @return return B. * * Public int[] Getb () {return b;}/** * @param b to set. */public void Setb (int[] b) {this.b = b;}}
2: In the first JSP page (note that the name of the text box is "B"): <form action= "managejob.jsp" method= "POST" ><table><tr> <td width= "height=" > </td> <td Width= "height=" ><input name= "B" type= "Text" size= "3" ></td> <td width= "50" height= "><input" name= "B" type= "Text" size= "3" ></td> <td width= "height=" 30 "><input name=" B "type=" Text "size=" 3 "></td> <td width=" "height=" >< Input name= "B" type= "Text" size= "3" ></td> <td width= "a" height= "" ><input name= "B" type= "Text" size= "3" ></td> <td width= "height=" ><input name= "B" "type=" Text "size=" 3 "></td> <td width=" height= "><input name=" B "type=" text "size= "3" ></td> <td width= "height=" ><inputName= "B" type= "Text" size= "3" ></td> <td width= "a" height= "" ><input name= "B" Type= "Text" size= "3" ></td> <td width= "height= ><input" "Name=" "B" type= "text "Size=" 3 "></td> <td width=" height= "><input name=" B "type=" Text "size=" 3 " ></td> </tr></table><input type= "Submit" value= "submitted" ></form>
3: In the managejob.jsp page, you can accept this array, very simple, with Get method can be: <%@ page contenttype= "text/html;" charset=gb2312 "language=" java "import=" java.sql.*, com.infoearth.* "
%></body>
Note the internal mechanism of the JavaBean: the name of the array named B in JavaBean, then in the first JSP, the text box that fills in array B must be named B, otherwise you won't get it! This is the JavaBean rules of the game Oh, I hope to help you
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.