tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric W Hauser <ehau...@indiana.edu>
Subject RE: JSTL or html:options issue
Date Mon, 11 Aug 2003 23:21:29 GMT
I would try using the Struts html-el tag libraries for doing this:

<html:options property="po" collection="${searchForm.po}"/>

You would obviously have to create a collection of beans that contained
the labelName and labelProperty accessors.  More information on this
method can be obtained here: 

http://jakarta.apache.org/struts/userGuide/struts-html.html#options

I can't really tell from your code, but if this HashSet is going to static
across your application, you may want to consider placing it in the
servlet context instead of in an instance of your action form.  With
you're current implementation, you should also consider how and when your
action form is getting instantiated.  I would make sure that you access to
an instance of the searchForm in either the request or session context.
You could test the JSTL tags by taking this collection out of the form,
and placing it in the session or request just as a test.

 On Mon, 11 Aug 2003, Karr, David wrote:

> Do you have more than one "getPo" function?  Do you have a "setPo"
> function?
> 
> And a long shot, you might try changing "po" to something more than two
> letters (making sure you change all your accessors in the same way).
>  
> > -----Original Message-----
> > From: Shah, Shrihas (OFT) [mailto:Shrihas.Shah@oft.state.ny.us]
> > 
> > Hi All:
> > 
> > I am unable to use html:options tag or unable to use JSTL in following
> > scenario. But I can use scriptlets.
> > 
> > Here is the scenario.
> > 
> > I have search.jsp and actionform is SearchForm.java (It's name in
> > struts-config.xml is 'searchForm')
> > 
> > In search.jsp the code is
> > 
> > <html:select property="po">
> >       <html:options property="po" />
> > </html:select>
> > 
> > -------
> > 
> > if I have following code in search.jsp it does not work either
> > 
> > <c:forEach var="x" items="${searchForm.po}" />
> >     <c:out value="${x}" />
> > </c:forEach>
> > 
> > In SearchForm.java the getPo function is as follows.
> > 
> > public HashSet getPo() {
> >     po = new HashSet();
> > // And this does return results. If I return array list it does not
> work
> > either
> >     ArrayList al = lu.getAttributes("nyappPODAdminOU");
> >     po.addAll((Collection)al);
> >     return po;
> > }
> > 
> > When I run the search.jsp it gives following error.
> > 
> > Error 500: An error occurred while evaluating custom action attribute
> > "value" with value "${searchForm.po}": Unable to find a value for "po"
> > in object of class "us.ny.state.oft.da.forms.SearchForm" using
> operator
> > "."
> > 
> > Any clue??
> > 
> > If I use scriptlet as below it works fine. (after I use jsp:useBean
> tag)
> > 
> > <% HashSet hs = searchForm.getPo();
> >    for ( Iterator i=hs.Iterator(); i.hasNext();)
> >    {%>
> >       <html:option value="<%(String)i.Next()%>"/>
> > <%   } %>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 
> 

-------------------
Eric Hauser
ehauser@indiana.edu
(317) 679-4766


Mime
View raw message