• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing List from Servlet to jsp ? - value of list becomes NULL

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all

In my servlet, I have following code:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

FileDAO fileDAOInstance = new FileDAO();
List servletList = fileDAOInstance.getDataFromDB();

request.getSession().setAttribute("somename", servletList); //setting the list into request object

String jspPage = "/FileData.jsp";
RequestDispatcher dis = getServletContext().getRequestDispatcher(jspPage);
if(dis != null)
dis.forward(request,response);

}

And in my jsp, I am trying to retrieve it using:

List dataList = (List) request.getSession().getAttribute("somename");
Iterator itr = dataList.iterator();

The value of List is NULL.
Please tell me if anything is wrong in this piece of code.

Thanks !!
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems similar to this

https://coderanch.com/t/450262/JSP/java/when-trying-code-from-HFSJ#2004025

Perhaps the List returned by your DAO was null or you are not going to the JSP via the servlet ?

Can you post a stack trace please? and use CODE tags while displaying your code. Thanks
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Deepak, and sorry for putting the code this way.

here is the stack trace:

11:22:36,843 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.FileData_jsp._jspService(FileData_jsp.java:110)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi kunal, tell us your request flow( example:how you trigger the servlet ?). still need details to figure out the problem
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay. I ll write down the details:
There is a possibility of the List being NULL in servlet itself.
Please help me guys.

I have written a Core Java method that return a List of JavaBean objects.


I am giving this to servlet, in doPost method.


I havent made changes anywhere else in the servlet.

And then I am trying to t\retrieve that List in jsp.


So, is there any problem over here ?
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1.this is redundant in your jsp . just declare it


2. your flow looks fine to me. check where you went wrong and why you get null from your session using by LogWritter
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Helloooooooooooooooooo
plese help me
 
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suggest you check inside the servlet that the returned list is null or not (by logging).
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I check inside theservlet, if the returned List is NULL or not.
tried, but I am not able to do so .....
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have my code in doPost() ... but my doPost method is not getting called, tried this by writeng some SOPs.
why is that ?
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kunal Alshi wrote:i have my code in doPost() ... but my doPost method is not getting called, tried this by writeng some SOPs.
why is that ?



Then how you get to the JSP anyway? First make sure the program flow is working well then you may correct other errors
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vijitha Kumara wrote:

Kunal Alshi wrote:i have my code in doPost() ... but my doPost method is not getting called, tried this by writeng some SOPs.
why is that ?



Then how you get to the JSP anyway? First make sure the program flow is working well then you may correct other errors




yeah madam !
i wrote the code in doGet(). Because in this case, doPost() will never execute.

the program flow is correct, because the static data is from my jsp is getting displayed. Only the List is passed as NULL.
I get the following exception.
I guess solving this exception will solve the problem as well.

Please help me to solve this exception.

Thanks.

