File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes To Retrieve from a .properties File for the Value of a Custom Tag Attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "To Retrieve from a .properties File for the Value of a Custom Tag Attribute " Watch "To Retrieve from a .properties File for the Value of a Custom Tag Attribute " New topic
Author

To Retrieve from a .properties File for the Value of a Custom Tag Attribute

Daniel Gee
Ranch Hand

Joined: Aug 29, 2003
Posts: 202
I am trying not to code any text in my JSP. For example, I have the text 'Maintain Events' stored in a .properties file. And I can retrieve that text using:

Now, I am using a custom tag called 'trail'. If I hard code the text 'Maintain Event' in that custom tag, I can do:

How do I modify the tag specification to retrieve 'Maintain Events' from the .properites file? Thanks.

[ May 12, 2006: Message edited by: Daniel Gee ]
[ May 12, 2006: Message edited by: Daniel Gee ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
one possibility would be to have your class extend org.apache.struts.taglib.bean.MessageTag. You could then borrow its functionality and add your own.

Another possibility would be to declare that your tag accepts run-time expressions, and then resolve the message and pass the message in through a scriptlet or EL expression.


Merrill
Consultant, Sima Solutions
 
jQuery in Action, 2nd edition
 
subject: To Retrieve from a .properties File for the Value of a Custom Tag Attribute
 
Similar Threads
display-name Must be Declared
open text file
ZipException: Access is Denied
How To Specify the uri in taglib Directive
[Resolved] Display an Image