You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by walidito <wa...@sgcib.com> on 2006/12/07 20:29:54 UTC

Struts2 and Ajax pb

Hi,
I hava followed one of the "showcase" example (
http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp
) tu run a first an independently-refreshed zone of my webpage.
As the example doen't provide with the corresponding Action Class, i didn't
succeed in making interact any action with my new ajax element (div tag).
For information, I had put this  <s:head theme="ajax" debug="true"/> in the
header of my jsp.
and this code in my <body>
<s:div
	             id="twoseconds"
             	cssStyle="border: 1px solid yellow;"
             	href="/dashboard/actions/AjaxTest.action"
          	    theme="ajax"
             	updateFreq="2000"
             	errorText="There was an error"
             	loadingText="loading..."><s:property value="message"/>
</s:div>

And the sample action is :
public class AjaxTestAction  {
	
	String message;
	
	public String execute() throws Exception
	{
		 setMessage("hello !!!");
		return SUCCESS;	
	}
	
	public void setMessage(String message){
	        this.message = message;
	    }

}


So, as a result, I see well the refreshment, but always  the "there was an
error message".

Can anyone help please ?
-- 
View this message in context: http://www.nabble.com/Struts2-and-Ajax-pb-tf2776562.html#a7745973
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: Struts2 and Ajax pb

Posted by Musachy Barroso <mb...@wfscorp.com>.
First try putting the full url for your action on your browser , and 
make sure you are getting the expected page, just to get any ajax 
problem out of the way. After you get that working, try the div, which 
should work.

regards
musachy
walidito wrote:
> Hi,
> I hava followed one of the "showcase" example (
> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp
> ) tu run a first an independently-refreshed zone of my webpage.
> As the example doen't provide with the corresponding Action Class, i didn't
> succeed in making interact any action with my new ajax element (div tag).
> For information, I had put this  <s:head theme="ajax" debug="true"/> in the
> header of my jsp.
> and this code in my <body>
> <s:div
> 	             id="twoseconds"
>              	cssStyle="border: 1px solid yellow;"
>              	href="/dashboard/actions/AjaxTest.action"
>           	    theme="ajax"
>              	updateFreq="2000"
>              	errorText="There was an error"
>              	loadingText="loading..."><s:property value="message"/>
> </s:div>
>
> And the sample action is :
> public class AjaxTestAction  {
> 	
> 	String message;
> 	
> 	public String execute() throws Exception
> 	{
> 		 setMessage("hello !!!");
> 		return SUCCESS;	
> 	}
> 	
> 	public void setMessage(String message){
> 	        this.message = message;
> 	    }
>
> }
>
>
> So, as a result, I see well the refreshment, but always  the "there was an
> error message".
>
> Can anyone help please ?
>   


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


RE: Struts2 and Ajax pb

Posted by walidito <wa...@sgcib.com>.
Ok ok, I begin to see what is the exact pb :
I my action mapping I've putted :
            <result name="input">/JSPs/Error.jsp</result>
            <result name="success">/JSPs/Menu.jsp</result>
so it must create an ugly loop...
By the way, what should I put it this action mapping ? nothing ? 
thank you.


walidito wrote:
> 
> Thank you !
> Actually I had a mapping, but this mapping was wrong.
> now I' m facing a new pb,
> my "div" zone is continuously showing an error message (the error messages
> adds  at the end of the page, and doesn't replace the previous one, which
> make it a real mess...)
> this is the message :
> widget ID collision on ID: twoseconds
> 
> 
> 
> Dave Newton-3 wrote:
>> 
>> walidito [mailto:walid.hajeri@sgcib.com]
>>>              	href="/dashboard/actions/AjaxTest.action"
>> 
>> Do you have a mapping to that action?
>> 
>> Dave
>> 
>> 
>> ---------------------------------------------------------------------
>> 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/Struts2-and-Ajax-pb-tf2776562.html#a7746431
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: Struts2 and Ajax pb

Posted by walidito <wa...@sgcib.com>.
Thank you !
Actually I had a mapping, but this mapping was wrong.
now I' m facing a new pb,
my "div" zone is continuously showing an error message (the error messages
adds  at the end of the page, and doesn't replace the previous one, which
make it a real mess...)
this is the message :
widget ID collision on ID: twoseconds



Dave Newton-3 wrote:
> 
> walidito [mailto:walid.hajeri@sgcib.com]
>>              	href="/dashboard/actions/AjaxTest.action"
> 
> Do you have a mapping to that action?
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> 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/Struts2-and-Ajax-pb-tf2776562.html#a7746317
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