This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 2 action result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 action result" Watch "Struts 2 action result" New topic
Author

Struts 2 action result

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 234
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


Thanks in Advance,
Kousik
Yogesh Lonkar
Ranch Hand

Joined: Jul 17, 2012
Posts: 94

May be you should have a look in struts docs Here


Learning some thing New Every Day
khadar valli
Greenhorn

Joined: Nov 19, 2014
Posts: 7

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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 action result
 
It's not a secret anymore!