aspose file tools*
The moose likes Struts and the fly likes problems with bean:write Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problems with bean:write" Watch "problems with bean:write" New topic
Author

problems with bean:write

Mike Phillip
Ranch Hand

Joined: Dec 05, 2007
Posts: 37
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30309
    
150

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Merrill
Consultant, Sima Solutions
Mike Phillip
Ranch Hand

Joined: Dec 05, 2007
Posts: 37
thanks guys, I'll try that.


best regards
 
wood burning stoves
 
subject: problems with bean:write