Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Content not shown after "forward"  RSS feed

 
timo corn
Ranch Hand
Posts: 68
MyEclipse IDE PHP Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got the following error when compiling ch1Servlet.java:
/usr/share/tomcat7-examples/examples/WEB-INF/classes/ch1Servlet.java:22: error: unreported exception ServletException; must be caught or declared to be thrown
view.forward(request,response);
^

The Java Servlet Code


App Structure:
-WEB-INF/classes/myservlet.class
-jsp/test.jsp

Is the exception related to a wrong jsp file path?
In the browser the app runs, but the jsp content is not shown.
 
K. Tsang
Bartender
Posts: 3628
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The path in the request dispatcher should start with a "/" indicating the path starts from the webapp's root context.

Second, do check whether your method throw ServletException or not.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65830
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Compiler errors have nothing at all to do with run-time problems.

If a method you calls throws a checked exception, you must either handle it or declare it in the throws clause. This is basic Java.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!