aspose file tools*
The moose likes Struts and the fly likes s:property tag values in action side Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "s:property tag values in action side" Watch "s:property tag values in action side" New topic
Author

s:property tag values in action side

rahulJ james
Ranch Hand

Joined: Oct 03, 2008
Posts: 123
When I use s:textfield name="name" tag I can get the value of this textbox in the action side using getName()..

whereas when I use s roperty or label tag, how do I get the value of this property in the action side..

Can anyone advise me..
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by rahulJ james:
when I use s:property or label tag, how do I get the value of this property in the action side..

You don't. The s:property displays the value on the page but does not submit it. If you want the value to be submitted and available to an action, use s:hidden.


Merrill
Consultant, Sima Solutions
rahulJ james
Ranch Hand

Joined: Oct 03, 2008
Posts: 123
If I use s:hidden, I would not be able to display the values ..

Is there anyway to display and fetch the values in the action
Jeffry Santoso
Greenhorn

Joined: Mar 12, 2008
Posts: 4
use <s:textfield key="name"/> ??
rahulJ james
Ranch Hand

Joined: Oct 03, 2008
Posts: 123
Again it will be in enable mode rite? I do not want to be in a textbox and wanted to fetch the same value in the action...

For timebeing I am using the list in the action side, iterating it and fetching the unmodified values..
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'd suggest you use both an s:property tag and an s:hidden tag. One to display the value, and the other to submit it.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

hi..

You can not get the value of property and lable value because this tag is used for represent your data comes form Action class.

If you want to send it to Action you have to use textfield or text otherwise use hidden value for it.

Thanks,
Nishan Patel.


Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 684

hi..

You can not get the value of property and lable value because this tag is used for represent your data comes form Action class.

If you want to send it to Action you have to use textfield or text otherwise use hidden value for it.

Thanks,
Nishan Patel.
rahulJ james
Ranch Hand

Joined: Oct 03, 2008
Posts: 123
Thanks all for your suggesions.. I am able to retrieve the values in the action..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: s:property tag values in action side
 
Similar Threads
struts2 iterator problem
Struts Date Conversion
How to handle request params and navigation
How to set value in html:text using bean:write
How to hide passwords?