Reputation:
I am learing struts and I found a mapping in Struts-config.xml as follow
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
in servlet mapping tag.
what is *.do
Can we achive the same in web.xml of servlets ?
Thanks in Advance ,
Raj
Upvotes: 3
Views: 16977
Reputation: 5128
As far as I know .do url invokes your servlet. I have seen this extension being used with Struts.
So if you have www.hey.com/hello.do Then you struts configuration will have something as follows
<struts-config>
<action-mappings>
<action path="/hello" type="com.MyAction">
</action-mappings>
</struts-config>
So in this example the url"www.hey.com/hello.do" will be forwarded to MyAction.java
In your particular example, you found that occurrence of *.do in your web.xml file. What that means is all request that ends with *.do will be forwarded to "action" servlet.
Upvotes: 4
Reputation: 2633
*.do
- It just means that any URL that ends with a ".do"
Yes we can achive the same in web.xml of servlets
ie: any url requests that ends with .do
will be redirected to the specified Servlet , In our case to the servlet named action
This Link give you a good idea about web.xml and struts-config.xml and difference between them
Upvotes: 4