my dog learned polymorphism*
The moose likes Struts and the fly likes bean:message and bean:write Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:message and bean:write" Watch "bean:message and bean:write" New topic
Author

bean:message and bean:write

Chris Boldon
Ranch Hand

Joined: Aug 10, 2006
Posts: 190
I'm trying to output a message from ApplicationResources.properties while passing in an arg. The value I want to pass as an arg is in the FormBean. However, I cannot pass a variable to the message tag without using scriptlets. What is a good way to do this?



How to I pass a vatiable into bean:message?
[ November 02, 2006: Message edited by: Chris Novindus ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Use the Struts-el version of the tags. Then you can substitute an EL expression.

To use the Struts-el version, use the following taglib definition:

<%@ taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean" %>

and make sure you have struts-el.jar, jstl.jar, and standard.jar in your classpath.

Then you can write:

Where myForm is the name of your ActionForm.
[ November 03, 2006: Message edited by: Merrill Higginson ]

Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: bean:message and bean:write