This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes to .do or not to .do? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "to .do or not to .do?" Watch "to .do or not to .do?" New topic
Author

to .do or not to .do?

Tony Smith
Ranch Hand

Joined: Jul 07, 2007
Posts: 229
I get confused sometimes where to put the .do extension.
Assuming struts is setup to handle all the *.do extension:

<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

Is it safe to assume all the abcs.do in jsp pages will be treated like /abcs ? Can't we just not put .do extention at all? Because sometimes I see places with .do, sometimes I don't.

I know some places if you put .do it may actually crash the program. Such as in Struts-config.xml in the action mapping area...
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The rule of thumb that I follow is:

If it's in a Struts tag, don't use .do. If it's not a Struts tag, you must use .do. Examples:



While Struts tags will generally accept .do, it's generally less confusing if you leave it out.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: to .do or not to .do?
 
Similar Threads
Problem occuring in calling servlet
Struts jsps in WEB-INF
STRUTS + WEBLOGIC 8.1
Filter Mappings - URL Pattern
Mapping for a normal servlet? Mandatory in struts?