14:16:17,593 ERROR [STDERR] java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from BaseClassLoader@6adf2f{VFSClassLoaderPolicy@6288ed{name=vfszip:/C:/Program%20Files/JBoss/jboss-5.0.1.GA/server/default/deploy/SampleWebProject.war/ domain=ClassLoaderDomain@bffcc0{name=vfszip:/C:/Program%20Files/JBoss/jboss-5.0.1.GA/server/default/deploy/SampleWebProject.war/ parentPolicy=AFTER_BUT_JAVA_BEFORE parent=ClassLoaderDomain@996cca{DefaultDomain}} roots=[MemoryContextHandler@17531354[path= context=vfsmemory://5c4o033-8j4ejr-fw4no7b5-1-fw4nohfq-1x real=vfsmemory://5c4o033-8j4ejr-fw4no7b5-1-fw4nohfq-1x], ZipEntryHandler@8012028[path=SampleWebProject.war/WEB-INF/classes context=file:/C:/Program%20Files/JBoss/jboss-5.0.1.GA/server/default/deploy/ real=file:/C:/Program%20Files/JBoss/jboss-5.0.1.GA/server/default/deploy/SampleWebProject.war/WEB-INF/classes]] delegates=null exported=[com.file.sample] <IMPORT-ALL>NON_EMPTY}}
14:16:17,593 ERROR [STDERR] at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:422)
14:16:17,593 ERROR [STDERR] at java.lang.ClassLoader.loadClass(Unknown Source)
14:16:17,593 ERROR [STDERR] at java.lang.ClassLoader.loadClassInternal(Unknown Source)
14:16:17,593 ERROR [STDERR] at java.lang.Class.forName0(Native Method)
14:16:17,593 ERROR [STDERR] at java.lang.Class.forName(Unknown Source)
14:16:17,593 ERROR [STDERR] at com.file.sample.ConnectionUtil.getConnection(ConnectionUtil.java:13)
14:16:17,593 ERROR [STDERR] at com.file.sample.FileDAO.getDataFromDB(FileDAO.java:31)
14:16:17,593 ERROR [STDERR] at com.file.sample.FileServlet.doGet(FileServlet.java:36)
14:16:17,593 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
14:16:17,593 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
14:16:17,593 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
14:16:17,593 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
14:16:17,593 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
14:16:17,593 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
14:16:17,593 ERROR [STDERR] java.lang.NullPointerException
14:16:17,593 ERROR [STDERR] at com.file.sample.FileDAO.getDataFromDB(FileDAO.java:36)
14:16:17,593 ERROR [STDERR] at com.file.sample.FileServlet.doGet(FileServlet.java:36)
14:16:17,593 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
14:16:17,593 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
14:16:17,593 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
14:16:17,593 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
14:16:17,593 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
14:16:17,593 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
14:16:17,593 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
14:16:17,593 ERROR [STDERR] at java.lang.Thread.run(Unknown Source)
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add the mysql connector jar in your class path
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is already added
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
not loaded properly
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver



it is already added


Where is it located(Path) in the web application ?
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\Program Files\mysql-connector-java-5.1.7\mysql-connector-java-5.1.7-bin.jar

I am loading it from this location.

I guess this wont work for servlets, right ??
where should I put this jar file, so as to include in classpath ?
 
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
doPost() will get hit only if you specifically mention "method=POST" in the form declaration inside your JSP page, from where the control initially came to the servlet. Once inside the servlet, there are a lot of ways to know if the list returned is null :

1) if(null == servletList) sysout("list is null")
2) if(null == servletList && servletList.isEmpty()) sysout("list is not null, but empty")
etc.....
 
Vijitha Kumara
Bartender
Posts: 4116
72
Mac TypeScript Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kunal Alshi wrote:C:\Program Files\mysql-connector-java-5.1.7\mysql-connector-java-5.1.7-bin.jar
I am loading it from this location.I guess this wont work for servlets, right ??where should I put this jar file, so as to include in classpath ?



Where are you deployed this servlet? You have to put the JDBC jar file in a place where web/application server can find, usually inside your application's lib directory.
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help everyone.

The exception is gone by placing the connectorJ jar in the lib folder of application server and including it in the classpath.

But I am still having some issues with displaying the List elements on jsp page.
I will keep this thread updated for the solution.

Thanks a lot !!

 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why dont you just place these dependent jars inside

<webserverRoot>/webapps/<your_webapplication>/WEB-INF/lib

folder, restart the web server/servlet container, and check if you are still getting the classnotfound ???
Loading the class from a different location other than the web server path is a bad idea.
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone
Can anyone please say me what is wrong with these statements ?

Servlet code:



JSP code:



"dataList" has the value of NULL, even though "servletList" is NOT NULL.

please help !!
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's impossible to help with just those two statements in isolation.
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You seem to be solving one problem after another but not exactly in the way desired. When posting your next question please also post a related stack trace and a specific cause for the problem. That way the answers will help you a lot more.

"dataList" has the value of NULL, even though "servletList" is NOT NULL.



This is an impossibility, unless the session attributes were removed for some reason.

Hit the servlet.
Confirm if the list was null
The servlet redirects to the JSP
The value should be printed.

As simple as that. Your libraries should ideally not be present on a container level classpath
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:When posting your next question please also post a related stack trace and a specific cause for the problem. That way the answers will help you a lot more.



Here it is:

08:58:43,687 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at org.apache.jsp.FileData_jsp._jspService(FileData_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)



Hit the servlet.
Confirm if the list was null
The servlet redirects to the JSP
The value should be printed.



On hitting the servlet, the List is displayed. On hitting the jsp, List is not displayed.
So, the List is not getting passed to the jsp.

What is the problem with code ?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, now show the code where the null pointer occurs (again, if it's the same code as before). Better yet, show *more* of the code in question. Things don't just disappear out of session for no reason, and this back-and-forth isn't very efficient.
 
Steve Adam
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
Thanks for your concerns.

The real problem was that I was hitting the jsp url, instead of the servlet, which I later came to know was a mistake in itself.
My program got running by hitting the servlet url.

Thank you ALL.
appreciate your help.
reply
    Bookmark Topic Watch Topic
  • New Topic