• Post Reply Bookmark Topic Watch Topic
  • New Topic

URL problem

 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, if i want to call a file which located into my web root folder, how to i call it from coding?

let say my web root folder on c:\myweb , and i want to call/invoke a file(callme.jsp) which reside in c:\myweb\callme.jsp , should it be "../callme.jsp" ? but tomcat generate error like "not start symbol "/""

thank you !
[ October 29, 2004: Message edited by: Alvin chew ]
 
Gert Cuppens
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll give 2 examples to call a JSP or servlet from within a JSP.

The first example
<TD><A HREF="index.jsp" class="navigatie">Terug naar startscherm</A></TD>

So, if you're calling a JSP from another JSP which is in the same folder, nog need to add a /.

Second example :
<A href="/eddi/servlets/getConduitsServlet?contractNumber=<%=contract.getContractNumber()%>"
target="_parent">

This one calls a servlet from within a JSP. The JSP is located in C:\Program Files\Apache Group\Tomcat 4.1\webapps\eddi.
The servlet is located in C:\Program Files\Apache Group\Tomcat 4.1\webapps\eddi\WEB-INF\classes\org\brukkerlin\servlets.

By writing /eddi, Tomcat knows it has to take a look at the eddi-folder inside the webapps folder. With /servlets and in combination with the web.xml file which mentions the following lines ...
<servlet-mapping>
<servlet-name>org.brukkerlin.servlets.getConduitsServlet</servlet-name>
<url-pattern>/servlets/getConduitsServlet</url-pattern>
</servlet-mapping>

Tomcat knows where to take the necessary class.
 
Alvin chew
Ranch Hand
Posts: 834
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, Gert , i understand now ..thank you !
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!