wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts.xml mapping and add action 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 "Struts.xml mapping and add action" Watch "Struts.xml mapping and add action" New topic
Author

Struts.xml mapping and add action

sankar singh
Ranch Hand

Joined: Aug 17, 2007
Posts: 40
I have started to learn Struts2.0,

First Simple Program itself confusion..My Qeustion is in Struts.xml maping file we are not adding .action but request input jsp

why we should add .action apart from ActionName

Example : action="HelloWorld.action"

input.jsp

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>HelloWorld Struts </title>
</head>
<body>
hello world
<form name="Form1" action="HelloWorld.action">
<input type="submit" value="JustClick" name="JustClick" />
</form>
</body>
</html>

Struts.xml : Here action name is "HelloWorld",
----------

<struts>
<package name="default" extends="struts-default">
<action name="HelloWorld" class="comm.HelloWorld">
<result name="success">HelloWorld.jsp</result>
</action>
</package>
</struts>

Is it must to keep .action in all the request page (action="actionName.action)
------
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
the .action suffix is a way of communicating with the Struts 2 interceptor that you want it to look for an action defined in the struts.xml file and execute a method on it. Without the suffix, the interceptor doesn't know if you're just trying to load an image file or HTML page, or display the contents of a directory.


Merrill
Consultant, Sima Solutions
sankar singh
Ranch Hand

Joined: Aug 17, 2007
Posts: 40
thanks for your answer, is there any possibility to use myown name instead of .action,

For this should i need to change any configuration file?

Regards,
Sankar. S
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts.xml mapping and add action
 
Similar Threads
/struts2tutorial/struts2tutorial/roseindia/showLogin.action) is not available.
Problem in action mapping
execAndWait problem
Request not able to reach Action class in Struts2
requested resource (/tutorial/HellwWorld.action) is not available error