• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Object in a Form instead of Just String

 
Rohit Prasad
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64717
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTTP limits the values of request parameters to just strings.
 
Johnny Gara
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use EL to actually retrieve your information, using the dot operator.

something like this is possible:

Amount: ${expense.amount}
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not all web app frameworks can do this. Stripes can, but I'm not sure about Struts.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic