<html:option tag "value" attribute problem

Discussions

Web tier: servlets, JSP, Web frameworks: <html:option tag "value" attribute problem

  1. <html:option tag "value" attribute problem (3 messages)

    Hello everybody,

    Please somebody help me solving this issue. I'm using <html:option tag in my code, but value attribute is not evaluating request time expression. It is taking the expression as it's value instead. Below is the code snippet. I am getting option value as "<c:out value=''/>".

    /*********************************************/
    <html:select property="paymentId" size="1">
    <logic:iterate id="eachPayment" name="xxxForm" property="xxList" indexId="xxIndex">
     
    <% PaymentType payment = (PaymentType)eachPayment; %>
    <html:option value="<c:out value='${payment.id}'/>" >
    <bean:write name="eachPayment" property="xxBin"/>
    </html:option>

    </logic:iterate>
    </html:select>
    /*********************************************/


    Your suggestions are greatly appreciated. Thank you in advance.

    -Akash
  2. Hello everybody,Please somebody help me solving this issue. I'm using <html:option tag in my code, but value attribute is not evaluating request time expression. It is taking the expression as it's value instead. Below is the code snippet. I am getting option value as "<c:out value=''/>". /*********************************************/<html:select property="paymentId" size="1"><logic:iterate id="eachPayment" name="xxxForm" property="xxList" indexId="xxIndex"> <% PaymentType payment = (PaymentType)eachPayment; %> <html:option value="<c:out value='${payment.id}'/>" > <bean:write name="eachPayment" property="xxBin"/></html:option></logic:iterate></html:select>/*********************************************/Your suggestions are greatly appreciated. Thank you in advance.-Akash
    you can try this tag <html:options>.
    <html:select property="paymentId" size="1">
      <html:options collection="xxList" labelProperty="xxBin" valueProperty="id"/>
    </html:select>
  3. Hi akash,

    as a rule of thumb: you cannot use custom tags in another custom tag's attribute - even if it's a runtime expression attribute.

    You can think of it as two different stages of evaluating the page. First the runtime expressions, then all the custom tags.

    Ciao,

    René
  4. simple solution[ Go to top ]

    instead of:

    <html:option value="<c:out value='${payment.id}'/>" >

    write:

    <html:option value="${payment.id}" />


    -Sergey.