Displaying values in html:option tag dynamically

Hi Experts,

This apprently gives syntax error and it is the following line.(If I switch to any string, it works.)

value="<bean:write name="providerListData" property="prnme" />"

I need to display prnme and store prnme, so value attribute and inside of option should be the same. This is what I did.

from java code
if(session.getAttribute("providerList") != null)

from jsp file
<logic:present name="providerList">
     <logic:iterate id="providerListData" name="providerList" >
         <logic:present name="providerListData">
            <html:option value="<bean:write name="providerListData" property="prnme" />">
                  <bean:write name="providerListData" property="prnme" />

What is wrong with this anyway?

Who is Participating?
Siva Prasanna KumarConnect With a Mentor Principal Solutions ArchitectCommented:
hey i didn't notice you nedd to use html:select inside which you use a html:option.

check out.

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
try this

value="<bean:write name='providerListData' property='prnme' />"
dkim18Author Commented:
what is the difference? I already tried that.
radarshConnect With a Mentor Commented:
You *can't* mix up two struts tags like that. It just won't work.

You'll either have to use JSTL tag or a scriptlet to do that.

Better still, use the HTML tag with EL support from struts.

Then, you can do something like this:


Also, use the <html:options> tag within a <html:select> tag as sivapsk suggested.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.