struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From UITOT <nehaagrawa...@gmail.com>
Subject Re: Problem in using logic:iterate in struts
Date Wed, 24 Sep 2008 05:42:08 GMT

Hello Laurie,
                Thanx a lot for replying.Let me tell you the exact
scenario.I am developing a discussion forum for my Project.There is one JSP
called "View_topic.jsp".This will display the list of all topics in the
Discussion Forum.Before this JSP one action class say "view_topics_Action"
is getting called which is setting the arraylist for topics say "topic_list"
in request scope.This list is getting displayed using logic:iterate in
view_topic.jsp.No problem till here.Now when user clicks on a particular
topic I want that all the threads related to that topic should get
displayed.So I have made each topic as a Hyperlink.Now when user clicks on a
particular topic I want the topic_id to get passed to some action class say
"view_threads_Action" which will take care of retrieving the Threads details
for that topic & if it is successful it will call another JSP say
"View_threads.jsp".


Now I don't have any problem in displaying topic list.I am getting error
only when I am clicking on the hyperlink.The error is in JSP
"view_topic.jsp" only so it not going to action class "view_threads_Action".
I hope I am able to explain my problem.Please help.Thanx.
 

Laurie Harper wrote:
> 
> Unfortunately your struts-config.xml and JSP code didn't make it through 
> to the list properly. Make sure you're sending your message as plain text.
> 
> A couple of questions:
> 
> *) How are you accessing the page? (i.e. what URL are you typing?)
> 
> *) Are you sure you are calling the action before the JSP is rendered? 
> What happens if you put a println at the top of execute()
> 
> L.
> 
> UITOT wrote:
>> Hello all,
>> I have developed 1 application using struts.I am getting this error in my
>> JSP.I have used logic:iterate.I have populated an arraylist in action
>> class
>> which I am using in my JSP.I am able to see the data from the arraylist
>> in
>> my JSP but I am getting error when I am clicking on the hyperlink in
>> JSP.This is the error.Please help me as I am pretty new to struts.Any
>> help
>> will be highly appreciated.Thanx in advance.
>> 
>> ApplicationDispatcher[/TGMC_DB1-2009] PWC1231: Servlet.service() for
>> servlet
>> jsp threw exception
>> javax.servlet.jsp.JspException: Cannot find bean: "topic_list" in any
>> scope
>> at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
>> at
>> org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:232)
>> at org.apache.jsp.viewThreads_jsp._jspService(viewThreads_jsp.java from
>> :121)
>> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>> at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
>> at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:853)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
>> at
>> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
>> at
>> org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
>> at
>> org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
>> at
>> org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
>> at
>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
>> at
>> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
>> at
>> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>> at
>> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
>> at
>> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
>> at
>> com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
>> StandardWrapperValve[action]: PWC1406: Servlet.service() for servlet
>> action
>> threw exception
>> javax.servlet.jsp.JspException: Cannot find bean: "topic_list" in any
>> scope
>> at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
>> at
>> org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:232)
>> at org.apache.jsp.viewThreads_jsp._jspService(viewThreads_jsp.java from
>> :121)
>> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>> at
>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
>> at
>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:853)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
>> at
>> org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
>> at
>> org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
>> at
>> org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
>> at
>> org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
>> at
>> org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
>> at
>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
>> at
>> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
>> at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
>> at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
>> at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
>> at
>> org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
>> at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
>> at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>> at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
>> at
>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
>> at
>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
>> at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
>> at
>> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
>> at
>> com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
>> at
>> com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
>> 
>> *//Action class*
>> package com.myapp.struts;
>>  
>> import java.io.IOException;
>> import javax.servlet.ServletException;
>> import javax.servlet.http.HttpServletRequest;
>> import javax.servlet.http.HttpServletResponse;
>>  
>> 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 java.util.ArrayList;
>>  
>> public class DiscussionForumViewAction extends Action {
>>  
>>    
>>   public ActionForward execute(ActionMapping mapping,
>>     ActionForm form,
>>     HttpServletRequest request,
>>     HttpServletResponse response)
>>     throws IOException, ServletException
>>  {
>>    
>>       String target = new String("success");
>>    
>>         try
>>         {
>>          ArrayList TopicList = null;
>>          TopicList= Discussion_Forum.getTopics();
>>          request.setAttribute("topic_list",TopicList);
>>         }
>>         catch(Exception ex)
>>         {
>>             System.out.println(ex.getMessage());
>>         }
>>       return (mapping.findForward(target));
>>  }
>>        
>> }
>>  
>> *// jsp*
>>  
>> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
>> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
>> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
>>  
>> <%@page contentType="text/html" pageEncoding="UTF-8"%>
>> 
>>  
>> 
>>     
>>     
>>    
>>     
>>         
>>         
>> 
>>  
>> Discussion Forum
>> 
>>  
>> 
>>  
>>         
>> 
>>               
>>            
>>             
>> 
>>                             
>>                              
>> 
>>                                 	Forum
>>                                 	Topic/Messages
>>                                	Last Post
>>                              
>>                             
>>                             
>>                                
>>                                 
>>                                   
>>                                     
>> 
>>                                       	
>> // this is the statement which is generating error                              
          
>> get_threads.do?topic_id=<bean:write name= ">      
>>                                     
>>     
>>                                     	
>>                                     
>>                                    
>>                               
>>                                    	
>>                                    
>>                                   
>>    
>>                                 
>>                             
>>                         
>>                  
>>            
>> 
>>         
>> 
>>     
>>  
>> 
>>  
>> *//struts config*
>>     
>>                
>>                
>>        
>>    
>>  
>> *//formbean*
>> package com.myapp.struts;
>>  
>> import javax.servlet.http.HttpServletRequest;
>>  
>> import org.apache.struts.action.ActionForm;
>> import org.apache.struts.action.ActionMapping;
>>  
>> public class TopicFormBean extends ActionForm {
>>  
>>   protected String topic_name;
>>   protected String description;
>>   protected Integer no_of_threads;
>>   protected String last_post;
>>   protected Integer topic_id;
>>  
>>  
>>  
>>     public String getTopic_name() {
>>         return topic_name;
>>     }
>>  
>>     public void setTopic_name(String topic_name) {
>>         this.topic_name = topic_name;
>>     }
>>  
>>     public String getDescription() {
>>         return description;
>>     }
>>  
>>     public void setDescription(String desc) {
>>         this.description = desc;
>>     }
>>  
>>      public Integer getNo_of_threads() {
>>         return no_of_threads;
>>     }
>>  
>>     public void setNo_of_threads(Integer no_of_threads) {
>>         this.no_of_threads = no_of_threads;
>>     }
>>  
>>     public String getLast_post() {
>>         return last_post;
>>     }
>>  
>>     public void setLast_post(String last_post) {
>>         this.last_post = last_post;
>>     }
>>  
>>      public Integer getTopic_id() {
>>         return topic_id;
>>     }
>>  
>>     public void setTopic_id(Integer topic_id) {
>>         this.topic_id = topic_id;
>>     }
>>  
>>       }
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-in-using-logic%3Aiterate-in-struts-tp19622971p19642346.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Mime
View raw message