struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: Cannot find bean: “list” in any scope
Date Sat, 17 Mar 2012 21:45:24 GMT
The line that puts it in the request is commented out, is that a typo?

(pardon brevity and typos, on cell)
On Mar 17, 2012 5:43 PM, "Oussama Jlassi" <oussamaj@live.fr> wrote:

>
> i want to list table test with hibernate4 and struts1.3.10 in tomcat6 but
> when i run localhost:8080/strutsh/hib1.do i get
>
> Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le serveur a
> rencontré une erreur interne () qui l'a empêché de satisfaire la
> requête.exceptionjavax.servlet.ServletException:
> org.apache.jasper.JasperException: javax.servlet.ServletException:
> javax.servlet.jsp.JspException: Cannot find bean: "list" in any scope
>
>  org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
>
>  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>        org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> cause mèreorg.apache.jasper.JasperException:
> javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find
> bean: "list" in any scope
>
>  org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
>
>  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
>
>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>  org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
>
>  org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
>
>  org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
>
>  org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
>        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>
>  org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
>        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>
>  org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
>
>  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>        org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> cause mèrejavax.servlet.ServletException: javax.servlet.jsp.JspException:
> Cannot find bean: "list" in any scope
>
>  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
>
>  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
>        org.apache.jsp.list_jsp._jspService(list_jsp.java:141)
>        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
>
>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>  org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
>
>  org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
>
>  org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
>
>  org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
>        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>
>  org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
>        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>
>  org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
>
>  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>        org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> cause mèrejavax.servlet.jsp.JspException: Cannot find bean: "list" in any
> scope
>        org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:864)
>
>  org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:236)
>        org.apache.jsp.list_jsp._jspService(list_jsp.java:92)
>        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
>
>  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
>        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>  org.apache.struts.chain.commands.servlet.PerformForward.handleAsForward(PerformForward.java:113)
>
>  org.apache.struts.chain.commands.servlet.PerformForward.perform(PerformForward.java:96)
>
>  org.apache.struts.chain.commands.AbstractPerformForward.execute(AbstractPerformForward.java:54)
>
>  org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
>        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>
>  org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
>        org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
>
>  org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
>
>  org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
>        org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> note La trace complète de la cause mère de cette erreur est disponible
> dans les fichiers journaux de Apache Tomcat/6.0.35.Apache Tomcat/6.0.35
> list.jsp
>
> <%@ page language="java" pageEncoding="ISO-8859-1"%><%@ taglib uri="
> http://struts.apache.org/tags-html" prefix="html" %><%@ taglib uri="
> http://struts.apache.org/tags-logic" prefix="logic" %><%@ taglib uri="
> http://struts.apache.org/tags-bean" prefix="bean" %>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html:html>    <head>        <meta http-equiv="Content-Type"
> content="text/html; charset=UTF-8">        <title>JSP Page</title>
>  </head>    <body>
> <logic:iterate name="list" id="test"><p><bean:write name="test"
> property="id"/></p></logic:iterate>    </body></html:html>
>
>
> Hib1Action
>
> import javax.servlet.http.HttpServletRequest;import
> javax.servlet.http.HttpServletResponse;import javax.servlet.ServletContext;
> import org.apache.struts.action.Action;import
> org.apache.struts.action.ActionForm;import
> org.apache.struts.action.ActionForward;import
> org.apache.struts.action.ActionMapping;
> import org.hibernate.*;
> import java.util.*;
> public class Hib1Action extends Action {
> private List<test> list = new ArrayList<test>();
> @SuppressWarnings("unchecked")
>        public ActionForward execute(           ActionMapping mapping,
>      ActionForm form,                HttpServletRequest request,
>   HttpServletResponse response) throws Exception{
>                ServletContext context =
> request.getSession().getServletContext();
>                SessionFactory factory = (SessionFactory)
>  context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
>                Session session = factory.openSession();try {
>     //session.beginTransaction();
> list= session.createSQLQuery("SELECT * FROM test").list();
>                  //session.getTransaction().commit();
>  //request.setAttribute("list",list);
>  } catch(Exception e) {
>  session.getTransaction().rollback();              e.printStackTrace(); }
>                       session.flush();                session.close();
>                return mapping.findForward("success");  }
> public List<test> getList() {           return list;    }
> public void setList(List<test> list) {          this.list = list;       } }
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message