• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

struts2 iterator problem

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi freinds,

I am new to struts2.It is pretty good to use struts2.I am using Iterator in my jsp to display index using itStatus.I want get that index in my ActionSupport but i am not able to get that value .

<lms:iterator value="patterns" status="itStatus">
<td><lms:property value="#itStatus.getIndex()+1"/></td>
</iterator>

how to get that index value in my ActionSupport .can any body help me.

Thanks in advance.

[ UD: edited to fix RSS problems ]
 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

first of all you have to specify your struts property name="" tag.

Then and then you get this value using this name="value" field and get it to action.

Second thing your property tag does not contain name="" tag. It is use only display your value.

So, use textfield make it readonly="true" give it to name="XYZ" tag and then get it in Action using

request.getparameter("XYZ");

<lms:property value="#itStatus.getIndex()+1"/> this tag you have to change.


 
geeta kumari gonchala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you for your reply.

But i cant use textfields here .even if i use them .in my code i trying to get iterator by using href .

seet this once.

<lms:iterator value="testWebList" status="itStatus">
<tr>
<td><a href="currentIndex.action" ><lms:property value="index+1"/><a/></td>
</tr>

</lms:iterator>

so that i'm not able to get that index value
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Any how <s:property not give you value at Action.

Because in Action if you want value any variable then at least you have name of this variable.

And property tag have not name.

><s:property is you only display your variable at jsp. >
 
geeta kumari gonchala
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am able to get the index .thank you for your help

this is the code i'm using to get index.

<lms:iterator value="testWebList" status="itStatus">
<tr>
<td>
<!--
<a href="currentIndex.action"> <lms:property value="index + 1"/> <a/> -->


<lms:url id="currentIndex" action="currentIndex">
<lms:param name="currentIndex" value="index"/>
</lms:url>

<lms:a href="%{currentIndex}"> <lms:property value="index + 1"/> </lms:a>

</td>

</tr>

</lms:iterator>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic