struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From virupaksha hosamath <virupaks...@yahoo.com>
Subject RE: error..!(Thnks Swaroop George)
Date Tue, 22 Jul 2003 06:07:01 GMT
Dear Swaroop,
 
Thanks for ur response..!
 
I just want to retrive data from the database using bean Dept.java,
I m not using any formbean here.just instantiating Dept bean in ListDepartmentAction.java
and displaying using <logic:iterate > tag in jsp called DeptListing.jsp. Action mapping
has done in struts-config.xml.
but still, i m getting same error. can u help me out..?
 
Model : Dept.java(to just retrive data from the database.)
Controller : ListDepartmentsAction.java(Instantiate class Dept )
View : DeptListing.jsp(iterate over bean and display)
 
for ur ref. i m sending code again pls. find..
 
im getting same error....
 
Thank you once again..
 please reply me....
 
Regards,
virupaksha
 
--------------------------------------------struts-config---------------------------------------------------
<struts-config>
      <!--  Action Mapping Definitions  -->
      <form-beans></form-beans>
       <action-mappings>
        <action path="/listDepartments" type="app.ListDepartmentsAction" scope="request"
validate="true">
     <forward name="listing" path="/DeptListing.jsp">
     </forward>
     </action>
    </action-mappings>
  </struts-config>
-----------------------------------------------------------------------------------------------------------------
 
---------------------------------------------DeptListing.jsp---------------------------------------------
<%@ taglib uri="strutslogic" prefix="logic" %>
<%@ taglib uri="strutsbean" prefix="bean" %>
<%@ taglib uri="strutshtml" prefix="html" %>
<table>
     <logic:iterate id="dept" name="departments">
                <tr>
          <td> 
    <bean:write name="dept" property="name" />
   </td>
     <td>
    <html:link page="/listEmployee.do" paramId="deptid" paramName="dept" paramProperty="id">
Show </html:link>
     </td>
  </tr>
 </logic:iterate> 
</table>
---------------------------------------------------------------------------------------------------------------
-------------------------------------------------ListDepartmentsAction.java----------------------
package app;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class ListDepartmentsAction extends Action{
 
        public ActionForward perform(ActionMapping mapping,ActionForm form,HttpServletRequest
request,HttpServletResponse response) throws Exception{
        Dept dept = new Dept();
        request.getSession().setAttribute("list",dept.getDepartments);
        return mapping.findForward("listing");
 }
}
---------------------------------------------------------------------------------------------------------------
------------------------------------------------------error----------------------------------------------

exception 
javax.servlet.ServletException: Cannot find bean departments in scope null	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:457)
at org.apache.jsp.DeptListing$jsp._jspService(DeptListing$jsp.java:187)	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:202)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)	at
 org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)	at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2344)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)	at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at
 org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:163)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)	at
 org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1011)	at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
at java.lang.Thread.run(Thread.java:536)------------------------------------------------------------------------------------------------------------

 


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message