I see what you mean now. You are correct. I have to wrap <html:select> tag with a <html:form> tag. This is not the first time that I stumble on this problem. I should surely learn a lesson now.
Thanks a lot for pointing out my mistake. This mistake should be imprinted in my head from now on. --- Matt Bathje <[EMAIL PROTECTED]> wrote: > 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"/> > >>>> > === message truncated === __________________________________ 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]