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

bean:message in bean:define tag

Shailesh Modi
Greenhorn

Joined: Sep 27, 2002
Posts: 10
Hi All,
I am using the code snippet given below to define a variable for which the value is coming from property file by key 'home.mouseover.runbutton.caption.
But when i try to display ths jsp containing this snippet , i get java script error as struts doesn't compile "<bean:message key=home.mouseover.runbutton.caption/>" and assign this string literal as it is to runcapt variable.

Please let me know what can be done to assign the actual value in property file to runcapt variable.
jsp page
=====
<bean efine id="runcapt" value="<bean:message key=home.mouseover.runbutton.caption/>"/>
++++++++++++++++++++++++++++++++++++++++++++++++++++++
property file
==========
home.mouseover.runbutton.caption = Run Search
Thanks in advance


Shailesh Modi, SCJP 2
It is not what the computer can do, it is what YOU can do with it
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209

Am not a struts expert but can you try this?
Sean Gildea
Ranch Hand

Joined: Jul 01, 2004
Posts: 81
Sorry but that throws...

"Define tag can contain only one of name attribute, value attribute, or body content"


SCJD, SCBCD, SCJP
Aash Patel
Greenhorn

Joined: Sep 14, 2005
Posts: 24
Shailesh - I don't think you need to embed your bean message tag inside a bean define tag. This is how I do it:

<bean:message bundle="moreResources" key="required.field"/>

where bundle name is what you specify in your struts-config.xml as below:

<message-resources key="moreResources" parameter="MoreApplicationResources" />

where parameter name is the name of your properties file. In this case, my properties file is called MoreApplicationResources.properties

Make sense?
Aash Patel
Greenhorn

Joined: Sep 14, 2005
Posts: 24
Sorry - I misread the define variable part. In any case, you can try my suggestion to at least display the value. That way you know if your jsp is getting it from the properties file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: bean:message in bean:define tag