• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trouble with path

 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where does the sql folder reside relative to the context root?
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this case, the context root is:
C:\Programas\Apache Software Foundation\Tomcat 5.5\webapps\ROOT
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the sql folder in relation to that?
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ Ben
is here:
WEB-INF\classes\murach\sql
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
\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
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps you should find a different tutorial.

now it works
thanks a lot to you both that helped me!
 
miguel lisboa
Ranch Hand
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahh, just for the record, here's the tutorial's link
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic