Help coderanch get a
new server
by contributing to the fundraiser
  • 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

Action tag paramaeter

 
Ranch Hand
Posts: 53
MyEclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<action name="create" class="createAction"
method="show">
<param name="showType">begin</param>
<interceptor-ref name="displayStack">
</interceptor-ref>
<result type="tiles">box.location.start
</result>
<result name="verificationRequired" type="redirect">/</result>
</action>
Hi, I am new to struts2 and unable to understand the above syntax. As per my idea i think createAction is the Action class where show is the method which returns the logic. I am unable to understand param name tag. One more thing is the result type is tiles what does it mean ? what is box.location.start and when result name="verificationRequired" "/" is the result and what does it mean ?
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maganti,

Show is the name of the method in action-class where you logic is written.Instead of execute which is default method you can use the other method name.
<param> is the parameter which you are passing for the action .Like we have servlet init parameters.

Interceptors are there to achieve common functionality in struts.
Result type tiles means you are using result type as tiles and for that you need to add separate configuration of tiles .
there are different Result types in struts

Regards
Jatan
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

i think createAction is the Action class where show is the method which returns the logic


Correct. In this case, it's likely the action is being defined as a Spring bean in a Spring configuration file.

That's a guess; I'm guessing that because the class name, createAction, does not follow any Java naming conventions (classes belong in a package, and class names should start with an uppercase letter). It is, however, a typical Spring bean name.

[...] the result type is tiles what does it mean?


It means the tiles plugin is being used. (Most likely. It could mean the developer has implemented their own "tiles" result type, but that would be a little unusual.

box.location.start is the name of the tile definition that will be rendered.

when result name="verificationRequired" "/" is the result and what does it mean?


This means when the action method returns the string verificationRequired the result rendered will be a redirect to the root of the application.

 
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic