You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by wild_oscar <mi...@almeida.at> on 2008/04/29 20:02:15 UTC

No result defined for action and result input with checkbox

I have a problem that can be stripped down to the following: a jsp with a
form:

	<s:form action="batch">
		<s:checkbox name="formReturned" theme="simple" fieldValue="0"
value="false"></s:checkbox>
		 <s:checkbox name="formReturned" theme="simple" fieldValue="1"
value="false"></s:checkbox>
		 <s:submit></s:submit>	
	</s:form>


The action has a 

private int[] formReturned;

with getters and setters.

If any of the two checkboxes are checked, formReturned will be a vector with
the fieldValue(s) of the checked box(es).

However, if neither checkboxes are checked, it will be null and Struts will
send me to the Input (which is not configured).

I even tried to set:
	public void prepare() throws Exception {
		if(formReturned==null)
		{
			log.warn("Miguel - warning, null value!");
			formReturned = new int[2];
			
		}		
	}
To see if it was a problem of null formReturned value, but it is not. Struts
will set formReturned = new int[2], but it'll go to the error (before
running the action) anyway.

The full stacktrace is  http://pastebin.com/m43225ede
http://pastebin.com/m43225ede .

How can I prevent struts from trying to return to the input? What sort of
validation is it failing (I don't have any validation on any field)?

Thank you very much for any help!
-- 
View this message in context: http://www.nabble.com/No-result-defined-for-action-and-result-input-with-checkbox-tp16966533p16966533.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: No result defined for action and result input with checkbox

Posted by Greg Lindholm <gl...@yahoo.com>.
I had the same (or similar) problem, it's caused be the CheckboxInterceptor
not properly handling arrays of checkboxes when none are selected.
I submitted a patch for this issue 
https://issues.apache.org/struts/browse/WW-2339 WW-2339  but I don't think
anyone has looked at it yet.


wild_oscar wrote:
> 
> I have a problem that can be stripped down to the following: a jsp with a
> form:
> 
> 	<s:form action="batch">
> 		<s:checkbox name="formReturned" theme="simple" fieldValue="0"
> value="false"></s:checkbox>
> 		 <s:checkbox name="formReturned" theme="simple" fieldValue="1"
> value="false"></s:checkbox>
> 		 <s:submit></s:submit>	
> 	</s:form>
> 
> 
> The action has a 
> 
> private int[] formReturned;
> 
> with getters and setters.
> 
> If any of the two checkboxes are checked, formReturned will be a vector
> with the fieldValue(s) of the checked box(es).
> 
> However, if neither checkboxes are checked, it will be null and Struts
> will send me to the Input (which is not configured).
> 
> I even tried to set:
> 	public void prepare() throws Exception {
> 		if(formReturned==null)
> 		{
> 			log.warn("Miguel - warning, null value!");
> 			formReturned = new int[2];
> 			
> 		}		
> 	}
> To see if it was a problem of null formReturned value, but it is not.
> Struts will set formReturned = new int[2], but it'll go to the error
> (before running the action) anyway.
> 
> The full stacktrace is  http://pastebin.com/m43225ede
> http://pastebin.com/m43225ede .
> 
> How can I prevent struts from trying to return to the input? What sort of
> validation is it failing (I don't have any validation on any field)?
> 
> Thank you very much for any help!
> 

-- 
View this message in context: http://www.nabble.com/No-result-defined-for-action-and-result-input-with-checkbox-tp16966533p16982793.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