• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting 2D array view in jsp from actionform properties

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a common problem in web applications. Check out this thread for some possible approaches.
 
You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic