Caroline - I have 3 suggestions.

The first is to make sure that you are using the correct form name in your html:form, and that the form definition is setup correctly in struts-config. The error message you are getting seems (to me at least) suspiciously like it can't find a form property named "anything" in the form you are trying to load up.

The second is to make sure that PageBean has getters/setters for all of its properties, and that it has a valid default constructor.

The third is to try and take the page import="bla" out of the page, and instead set a request variable with the bean data in you loader action. I've never tried doing it using the page import myself, so it may work (maybe somebody else can chip in on that...) but I've definitley had success with the other way.

Matt




Caroline Jen wrote:

I tried your way:


<%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ page import="org.dhsinfo.content.PageBean" %>

<html:select size="1" property="anything"
multiple="false">
    <html:options collection="PageBeans"
property="name" labelProperty="name"/>
</html:select>

and my way:

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ page import="org.dhsinfo.content.PageBean" %>

<bean:define id="nameList" name="PageBeans"
scope="request" type="java.util.ArrayList"  />
<html:select size="1" property="anything"
multiple="false">
    <html:options collection="nameList"
property="name" labelProperty="name"/>
</html:select>

Both ended with the same error message:

Http Status 500 root cause

javax.servlet.jsp.JspException: Cannot find bean under
name org.apache.struts.taglib.html.BEAN

and in the Tomcat logs file:

2004-09-20 12:03:38 ApplicationDispatcher[/DHSInfo]
Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find bean under
name org.apache.struts.taglib.html.BEAN
--- Amin Lalji <[EMAIL PROTECTED]> wrote:


Try removing the bean:define

And setting your line:

<html:options collection="nameList" property="name"
labelProperty="name"/>

to:

<html:options collection="PageBeans" property="name"
labelProperty="name"/>

HTH,
Amin

-----Original Message-----
From: Caroline Jen [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:26 PM
To: [EMAIL PROTECTED]
Subject: Hate Myself for Not Getting Drop-Down Menu
Right


There is no problem with the database operation. Data
are retrieved and can be displayed using the
<c:forEach ....> tag. Now, it is the drop-down
menu.


I have coded some drop-down menu before.  This time,
I
have a collection of JavaBeans instead of a
collection
of strings.  And, I am in trouble again.

I passed a collection of JavaBean(s) upon successful
completion of an action:

       Collection pages = service.getPages();
       request.setAttribute( "PageBeans", pages );

The individual JavaBean in the Collection is called
PageBean. The PageBean has only one property called
'name' (I made it simple for testing purpose) with
the
get and set methods.


In the listpages.jsp, I imported:

<%@ page import="org.dhsinfo.content.PageBean" %>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>

To form a drop-down menu, I did:

<bean:define id="nameList" name="PageBeans"
scope="request" type="java.util.ArrayList"  />

<html:select size="1" property="anything"
multiple="false">
   <html:options collection="nameList"
property="name" labelProperty="name"/>
</html:select>

I got this error:
Http Status 500 root cause


javax.servlet.jsp.JspException: Cannot find bean
under
name org.apache.struts.taglib.html.BEAN

and in the Tomcat logs file:

2004-09-20 12:03:38 ApplicationDispatcher[/DHSInfo]
Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Cannot find bean
under
name org.apache.struts.taglib.html.BEAN


__________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail



---------------------------------------------------------------------

To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]




---------------------------------------------------------------------

To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]







__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to