You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xianwinwin <xi...@gmail.com> on 2008/11/20 21:05:18 UTC

2 buttons for the same form, error when trying to invoke different action

Hi all,

I have a simple form with 2 buttons (diff action), how can I make sure both
will exec?

<s:form action="steps_" ...
.
.
<s:submit action="addStep" 	value="add more"...
<s:submit action="complete"	value="complete"...


when I write the form with one button it works
example:

<s:form action="steps_addStep"
.
.
<s:submit action="steps_addStep"		value="add more"...


THANK YOU!
-- 
View this message in context: http://www.nabble.com/2-buttons-for-the-same-form%2C-error-when-trying-to-invoke-different-action-tp20608955p20608955.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by xianwinwin <xi...@gmail.com>.
	@SuppressWarnings("unchecked")
	public String addStep()
	{
		System.out.println("do abc");			
		
		return "ajax-add-step";
	}
	
	@SkipValidation
	public String completeIncentive()
	{
		System.out.println("do 123..");
		
		return "ajax-complete-step";
	}
-- 
View this message in context: http://www.nabble.com/2-buttons-for-the-same-form%2C-error-when-trying-to-invoke-different-action-tp20608955p20611571.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/11/20 xianwinwin <xi...@gmail.com>:
> I have it:
>
>
>        <action name="steps_*"  method="{1}"
> class="com.struts.incentive.target.StepsIncentiveAction">
>                        <result name="input">/pages/incentive/steps/ajaxInput.jsp</result>
>                        <result
> name="ajax-add-step">/pages/incentive/steps/ajaxAddStep.jsp</result>
>                        <result
> name="ajax-complete-step">/pages/incentive/steps/ajaxConfirmation.jsp</result>
>
>            <interceptor-ref name="user"/>
>        </action>

Where? I don't see default result type (whitout name defined)... Could
you post also your action code?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by xianwinwin <xi...@gmail.com>.
I have it:


       	<action name="steps_*"  method="{1}"
class="com.struts.incentive.target.StepsIncentiveAction">			
			<result name="input">/pages/incentive/steps/ajaxInput.jsp</result>
			<result
name="ajax-add-step">/pages/incentive/steps/ajaxAddStep.jsp</result>
			<result
name="ajax-complete-step">/pages/incentive/steps/ajaxConfirmation.jsp</result>
						       									
            <interceptor-ref name="user"/>
        </action>



-- 
View this message in context: http://www.nabble.com/2-buttons-for-the-same-form%2C-error-when-trying-to-invoke-different-action-tp20608955p20611459.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/11/20 xianwinwin <xi...@gmail.com>:
>
>  Struts Problem Report
> Struts has detected an unhandled exception:
>
> Messages: No result defined for action
> com.struts.incentive.target.StepsIncentiveAction and result success

Here you have answer, you are missing success result in config for
that action, add such result or return ajax-add-step from action


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by xianwinwin <xi...@gmail.com>.
 Struts Problem Report
Struts has detected an unhandled exception: 

Messages: No result defined for action
com.struts.incentive.target.StepsIncentiveAction and result success
 
File:
file:/C:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp4/wtpwebapps/MGroups/WEB-INF/classes/incentive-support.xml 
Line number: 37 
Column number: 103 


--------------------------------------------------------------------------------

        </action>         	<action name="steps_*"  method="{1}"
class="com.struts.incentive.target.StepsIncentiveAction">						<result
name="input">/pages/incentive/steps/ajaxInput.jsp</result>			<result
name="ajax-add-step">/pages/incentive/steps/ajaxAddStep.jsp</result>
--------------------------------------------------------------------------------

Stacktraces

-- 
View this message in context: http://www.nabble.com/2-buttons-for-the-same-form%2C-error-when-trying-to-invoke-different-action-tp20608955p20610822.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/11/20 xianwinwin <xi...@gmail.com>:
> yes, I get: undefined

It's a JavaScript error, could you post the whole page?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by xianwinwin <xi...@gmail.com>.
yes, I get: undefined   

* I use ajax for the return type
* the action is not executed (meaning, when the user clicks a button the
failure occurs before the action)




Lukasz Lenart wrote:
> 
> 2008/11/20 xianwinwin <xi...@gmail.com>:
>> I have a simple form with 2 buttons (diff action), how can I make sure
>> both
>> will exec?
> 
> Do you get any error or something?
> 
> 
> Regards
> -- 
> Lukasz
> http://www.lenart.org.pl/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/2-buttons-for-the-same-form%2C-error-when-trying-to-invoke-different-action-tp20608955p20609149.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: 2 buttons for the same form, error when trying to invoke different action

Posted by Lukasz Lenart <lu...@googlemail.com>.
2008/11/20 xianwinwin <xi...@gmail.com>:
> I have a simple form with 2 buttons (diff action), how can I make sure both
> will exec?

Do you get any error or something?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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