• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need configuration

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hola, I need some help here please.
I am developing a web application, which have the following structure (under the current dir) :
index.jsp
show.jsp
price/total.jsp
WEB-INF/com/AddServlet.class
and the web.xml is:
<web-app>
<servlet>
<servlet-name>AddServlet</servlet-name>
<servlet-class>com.AddServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>total</servlet-name>
<jsp-file>/price/total.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>AddServlet</servlet-name>
<url-pattern>/shopping/add</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>total</servlet-name>
<url-pattern>/price/total.jsp</url-pattern>
</servlet-mapping>
</web-app>
In show.jsp I wrote:
<a href='shopping/add?name=<%= rs.getString("name") %>'>Add To Shopping Cart</a>
<a href="price/total.jsp">Show Shopping Cart</a>
but when testing the application, the urls became:
http://localhost:8080/mystore/shopping/shopping/add?name=dfhshfhfff
and
http://localhost:8080/mystore/shopping/price/total.jsp
Why /shopping is added to every url?
Please some help.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34396
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
The URLs are relative. The first time, you are in the shopping directory. Then when you click a link, it looks within the current directory for a shopping directory. This gives you to shopping directories. The same concept is true for your other link.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic