tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shah, Shrihas (OFT)" <Shrihas.S...@oft.state.ny.us>
Subject RE: JSTL or html:options issue
Date Fri, 15 Aug 2003 16:51:42 GMT
Hi Eric and David:

Thanks to both of you for quick response. I appreciate your help. 

I found the problem.

I was using same property in both <html:select and html:options once I
changed one of them and modified method name it fixed the issue. 
<html:select property="scope" >			
	<html:options name="searchForm" property="po"/>
</html:select>

once I changed the html:select property="po" to property="scope", it
started working. 

I also have defined jsp:useBean to define the searchForm too. 

Thanks to all of you.

Shrihas Shah
NYS Office for Technology
shrihas.shah@oft.state.ny.us
Phone (518) 408-2382
Fax (518) 473-3389
(US Postal Service Regular Mail Address)
State Capitol ESP, PO Box 2062
Albany, NY 12220-0062
(Parcel Post/Overnight and Interagency Mail Address)
Empire State Plaza
Swan St., Core 4, 1st Floor
Albany, NY 12223


-----Original Message-----
From: Eric W Hauser [mailto:ehauser@indiana.edu] 
Sent: Monday, August 11, 2003 7:21 PM
To: Tag Libraries Users List
Subject: RE: JSTL or html:options issue

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


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message