what is *.do in struts-config.xml

15,472

Solution 1

*.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

Solution 2

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.

Solution 3

Every url which ends with *.do it calls your servlet.

Share:
15,472
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    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