This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problems with bean:write

 
Mike Phillip
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I have a form (MyForm) that has a bean (Car). The Action (MyAction) sets the value of the car property.

Then I want to show in the .jsp file the properties inside the Car bean (model, year...)

after the action sets the property the jsp has the following:

<logic resent name="myForm" property="car">
Car model <bean:write name="car" property="model"/><br>
</logic resent>

but it doesn't works, says that the bean car is not present.

When I do

<logic resent name="myForm" property="car">
Car model <bean:write name="myForm" property="car"/><br>
</logic resent>

it prints the car.toString

I need to get the car and then print its properties.

any help?

thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
It's a two step process. First get a reference to the car:
<bean:define id="myCar" name="myForm" property="car" />

Then print out the model:
<bean:write name="car" property="model" />
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another option is to use "dot" notation. Example:

This will cause Struts to perform the following method calls:

[ May 03, 2008: Message edited by: Merrill Higginson ]
 
Mike Phillip
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys, I'll try that.


best regards
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic