You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Deepa Khetan <de...@gmail.com> on 2005/11/08 11:00:10 UTC

error in adding parameter in mapping

Hi,
 I am trying to add a parameter at runtime in ActionMapping of my Action
Class. I am using mapping.setParameter() for this. It gives an
IllegalStateException saying Configuration file is frozen. Is there a way in
which i can add a parameter at runtime??
 Regards,
Deepa

Re: error in adding parameter in mapping

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Alternatively, if you want to avoid constructing the query string
manually, you can use the ActionRedirect class (as of 1.2.7 I believe). 
This has an addParameter() method specifically for this.  Typically, you
would pass an existing ActionForward instance to ActionRedirects'
constuctor to copy its configuration...

ActionForward af = new ActionRedirect(mapping.findForward("theForward"));
af.addParameter("myParam", "val");
return af;

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

On Tue, November 8, 2005 10:02 am, Borislav Sabev said:
> Deepa Khetan wrote:
>
>>Hi,
>> I am trying to add a parameter at runtime in ActionMapping of my Action
>>Class. I am using mapping.setParameter() for this. It gives an
>>IllegalStateException saying Configuration file is frozen. Is there a way
>> in
>>which i can add a parameter at runtime??
>> Regards,
>>Deepa
>>
>>
>>
> Hi Deepa,
> you have to construct a new ActionForward object and then return it.
> here is an example:
>             ActionForward fwd =
> mapping.findForward(Constants.ACTIONFORWARD_SUCCESS);
>             String path = fwd.getPath();
>             path += "&myparam=";
>             path += someparamvalue;
>              return  new ActionForward(path);
>
> regards
> borislav
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: error in adding parameter in mapping

Posted by Borislav Sabev <b....@eventsoft.de>.
Deepa Khetan wrote:

>Hi,
> I am trying to add a parameter at runtime in ActionMapping of my Action
>Class. I am using mapping.setParameter() for this. It gives an
>IllegalStateException saying Configuration file is frozen. Is there a way in
>which i can add a parameter at runtime??
> Regards,
>Deepa
>
>  
>
Hi Deepa,
you have to construct a new ActionForward object and then return it.
here is an example:
            ActionForward fwd = 
mapping.findForward(Constants.ACTIONFORWARD_SUCCESS);
            String path = fwd.getPath();
            path += "&myparam=";
            path += someparamvalue;
             return  new ActionForward(path);

regards
borislav




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org