| Author |
getting 2D array view in jsp from actionform properties
|
jakeer ahmed
Greenhorn
Joined: Jan 17, 2006
Posts: 15
|
|
Dear all, i have 2 action form properties of string type(two selectboxes in my jsp), which represent indexes of two dimentional array . again this array is also 2D string array acion form property. so when ever user changes the values in select boxes , i want an array of text fields (my action form 2D array) appear in jsp dynamically. i m some wat new to struts,can anybody help me. thanks in advance.
|
 |
jakeer ahmed
Greenhorn
Joined: Jan 17, 2006
Posts: 15
|
|
I am using the fallowing code jsp code: ---------------------- <jsp:useBean id="mybean" class="org.bigtec.babe.form.PumpCalibForm" scope="session" /> <td >No.of Flow Points</td> <html:select style="width:80px;" name="PumpCalibForm" property="flowpoints" onchange="javascript:funcPass('array')"> <option value="0">Select</option> <logicresent name="PumpCalibForm" property="flowRepeats"> <htmlptions name="PumpCalibForm" property="flowRepeats" /> </logicresent> </html:select> <tr><td >No.of Time Points</td> <html:select style="width:80px;" name="PumpCalibForm" property="timepoints" onchange="javascript:funcPass('array')"> <option value="0">Select</option> <logicresent name="PumpCalibForm" property="timeRepeats"> <htmlptions name="PumpCalibForm" property="timeRepeats" /> </logicresent> </html:select> </tr> <logicresent name="PumpCalibForm" property="flowratearray" > <% int flow=Integer.parseInt(mybean.getFlowpoints()); int timepoints=Integer.parseInt(mybean.getTimepoints()); for(int i=0;i<flow;i++) for(int j=0;j<timepoints;j++){ %> <html-el:text name="PumpCalibForm" property="flowratearray[<%=i%>][<%=j%>] /> <%} %> </logicresent> My Action class code is: ------------------------------------ else if("array".equals(action)){ int i=Integer.parseInt(pcform.getFlowpoints()); int j=Integer.parseInt(pcform.getTimepoints()); pcform.setFlowratearray(new String[i][j]); } By using this code , my JSP view is going wrong. what is the problem here. If any solution,i will be greatful. thanks.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
This is a common problem in web applications. Check out this thread for some possible approaches.
|
Merrill
Consultant, Sima Solutions
|
 |
 |
|
|
subject: getting 2D array view in jsp from actionform properties
|
|
|