struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro <apar...@gmail.com>
Subject Re: FW: logis:iterate tag problem
Date Wed, 14 Mar 2012 15:57:34 GMT
Sorry, I mean at that action throws an exception and then because you don't
forward a error page, always is success, then the bean list  is  never
filled in.

2012/3/13 Alejandro <aparcos@gmail.com>

> Do you know if that throws an exception?
>
>
> 2012/3/13 Oussama Jlassi <oussamaj@live.fr>
>
>>
>> i have the same message
>> >
>> > Try with:   request.getSession().setAttribute("list",list);
>> >
>> > 2012/3/13 Dave Newton <davelnewton@gmail.com>
>> >
>> > > I couldn't even read it.
>> > >
>> > > On Tue, Mar 13, 2012 at 3:35 PM, Oussama Jlassi <oussamaj@live.fr>
>> wrote:
>> > >
>> > > >
>> > > > no suggestion until now
>> > > >
>> > > > From: oussamaj@live.fr
>> > > > To: user@struts.apache.org
>> > > > Subject: logis:iterate tag problem
>> > > > Date: Mon, 12 Mar 2012 22:38:42 +0100
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > i use struts1.3 hibernate4 and tomcat6how to get iterate worki want
>> to
>> > > > list a table test with hibernate and struts but when i run
>> > > > localhost:8080/strutsh i got
>> > > > Etat HTTP 500 -type Rapport d'exceptionmessagedescription Le
>> serveur a
>> > > > rencontré une erreur interne () qui l'a empêché de satisfaire la
>> > > > requête.exceptionorg.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)
>> > > > 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.index_jsp._jspService(index_jsp.java:156)
>> > > >
>>  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)
>> > > > 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.index_jsp._jspService(index_jsp.java:106)
>> > > >
>>  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)
>> > > > 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
>> > > > index.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:writename="test" property="id"/></p></logic:iterate>
>> </body></html:html>
>>
>>  HibAction.javaimport 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.SessionFactory;import org.hibernate.Query;import
>> org.hibernate.Session;import java.util.*; public class HibAction extends
>> Action {
>>  public ActionForward execute(           ActionMapping mapping,
>>  ActionForm form,                HttpServletRequest request,
>> HttpServletResponse response) throws Exception{
>> HibForm formObj = (HibForm)form;
>>  ServletContext context =
>> request.getSession().getServletContext();
>>  SessionFactory factory = (SessionFactory)
>> context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);
>>  Session session =factory.openSession();
>>  try {                        Query
>> query=session.createQuery("SELECT t FROM test t");
>>  ArrayList list=(ArrayList)query.list();
>> request.setAttribute("list",list);
>>  } catch(Exception e) {
>>  session.getTransaction().rollback();            }
>> session.close();
>>  return mapping.findForward("success");  }
>>  }
>>
>>
>>
>>
>>
>
>

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