File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes URL Pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "URL Pattern" Watch "URL Pattern" New topic

URL Pattern

ramji srinivasan

Joined: Aug 22, 2005
Posts: 11

i want to know whether we can change the URL patttern in web.xml from *.do to *.jsp.i want my firt page of my site to be in *.jsp instead of *.do.

Thanks & regards
Ramji Srinivasan
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The "*.do" in the web.xml file causes any request that ends in .do to be routed to the Struts ActionServlet where it can be routed to the appropriate Struts Action class. This does not prevent a user from calling a JSP page directly. So, without making any changes to the web.xml, you can call myServer/myApp/myFirstPage.jsp and it will work just fine as long as myFistPage.jsp doesn't require any pre-processing to be displayed correctly.

Changing the "*.do" to "*.jsp" would be a really bad idea and would not have the desired effect at all.

Consultant, Sima Solutions
pax smith
Ranch Hand

Joined: Dec 13, 2005
Posts: 45

*.do is a convension. You can use anything. But use of *.jsp is not good because after that you JSP is something used for only jsp files only whereas *.do is used to redirect to Struts action. Moreover if you want to call JSP then you can call them directly i.e abc/xyz.jsp there is no problem in that.
I agree. Here's the link:
subject: URL Pattern
It's not a secret anymore!