简体   繁体   中英

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....

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>

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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM