File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Riya Carl
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying David. I can add the full source code. Please find attached rest of the java files.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, create a minimum test case that fails. Post the related Java and JSP code only.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... 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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I will edit the code. I did try to attach the files seperaely though.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you accessing the page? (Like the URL.)
 
Riya Carl
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, the URL you're using to access the page is...?
 
Riya Carl
Greenhorn
Posts: 9
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The action is never being executed; you're accessing the JSP directly.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're still just calling a JSP: CALL THE ACTION.
 
Riya Carl
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay thanks. Is there tutorial where I can find examples on creating struts1.3 application?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to use Struts 1.3? Why not Struts 2?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic