This week's book giveaway is in the Open Source Projects forum.
We're giving away four copies of Eclipse Collections Categorically: Level up your programming game and have Donald Raab on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

bean:message in bean:define tag

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Am not a struts expert but can you try this?
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry but that throws...

"Define tag can contain only one of name attribute, value attribute, or body content"
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Skool. Stay in. Smartness. Tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic