user2455862
user2455862

Reputation: 678

Struts tag inside another tag STRUTS 1.3

I've got a problem. I've been searching for the answer on different forums but unfortunatelly I didn't find the answer. I need this because I'm creating a webpage where you can change language so it cannot be hard coded.I need to do sth like this:

<html:option value="<bean:message key="region"/>"><bean:write name="region"/></html:option>

So I want to have the value in html tag set to the string taken from my messages.properties file.The above solution doesn't work. I'd be really grateful for answer because I spend too much time on this....

Upvotes: 1

Views: 1628

Answers (2)

Roman C
Roman C

Reputation: 1

You can use the code using struts tags

<bean:define id="regionId"><bean:message key="region"/></bean:define>
<html:option value="<%=regionId%>"><%=regionId%></html:option>

or better using JSTL

<fmt:message key="region" var="regionId"/>
<html:option value="${regionId}">${regionId}</html:option>

Upvotes: 2

S. Moreno
S. Moreno

Reputation: 536

I see a "more than" symbol who closes nothing.

<html:option value="<bean:write name='region'/>">
  <bean:write name="region"/>
</html:option>

I suppose you have more than one selection in that select, so your code maybe it should be like this:

  <html:select property="Language"> 
      <logic:iterate id="RegionSelection" name="Regionlist" scope="session" type="RegionForm"> 
            <html:option value="<bean:write name='RegionSelection' property='RegionName'/>"> 
                      <bean:write name='RegionSelection' property='RegionName'/> 
            </html:option> 
      </logic:iterate> 
  </html:select> 

Upvotes: 0

Related Questions