This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Custom objects on the ActionForm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Custom objects on the ActionForm" Watch "Custom objects on the ActionForm" New topic
Author

Custom objects on the ActionForm

Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
Hello All,
I have a Action form on which I have Custom objects like objOrders.
This also contains a composite object say OrderLine.

When on form, everywhere Im using it like property="Order.OrderLine".
To be available on the next page, I also have hidden fields on the page
<htnl:hidden property="Order.OrderId"/> which makes a html hidden field like
<input name="Order.OrderId" value="12345"/> - which becomes a very odd name and not useful

<htnl:hidden name="Order" property="OrderId"/> gives out <input name="OrderId" value="12345"/>
this is also not useful as actually I need something which suggests that the OrderId is a field in Order and lets me maintain it on the page as a hidden field.

Worse, the set and get of Order.OrderLine.OrderLineId becomes difficult.

Can anyone help me on this? Im basically trying to get the values of these from the jsp to the form/action.

Regards,
Leena


[SCJP2, SCWCD1.3, SCBCD]
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Originally posted by Leena Diwan:

<input name="Order.OrderId" value="12345"/> - which becomes a very odd name and not useful


Why is this not useful? This is how Struts works through dotted notation.


A good workman is known by his tools.
Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
coz this becomes the name and does not populate the value in the OrderId property in the Order object on the form.

Pls correct me if Im wrong.

Regards,
Leena
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I believe the follwing link might answer some of your questions about nested properties, etc.

http://struts.apache.org/faqs/indexedprops.html


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom objects on the ActionForm
 
Similar Threads
hidden for radio and multibox
Struts wizard + JavaScript validation
html:select and pulling out value
Re: using javascript in jsp's
obtaining parameters of hidden fields combined with multiple form tags