Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes Slash in action 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 » Frameworks » Struts
Bookmark "Slash in action" Watch "Slash in action" New topic
Author

Slash in action

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
What is the difference between:

<html:form action="/Lookup"...> and
<html:form action="Lookup"...>

It seems that both work with my action mapping definition:

<action path="/Lookup" ...>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
"/Lookup" is preferred because it will work in all cases. "Lookup" will not work if your current context is other than the root. For example, if your current JSP was displayed by the action "/foo/bar/MyAction", and you specify "Lookup", Struts will be looking for the action "foo/bar/Loookup".


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Slash in action