wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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

Getting Object in a Form instead of Just String

Rohit Prasad

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"/>

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.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60752

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

Joined: Mar 22, 2005
Posts: 41052
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
logic iterate tag for Float array
how to obtain list object from an actionform
displaying data from arrays with html:text
Indexed Properties with List of Strings
Nested Iterator Tags