wood burning stoves*
The moose likes Servlets and the fly likes trouble with path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "trouble with path" Watch "trouble with path" New topic
Author

trouble with path

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i keep getting this error message:
The requested resource (/sql/sql_gateway.jsp) is not available

i read the api:
path - a String specifying the pathname to the resource. If it is relative, it must be relative against the current servlet.

and also read your faq:
To forward a request to a JSP page we use


RequestDispatcher dispatch = request.getRequestDispatcher("/TestJspOne.jsp");
Here "/TestJspOne.jsp" the slash denotes the Jsp page is at the root of the application.


yet, when trying to follow a murach's tutorial i found here at javaranch, i get that error; i tried to put my jsp inside and outside sql folder, next to calling servlet
What might i been doing wrong?

TiA


java amateur
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

Where does the sql folder reside relative to the context root?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Originally posted by Bear Bibeault:
Where does the sql folder reside relative to the context root?


i've my servlets at:
C:\Programas\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\classes\murach\sql
hope this answers, because i'm unsure about context root
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

In this case, the context root is:
C:\Programas\Apache Software Foundation\Tomcat 5.5\webapps\ROOT


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Where is the sql folder in relation to that?
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
maybe i should add to things: servlets and jsp are a new world to me and, secondly, i've this ant build that makes it all for me:

as you might imagine, i'm quite puzzled because i cant use it the way i use it in other tutorials, because it seems to me that Murach has servlets and jsp's toghether, oposite to what i'm used to
also, i changed so many things that now i cant even open the initial html/jsp page
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
@ Ben
is here:
WEB-INF\classes\murach\sql
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

\WEB-INF\classes\murach\sql


If that's where the JSP file is, then the path would be:



That said, I've never seen the JSP files put into the classes folder like that and don't think that it's all that smashing of an idea.

Hiding the JSPs under WEB-INF is all well and good; but in classes?

I generally put mine in a folder hiearchy under /WEB-INF/pages/ or some such.

Perhaps you should find a different tutorial.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Perhaps you should find a different tutorial.

now it works
thanks a lot to you both that helped me!
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
ahh, just for the record, here's the tutorial's link
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61448
    
  67

Glad it's working. Just be aware that putting the JPSs in classes is not a common practice, and not one that I suggest you mimic in your own applications.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
Originally posted by Bear Bibeault:
Glad it's working. Just be aware that putting the JPSs in classes is not a common practice, and not one that I suggest you mimic in your own applications.


thank you again, Bear
if you have a quick look at my ant build, you'll confirm that i've a jsp folder for jsp files and a servlet folder, in a diferent location, for servlets: i've jsp files at ${CATALINA_HOME}/webapps/ROOT/jsp and servlets at ${CATALINA_HOME}\webapps\ROOT\WEB-INF\classes
i guess this is a correct way of tidying up things.
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
one more for the record:
in order to keep with my ant build, i reference the jsp at its proper location:
"/jsp/sql/sql_gateway.jsp"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trouble with path