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 Getting Object in a Form instead of Just String 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 "Getting Object in a Form instead of Just String" Watch "Getting Object in a Form instead of Just String" New topic
Author

Getting Object in a Form instead of Just String

Rohit Prasad
Greenhorn

Joined: Sep 05, 2006
Posts: 12
This is how my JSP page looks like:

<% Expenses expensesBean = (Expenses)session.getAttribute("expensesBean"); %>

<logic:iterate id="expense" indexId="ind" name="expensesBean" property="myExpense">
Amount: <html:text name="expense" property="amount"/>
Location: <html:text name="expense" property="location"/>
....
....
</logic:iterate>

Here is my Expenses Class:




Here is my expense class:



How should I write my Form that can capture the Expenses object containing updated expense? Please let me know if I am not clear in my question.

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60808
    
  65

HTTP limits the values of request parameters to just strings.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Johnny Gara
Ranch Hand

Joined: Mar 09, 2007
Posts: 43
You can use EL to actually retrieve your information, using the dot operator.

something like this is possible:

Amount: ${expense.amount}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
Not all web app frameworks can do this. Stripes can, but I'm not sure about Struts.


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Object in a Form instead of Just String
 
Similar Threads
displaying data from arrays with html:text
how to obtain list object from an actionform
Nested Iterator Tags
logic iterate tag for Float array
Indexed Properties with List of Strings