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)
                    session.removeAttribute("providerList");
...
...

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" />
             </html:option>
                      
          </logic:present>
      </logic:iterate>
</logic:present>
+++++++++++++++

What is wrong with this anyway?

thx
dkim18Asked:
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.

http://www.javalobby.org/articles/struts/
http://husted.com/struts/tips/006.html
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
try this

value="<bean:write name='providerListData' property='prnme' />"
0
 
dkim18Author Commented:
what is the difference? I already tried that.
0
 
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:

value="${providerListData.prnme}"


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

________
radarsh
0
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.