Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
  • 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" />
 
permaculture is giving a gift to your future self. After reading this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic