• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 label tag - key attribute is being replaced with actual value?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the simple theme to avoid table structure in my form. And when I use the Struts2 label tag in conjunction with a select tag linking the two by the key attribute , my label is changing when I set the select drop down in the form? The Form elements look like this:

<s:label key="country" />
<s:select name="country" key="country" id="country" cssClass="styled" headerKey=""
headerValue="Select From" value="%{country}"
list="{'Afghanistan','Albania','Algeria'}" required="true"
cssErrorClass="fv_error"/>

When the page renders, the label tag is generated with the correct value of 'COUNTRY', but when I select a country value from the select drop down, and then submit the form, other form errors are thrown because of missing values - validation occurs properly - and then the label changes to the country selected?

I need the label to remain the same and not change to the selected drop down value?
 
J Livermore
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The issue was the key name in the resource file, by qualifying it further by changing the key from country to label.country. So then in the JSP file, the label now looks like:

<s:label key="label.country" />
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic