struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Imran Bohoran <Im...@virtusa.com>
Subject RE: error..!(Thnks Swaroop George)
Date Tue, 22 Jul 2003 06:11:17 GMT
Try putting the scope as session in your iterate tag.

-----Original Message-----
From: virupaksha hosamath [mailto:virupakshah@yahoo.com]
Sent: Tuesday, July 22, 2003 12:07 PM
To: sgeorge@sapient.com
Cc: struts-user@jakarta.apache.org
Subject: RE: error..!(Thnks Swaroop George)


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(PageContextImp
l.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.ja
va: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(Application
FilterChain.java:247)	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)	at
 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)	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.ja
va:201)	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)	at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)	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:5
66)	at
 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)	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:5
66)	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

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message