• 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 2 action result

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am newbie in struts 2. I do not understand how in the below struts.xml code the dynamic value will be populated even though in the action class there is no class variable declared?
So my question is how {1} is populated?



Thanks in advance,
Kousik
 
Ranch Hand
Posts: 94
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be you should have a look in struts docs Here
 
Greenhorn
Posts: 26
MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you have more than two action methods with almost same name , at that time , we will use wildcards......
without wildcards
<struts-config>

<action-mappings>

<action
path="/ListUserAction"
type="com.mkyong.common.action.UserAction"
parameter="ListUser"
>

<forward name="success" path="/pages/ListUser.jsp"/>

</action>

<action
path="/AddUserAction"
type="com.mkyong.common.action.UserAction"
parameter="AddUser"
>

<forward name="success" path="/pages/AddUser.jsp"/>

</action>

<action
path="/EditUserAction"
type="com.mkyong.common.action.UserAction"
parameter="EditUser"
>

<forward name="success" path="/pages/EditUser.jsp"/>

</action>

<action
path="/DeleteUserAction"
type="com.mkyong.common.action.UserAction"
parameter="DeleteUser"
>

<forward name="success" path="/pages/DeleteUser.jsp"/>

</action>


</action-mappings>

</struts-config>

with wildcards
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">

<struts-config>

<action-mappings>

<action
path="/*UserAction"
type="com.mkyong.common.action.UserAction"
parameter="{1}User"
>

<forward name="success" path="/pages/{1}User.jsp"/>

</action>

</action-mappings>

</struts-config>
reply
    Bookmark Topic Watch Topic
  • New Topic