Create a setter with the same name as your param.

ex :

for :
<action name="blah" class="MyAction"
  <param name="myValue">This value</param>
</action>

in MyAction :

public class MyAction implements Action {

  private String myValue;

  public void setMyValue( String value) { this.myValue = value; }

}


Type conversion's done on this param value just like any other parameter.

hth,
-a




Harring Figueiredo wrote:
> 
>  Folks,
> 
>  Is there a way to pass parameter to an Action using the struts.xml config
> file.
> 
> 1 ) I see that the <action ..> has a param attribute. How can I access its
> value from within the action?
> 
> My action already implements the ParameterAwre interface. However, I am
> unable to see the value on the Map provided by the setParameter() IoC
> call.
> 
> 2) Is this the same functionality as the the Struts ActionMapping?
> 
> Thanks in advance
> 
> Harring Figueiredo
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-s2--How-to-pass-param-to-actions-from-Struts.xml-tf3403074.html#a9478391
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to