• 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

JSP problem

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir I created a servlet and at the end forwarding to some JSP using request dispatcher object...
Every time iam getting HTTP status 404 error why...iam using tomcat...please tell me where iam going wrong...
[ September 21, 2007: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Please post your code.

Where are you getting the RequestDispatcher reference from ? Are you getting it from the request object or from the ServletContext ? Are you using a relative or an absolute path ?

Please take the above assumptions into consideration and please post your source code.

Best of luck ...
 
bujji goud
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
iam getting dispatcher from request object....
Here iam mainly suffering from HTTP status 404 in tomcat server....
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you post your code!
 
bujji goud
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

soluion please......
[ September 21, 2007: Message edited by: bujji goud ]
 
Vassili Vladimir
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where does your JSP file reside inside TomCat ?
 
bujji goud
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

just inside of my web-application:
path:C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Accounting Application\jspfile

Originally posted by Vassili Vladimir:
Where does your JSP file reside inside TomCat ?

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what does your servlet map to? Because the RequestDispatcher from the HttpServletRequest object accepts a relative URL and you've passed it 'texttotable.jsp' which would make it relative to the current request.
 
bujji goud
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tarun Yadav:
And what does your servlet map to? Because the RequestDispatcher from the HttpServletRequest object accepts a relative URL and you've passed it 'texttotable.jsp' which would make it relative to the current request.


this is my web.xml
 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by bujji goud:

this is my web.xml



And you'd said your JSP is in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Accounting Application\jspfile\.

So that means the container is trying to forward to http://localhost/AccountingApplication/binttotext/texttotable.jsp whereas your JSP is at http://localhost/AccountingApplication/jspfile/texttotable.jsp

So modify your path accordingly. Make it "/jspfile/texttotable.jsp" instead.

Also, while we're at it, why is your application name "Accounting Application"? I'd suggest not using a space in your context name.
 
bujji goud
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


jspfile:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\AccountingApplication\texttotable.jsp

servlet path:
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\AccountingApplication\WEB-INF\classes\bintotext1.class
now tell me what i should do now iam not gettong with the above words...

 
Tarun Yadav
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok...first, try to access each resource individually.

Comment out the forward in the servlet and try to access it by typing in the path. Next, try to access the JSP.

Then, check your logs ( $CATALINA_HOME/logs ) for any clue to exceptions being thrown. And instead of simply printing the exception message, use printStackTrace() to get more information.

Also, I'd suggest you put all your classes in a package, it's not recommended to put them in the default package. This includes your servlets.
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic