| Author |
difference between action="/actionpath" and action="action" in struts
|
kranthi devarapalem
Greenhorn
Joined: Sep 10, 2012
Posts: 9
|
|
Hi all
i have a general doubt in struts and here it goes
is there any difference between below two in behavior
1.<struts:form action ="/loginaction">
2.<struts:form action="loginaction">
is there any difference between below two in behavior
1.<forward name = "confirm" path="/confirm.do"/>
2.<forward name = "confirm" path="/confirm"/>
does "/" makes any difference in the flow?
Thanks
kranthi.
|
 |
Saif Asif
Ranch Hand
Joined: Aug 11, 2011
Posts: 294
|
|
Hello kranthi devarapalem,
Yes the "/" will make a big difference. whenever you reference anything with "/" , the requested resource will be searched for at the root of the server. However, if you do not specify "/" , then the resources will be searched in the current directory from which it is being referenced from.
The same following logic applies to both the struts action tag and the forward tag of the jsp as well.
This JSP will be searched for at the root of the server ( NOT the root of the project ). The URL will be localhost:8080/abc.jsp
However, just omit the "/" and the whole URL changes to localhost:8080/<project_context_name>/<some_dir>/abc.jsp
So yes , the "/" will make quite a huge of a difference.
|
Regards, Muhammad Saif Asif Mirza
SCJA(5/6) SCJP(6)
|
 |
 |
|
|
subject: difference between action="/actionpath" and action="action" in struts
|
|
|