• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts.xml mapping and add action

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
------
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
sankar singh
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic