This is my point though - if what you posted is your entire listpages.jsp page (you haven't selectively cut/pasted) then your problem IS with the "anything" - you do not have an html:form tag wrapping your html:select, which is a nono. Since it can't find the form bean, it can't find the property called anything, which means it will crash with the error you are seeing.

My other 2 suggestions are to:

2: make sure that PageBean is a valid JavaBean
3: not use page import, which I'm not sure is valid for what you are doing (but I could be completely wrong on that)



Matt


Caroline Jen wrote:

Hi, thanks for the reply.

First, 'anything' is the property for the <html:select
....> tag; therefore, 'anything' has nothing to do
with my particular problem.

Second, 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 a collection of JavaBean(s) upon successful
completion of an action to pass onto a .jsp:

        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 my listpages.jsp, I have

<%@ 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>
it ended with this 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


--- Matt Bathje <[EMAIL PROTECTED]> wrote:


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:

=== message truncated ===



                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

---------------------------------------------------------------------
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