aspose file tools*
The moose likes JSP and the fly likes runtime ERROR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "runtime ERROR" Watch "runtime ERROR" New topic
Author

runtime ERROR

anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
thiss is my servlet


this is my BasicCounter.jsp


i put servlet class file in D:\Tomcat\apache-tomcat-6.0.18\webapps\test\WEB-INF\classes\foo
and i put jsp file D:\Tomcat\apache-tomcat-6.0.18\webapps\test\WEB-INF

this is my web.xml


but when i type this in broser http://localhost:8080/test/BasicCounter.jsp it gives this eror

Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Anarkali.

Anything that is put under WEB-INF folder, will not serve directly to the client.
anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
now jsp file is in
i put jsp file D:\Tomcat\apache-tomcat-6.0.18\webapps\test
but error is there still.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Have you pasted the correct codes for servlet and jsp, the codes you have pasted appear to be plain java class.


Swastik
Chinmaya Chowdary
Ranch Hand

Joined: Apr 21, 2008
Posts: 432
Hi Anarkali.

Here foo.Counter is not a servlet. I think this causes the application fail during deployment. Ultimately any request's to it will not be served.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Again I am not finding anything related to any servlet, as per the code what is happening is a java class is being accessed from jsp. You are using a jsp file, and if that is not under web-inf you don't need any mapping for that, i.e. what you are doing right now accessing it directly from url.

Can you show your complete folder structure once again.
anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
this is my BasicCounter.jsp



this is my Counter.java servlet


this is my web.xml


this is the where servlet put D:\Tomcat\apache-tomcat-6.0.18\webapps\test\WEB-INF\classes\foo
this the where jsp put D:\Tomcat\apache-tomcat-6.0.18\webapps\test

this is what i type in browser http://localhost:8080/test/BasicCounter.jsp/
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

Few things are confusing here.

1. Jsp calling a method from a servlet, I guess this could have been a plain java class.
2. There is file called BasicCounter.jsp and in web.xml there is a url-mapping as BasicCounter.jsp mapped to the servlet, so on request which one should be invoked?
anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
why is it error?
anyway if it is a plain java class what should be in web.xml
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

this is what i type in browser http://localhost:8080/test/BasicCounter.jsp/

But that isn't what your servlet is mapped to.

It's really unclear what you're trying to do. Are you trying to access a JSP, or a servlet? Is there a reason you're trying to write this the way you are rather than using current servlet practices?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1478
    
    6

http://localhost:8080/test/BasicCounter.jsp/

probably the last / is creating the problem, it should have been

http://localhost:8080/test/BasicCounter.jsp

At least it wont show the 404 error. But still you are unlikely to get the desired output. Because as per web.xml mapping servlet will be executed and which is not producing any output. To invoke the jsp file you need to remove the servlet and servlet-mapping sections from your web.xml file.


anarkali perera
Ranch Hand

Joined: Sep 10, 2009
Posts: 237
actually this is a example of HeadFirst servlet & Jsp book.page number is 288.

in this example there is no servlet.there is a plain java class.but web.xml file is not there.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

So why do you have a web.xml file?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: runtime ERROR