The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

bobmunger (3) [Avatar] Offline
#1
hello to any and all

i am working through the examples in AJWD. i am working with struts example using eclipse 2.1.1, myEclipse 2.6.2, tomcat tomcat 5.0 and mySQL 4.0.17.

i have installed the schedule database and the web app successfully. i can walk through the code and the ScheduleDb object is populated.

when i set a breakpoint in ScheduleView.jsp all goes fine until within the logic:iterate loop ...

here is my code within jsp ...

<% System.out.println ( "got here 1");%>
<logic:iterate id="schedItem" >
name="scheduleBean"
type="com.nealford.art.schedstruts.entity.ScheduleItem"
property="events" >
<logic:present name="schedItem">
<% System.out.println ( "got here 2");%>
<tr>
<% System.out.println ( "got here 3");%>
<td><bean:write name="schedItem" property="start" />
<% System.out.println ( "got here 4");%>
<td><bean:write name="schedItem" property="duration" />
<td><bean:write name="schedItem" property="text" />
<td><bean:write name="schedItem" property="eventType" />
</tr>
</logic:present>
</logic:iterate>

here is my console output ...

got here 1
got here 2
got here 3
Feb 17, 2004 9:13:20 AM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true

here is my browser output ...

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Cannot find bean schedItem in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.ScheduleView_jsp._jspService(ScheduleView_jsp.java:144)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:24smilie
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

root cause

javax.servlet.jsp.JspException: Cannot find bean schedItem in any scope
org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:93smilie
org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:286)
org.apache.jsp.ScheduleView_jsp._jspx_meth_bean_write_0(ScheduleView_jsp.java:250)
org.apache.jsp.ScheduleView_jsp._jspService(ScheduleView_jsp.java:111)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:24smilie
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

note The full stack trace of the root cause is available in the Tomcat logs.
Apache Tomcat/5.0.18

Okay ... thanks in advance for any help. bob.
nford (36) [Avatar] Offline
#2
Re: Puzzled in seattle
Bob -

It looks like you are bypassing the Struts action that leads to this page, meaning that the schedItem bean isn't getting populated. Make sure that the hyperlink on the schedView page is pointing to the entry action, not directly to the JSP page.
bobmunger (3) [Avatar] Offline
#3
Re: Puzzled in seattle
dear puzzled, you are an idiot! oh woops. thats me.

thanks for answering neal. i am truly sorry to say that i commented out a taglib include in each of two jsp pages. the example works flawlessly now.

bob.