• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

difference between action="/actionpath" and action="action" in struts

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic