You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tarek Nabil <Ta...@dubaiworld.ae> on 2006/11/23 20:00:44 UTC

Parameters not being set on Action in Struts 2

Hi,

I'm experimenting with Struts 2, and I'm facing a problem with request
parameters being populated on the Action. I checked out the source to
make sure that the behavior I expect is the correct one, and judging by
the source, it is, but it's not happening.


I have an action that has a method

public void setType(Integer type) {
	// some code
}

I declared the action in Struts.xml as follows

        <action
	    name="dod1"
	    method="setup"
	    class="somePackageName.someClassName">
	    <result name="page">/jsp/someFolder/someJSP.jsp</result>
            <result name="input" type="chain">dod1!setup</result>
        </action>

In the setup method, I put the following line

	    logger.debug(getContext().getParameters());

In the URL, I call the following

http://server/application/namespace/dod1!setup.action?type=1

The result is that the parameters map is logged as {} and in my method
when I attempt to access the type field, I find it to be null!

Could someone please point me to what could be wrong?

Thanks,
Tarek Nabil




 
 
********************************************DISCLAIMER********************************************
This email and any files transmitted with it are confidential and contain privileged or copyright 
information. If you are not the intended recipient you must not copy, distribute or use this email
or the information contained in it for any purpose other than to notify us of the receipt thereof.
If you have received this message in error, please notify the sender immediately, and delete this
email from your system.

Please note that e-mails are susceptible to change.The sender shall not be liable for the improper
or incomplete transmission of the information contained in this communication,nor for any delay in
its receipt or damage to your system.The sender does not guarantee that this material is free from
viruses or any other defects although due care has been taken to minimise the risk.
**************************************************************************************************

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


Re: Parameters not being set on Action in Struts 2

Posted by Ted Husted <hu...@apache.org>.
First, simplify the problem. Right now, the code seems to be calling
an alternative method, setup. What happens if you try the same thing
with the default execute method?

If your application is based on the blank application, it may turned
the "!" syntax off, since it can conflict with using wildcards. To use
the Check the struts.properties file for the line
"struts.enable.DynamicMethodInvocation", and set it to true.

We're working on some new code for Struts 2 that will extend the "!"
syntax so that it can happily coexist with wildcards.

-Ted.

On 11/23/06, Tarek Nabil <Ta...@dubaiworld.ae> wrote:
> Hi,
>
> I'm experimenting with Struts 2, and I'm facing a problem with request
> parameters being populated on the Action. I checked out the source to
> make sure that the behavior I expect is the correct one, and judging by
> the source, it is, but it's not happening.
>
>
> I have an action that has a method
>
> public void setType(Integer type) {
>         // some code
> }
>
> I declared the action in Struts.xml as follows
>
>         <action
>             name="dod1"
>             method="setup"
>             class="somePackageName.someClassName">
>             <result name="page">/jsp/someFolder/someJSP.jsp</result>
>             <result name="input" type="chain">dod1!setup</result>
>         </action>
>
> In the setup method, I put the following line
>
>             logger.debug(getContext().getParameters());
>
> In the URL, I call the following
>
> http://server/application/namespace/dod1!setup.action?type=1
>
> The result is that the parameters map is logged as {} and in my method
> when I attempt to access the type field, I find it to be null!
>
> Could someone please point me to what could be wrong?
>
> Thanks,
> Tarek Nabil

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