Meaningless Drivel is fun!*
The moose likes Struts and the fly likes javax.servlet.jsp.JspException: Cannot find bean: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax.servlet.jsp.JspException: Cannot find bean: "testList" in any scope" Watch "javax.servlet.jsp.JspException: Cannot find bean: "testList" in any scope" New topic
Author

javax.servlet.jsp.JspException: Cannot find bean: "testList" in any scope

Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
Hello,

I am new to Struts, and I am trying to create a small web application using tutorials in Struts 1.3. I get the error
javax.servlet.jsp.JspException: Cannot find bean: "testList" in any scope .
Anyidea whats causing this? Pleaase help.

web.xml:

struts-config.xml:
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

Any idea whats causing this?


The bean "testList" isn't in any scope. Unfortunately, you don't provide the code that actually causes the error, so it's impossible to help.

And welcome to JavaRanch!
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
Thanks for replying David. I can add the full source code. Please find attached rest of the java files.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, create a minimum test case that fails. Post the related Java and JSP code only.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
... and please use Code tags around the code. It's so much harder to read otherwise.

If you don't understand what this means, please ask. Don't just continue to post the way you've been doing.

Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
Sorry I will edit the code. I did try to attach the files seperaely though.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How are you accessing the page? (Like the URL.)
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
I run this project with tomcat plug-in in eclipse. If I change the example.jsp to a static jsp page e.g. display Hello World, then it works fine.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So, the URL you're using to access the page is...?
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
http://localhost:8080/PE/example.jsp

or
http://localhost:8080/PE/
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The action is never being executed; you're accessing the JSP directly.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'd also recommend against using the URL mapping you're using, and instead set it to something more reasonable like "*.do", which is the canonical Struts 1 mapping.
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
Ok. I had mapped it to *.do earlier, however it gave the same error.

So what am I doing wrong that it does not call the action. What should I do?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Call the action: if you want actions to run you have to go through the normal Struts request processing flow.

There's nothing magic--the action is mapped in the Struts config file. Use that URL. Just calling a JSP doesn't involve Struts at all.
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
So I created the index.jsp and added it to the web.xml welcome-file


When I click on the link< i get the same error:

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "testList" in any scope
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're still just calling a JSP: CALL THE ACTION.
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
Okay, This is what I have modified in struts-config.xml and index.jsp. Now I get HTTP Status 404 No matter if I write /examplejsp or examplejsp in the link.



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You're just typing things at random.

Read some Struts documentation, try to follow a tutorial, something.

Normally actions are mapped to *.do. The action would be pathed "/example". The URL would be "/example.do".

http://struts.apache.org/1.x/userGuide/building_controller.html#a4.8.1_ActionMapping_Example
Riya Carl
Greenhorn

Joined: Feb 28, 2010
Posts: 9
Okay thanks. Is there tutorial where I can find examples on creating struts1.3 application?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Sorry; didn't know you couldn't access web searches.

http://struts.apache.org/1.3.10/index.html
http://struts.apache.org/1.3.10/userGuide/index.html
http://struts.apache.org/1.3.10/faqs/index.html

http://www.abqswt.com/tutorials/basicStruts/

There are also examples in the distribution.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Why do you want to use Struts 1.3? Why not Struts 2?
 
Consider Paul's rocket mass heater.
 
subject: javax.servlet.jsp.JspException: Cannot find bean: "testList" in any scope
 
Similar Threads
org.apache.jasper.JasperException: java.lang.NullPointerException: Module 'null' not found.
struts 1.beginner, code not working
java.lang.NullPointerException: Module 'null' not found
a question about struts....please help
error comes while running the struts application please see the source code for detail