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 21:29:35 UTC

Still Ajax and Struts 2

I,
I wanna run this type of example app :
http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
:
<s:div
13:         id="once"
14:         theme="ajax"
15:         cssStyle="border: 1px solid yellow;"
16:         href="/AjaxTest.action"
17:         delay="5000"
18:         loadingText="loading...">
19:     Initial Content
</s:div>

In other word, a basic ajax component that allows a refreshment of only a
part of my page.

But I didn't get how to write the corresonding action and action mapping. 
For the moment I've tried to put a "success" return in my action ( is it
enough ?), but I don't see what to put in my action mapping (i mean inside
the <action name="blablabla" ...> tag. If I put nothing, of course it's
wrong.
If I only put a success-type result, It creates an infinite loop (always
displays "loading").
Can sobdy help please?
-- 
View this message in context: http://www.nabble.com/Still-Ajax-and-Struts-2-tf2776835.html#a7746954
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: Still Ajax and Struts 2

Posted by walidito <wa...@sgcib.com>.
Ok thank you very much that works !
My mistake was in the mapping, where I redirected to the same jsp as the one
where I've putted the div tag. 
Actually, I had to write a simple jsp in ordrer that it works.
Otherwise, 
I'm always having the error message on my console :
SEVERE: Error setting expr 'dojo.transport' with value
'[Ljava.lang.String;@9de832'
ognl.OgnlException: target is null for setProperty(null, "transport",
[Ljava.lang.String;@9de832)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)

wich is repeated till the infinite when I choose to refresh my "div ajax"
component. Can this be dangerous in term of performance, etc ?
thanks.

Walid


Musachy Barroso-2 wrote:
> 
> What is happening is that there is an error on the request, probably the 
> action mapping is wrong, and it is returning a page with the error, but 
> that page has the same menu as showcase, that's why your are seeing it 
> twice. Put the full url for the action on the address bar, after you get 
> that to show the right page (what you expect to see in the div tag), 
> then try the div.
> 
> musachy
> 
> walidito wrote:
>> I don't hink I'm adding anything.
>> Here is my code :
>> the action :
>> 	public String execute() throws Exception
>> 	{
>> 		return SUCCESS;
>> 	}
>>
>> the struts.xml:
>>
>>         <action name="AjaxTestAction"
>> class="dashboard.actions.AjaxTestAction">
>>         	<result>/JSPs/Menu.jsp</result>
>>         </action>
>> and the jsp :
>> <head>
>>     ...   
>>  	 <s:head theme="ajax" debug="false"/>
>>  	...
>> </head>
>> <body>
>>                <s:div
>> 	id="once"
>>              	cssStyle="border: 2px solid red;"
>>              	href="%{ajaxTest}"
>>           	 theme="ajax">
>>              	                   hhookayy
>>      			</s:div>
>> </body>
>>
>>
>> I know it's working on the shwocase, but my app is not working... Since
>> the
>> showcase action and struts sources are not available...
>> What I see on my screen is the "top" of jsp that is written twice, in
>> fact,
>> the top html is loaded once (normal), but after the action call, the top
>> is
>> written another time, I don't know why... Moreover, the eclipse console
>> displays the same error (dojo.transport) again and again...
>>
>> Regards,
>> Walid
>>
>>
>>
>>
>> Musachy Barroso-2 wrote:
>>   
>>> Are you sure you are not adding anything else to it and you are looking 
>>> at the right one? I just check it out on showcase and it only loads 
>>> once. Can you see if you have the same problem on showcase?
>>>
>>> regards
>>> musachy
>>>
>>> walidito wrote:
>>>     
>>>> Sorry but it didn't...
>>>> It loads it many times....
>>>>
>>>>
>>>> Musachy Barroso-2 wrote:
>>>>   
>>>>       
>>>>> That needs to be fixed in struts, this is the jira ticket: 
>>>>> https://issues.apache.org/struts/browse/WW-1551
>>>>>
>>>>> from showcase:
>>>>>
>>>>> <s:div
>>>>>         id="once"
>>>>>         theme="ajax"
>>>>>         cssStyle="border: 1px solid yellow;"
>>>>>         href="%{ajaxTest}">
>>>>>     Initial Content</s:div>
>>>>>
>>>>> That should load the div only once.
>>>>>
>>>>> musachy
>>>>>
>>>>> walidito wrote:
>>>>>     
>>>>>         
>>>>>> Hi,
>>>>>> Actually, I get this error both in my eclipse "console" and in my web
>>>>>> page
>>>>>> (debug enabled).
>>>>>> First of all here is the "jsp" code that I use:
>>>>>>     <s:div
>>>>>> 	            id="reportDivId"
>>>>>>              	cssStyle="border: 2px solid red;"
>>>>>>              	href="/AjaxTestAction.do"
>>>>>>           	    theme="ajax"
>>>>>>           	    delay="3000"
>>>>>>              	errorText="There was an error"
>>>>>>              	loadingText="loading...">
>>>>>>              	<s:property value="count"/> @ <s:property
>>>>>> value="serverTime"/>
>>>>>> <br/>
>>>>>>      </s:div>
>>>>>>
>>>>>>  this is the redundant error that I get on my eclipse console :
>>>>>>
>>>>>> -SEVERE: Error setting expr 'dojo.transport' with value
>>>>>> '[Ljava.lang.String;@e8f27e'
>>>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>>>> [Ljava.lang.String;@e8f27e)
>>>>>> 	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
>>>>>> 	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>>>>>> 	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>>>>>>                 ...
>>>>>>
>>>>>> and after a first call of the action I get this on my browser :
>>>>>> ....
>>>>>> DEBUG:  widget ID collision on ID: reportDivId
>>>>>> ...
>>>>>>
>>>>>> I think this must come from the fact that with my code, I want (for
>>>>>> the
>>>>>> moment) that the action is called only once, but in fact after the
>>>>>> 3000
>>>>>> ms
>>>>>> delay, the action is called again, and it returns a success to the
>>>>>> same
>>>>>> "<div id=reportDivId ...>", that's why there is a collision. Isn't
>>>>>> it?
>>>>>>
>>>>>> If so, what it is the way to make sure that my div tag doesn't recall
>>>>>> my
>>>>>> action more than once ?
>>>>>> Moreover, how come th samples of the Showcase does NOTprovide the
>>>>>> corresponding action and struts.xml files. Because it works on the
>>>>>> showcase,
>>>>>> so with the right code it should work "at home"
>>>>>>
>>>>>> thanks.
>>>>>>
>>>>>> Walid
>>>>>>
>>>>>>
>>>>>>
>>>>>> Musachy Barroso-2 wrote:
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> You are seeing that error in your server logs right? There's a
>>>>>>> couple
>>>>>>> of 
>>>>>>> things that we still need to fix for this integration between Struts
>>>>>>> and 
>>>>>>> Dojo, but the application should work anyway.
>>>>>>>
>>>>>>> musachy
>>>>>>>
>>>>>>> walidito wrote:
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>>> thanks, but I get an error with the code you gave me :
>>>>>>>> SEVERE: Error setting expr 'dojo.transport' with value
>>>>>>>> '[Ljava.lang.String;@179567c'
>>>>>>>> ognl.OgnlException: target is null for setProperty(null,
>>>>>>>> "transport",
>>>>>>>> [Ljava.lang.String;@179567c)
>>>>>>>>
>>>>>>>> thanks
>>>>>>>>
>>>>>>>>
>>>>>>>> Musachy Barroso-2 wrote:
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>               
>>>>>>>>> I think you should take a look at the Struts2/Webwork tutorials 
>>>>>>>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>>>>>>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>>>>>>>
>>>>>>>>> If you look at the showcase code you will see this for the
>>>>>>>>> AjaxTest
>>>>>>>>> action:
>>>>>>>>>
>>>>>>>>> in struts-ajax.xml:
>>>>>>>>>
>>>>>>>>> <action name="AjaxTest" 
>>>>>>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>>>>>>>     <result>/ajax/AjaxResult.jsp</result>
>>>>>>>>>  </action>
>>>>>>>>>
>>>>>>>>> in AjaxTestAction.java:
>>>>>>>>>
>>>>>>>>> public class AjaxTestAction implements Action, Serializable {
>>>>>>>>>
>>>>>>>>>     private static int counter = 0;
>>>>>>>>>     private String data;
>>>>>>>>>
>>>>>>>>>     public long getServerTime() {
>>>>>>>>>         return System.currentTimeMillis();
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>     public int getCount() {
>>>>>>>>>         return ++counter;
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>     public String getData() {
>>>>>>>>>         return data;
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>     public void setData(String data) {
>>>>>>>>>         this.data = data;
>>>>>>>>>     }
>>>>>>>>>
>>>>>>>>>     public String execute() throws Exception {
>>>>>>>>>         return SUCCESS;
>>>>>>>>>     }
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> and AjaxResult.jsp:
>>>>>>>>>
>>>>>>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>>>>>>
>>>>>>>>> <%
>>>>>>>>>     request.setAttribute("decorator", "none");
>>>>>>>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>>>>>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>>>>>>>     response.setDateHeader ("Expires", 0); //prevents caching at
>>>>>>>>> the 
>>>>>>>>> proxy server
>>>>>>>>> %>
>>>>>>>>>
>>>>>>>>> Result: <s:property value="count"/> @ <s:property
>>>>>>>>> value="serverTime"/>
>>>>>>>>> <br/>
>>>>>>>>> <s:property value="data"/>
>>>>>>>>>
>>>>>>>>> musachy
>>>>>>>>>
>>>>>>>>> walidito wrote:
>>>>>>>>>     
>>>>>>>>>         
>>>>>>>>>             
>>>>>>>>>                 
>>>>>>>>>> I,
>>>>>>>>>> I wanna run this type of example app :
>>>>>>>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>>>>>>>> :
>>>>>>>>>> <s:div
>>>>>>>>>> 13:         id="once"
>>>>>>>>>> 14:         theme="ajax"
>>>>>>>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>>>>>>>> 16:         href="/AjaxTest.action"
>>>>>>>>>> 17:         delay="5000"
>>>>>>>>>> 18:         loadingText="loading...">
>>>>>>>>>> 19:     Initial Content
>>>>>>>>>> </s:div>
>>>>>>>>>>
>>>>>>>>>> In other word, a basic ajax component that allows a refreshment
>>>>>>>>>> of
>>>>>>>>>> only
>>>>>>>>>> a
>>>>>>>>>> part of my page.
>>>>>>>>>>
>>>>>>>>>> But I didn't get how to write the corresonding action and action
>>>>>>>>>> mapping. 
>>>>>>>>>> For the moment I've tried to put a "success" return in my action
>>>>>>>>>> (
>>>>>>>>>> is
>>>>>>>>>> it
>>>>>>>>>> enough ?), but I don't see what to put in my action mapping (i
>>>>>>>>>> mean
>>>>>>>>>> inside
>>>>>>>>>> the <action name="blablabla" ...> tag. If I put nothing, of
>>>>>>>>>> course
>>>>>>>>>> it's
>>>>>>>>>> wrong.
>>>>>>>>>> If I only put a success-type result, It creates an infinite loop
>>>>>>>>>> (always
>>>>>>>>>> displays "loading").
>>>>>>>>>> Can sobdy help please?
>>>>>>>>>>   
>>>>>>>>>>       
>>>>>>>>>>           
>>>>>>>>>>               
>>>>>>>>>>                   
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>   
>>>>>>       
>>>>>>           
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/Still-Ajax-and-Struts-2-tf2776835.html#a7762934
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: Still Ajax and Struts 2

Posted by Musachy Barroso <mb...@wfscorp.com>.
What is happening is that there is an error on the request, probably the 
action mapping is wrong, and it is returning a page with the error, but 
that page has the same menu as showcase, that's why your are seeing it 
twice. Put the full url for the action on the address bar, after you get 
that to show the right page (what you expect to see in the div tag), 
then try the div.

musachy

walidito wrote:
> I don't hink I'm adding anything.
> Here is my code :
> the action :
> 	public String execute() throws Exception
> 	{
> 		return SUCCESS;
> 	}
>
> the struts.xml:
>
>         <action name="AjaxTestAction"
> class="dashboard.actions.AjaxTestAction">
>         	<result>/JSPs/Menu.jsp</result>
>         </action>
> and the jsp :
> <head>
>     ...   
>  	 <s:head theme="ajax" debug="false"/>
>  	...
> </head>
> <body>
>                <s:div
> 	id="once"
>              	cssStyle="border: 2px solid red;"
>              	href="%{ajaxTest}"
>           	 theme="ajax">
>              	                   hhookayy
>      			</s:div>
> </body>
>
>
> I know it's working on the shwocase, but my app is not working... Since the
> showcase action and struts sources are not available...
> What I see on my screen is the "top" of jsp that is written twice, in fact,
> the top html is loaded once (normal), but after the action call, the top is
> written another time, I don't know why... Moreover, the eclipse console
> displays the same error (dojo.transport) again and again...
>
> Regards,
> Walid
>
>
>
>
> Musachy Barroso-2 wrote:
>   
>> Are you sure you are not adding anything else to it and you are looking 
>> at the right one? I just check it out on showcase and it only loads 
>> once. Can you see if you have the same problem on showcase?
>>
>> regards
>> musachy
>>
>> walidito wrote:
>>     
>>> Sorry but it didn't...
>>> It loads it many times....
>>>
>>>
>>> Musachy Barroso-2 wrote:
>>>   
>>>       
>>>> That needs to be fixed in struts, this is the jira ticket: 
>>>> https://issues.apache.org/struts/browse/WW-1551
>>>>
>>>> from showcase:
>>>>
>>>> <s:div
>>>>         id="once"
>>>>         theme="ajax"
>>>>         cssStyle="border: 1px solid yellow;"
>>>>         href="%{ajaxTest}">
>>>>     Initial Content</s:div>
>>>>
>>>> That should load the div only once.
>>>>
>>>> musachy
>>>>
>>>> walidito wrote:
>>>>     
>>>>         
>>>>> Hi,
>>>>> Actually, I get this error both in my eclipse "console" and in my web
>>>>> page
>>>>> (debug enabled).
>>>>> First of all here is the "jsp" code that I use:
>>>>>     <s:div
>>>>> 	            id="reportDivId"
>>>>>              	cssStyle="border: 2px solid red;"
>>>>>              	href="/AjaxTestAction.do"
>>>>>           	    theme="ajax"
>>>>>           	    delay="3000"
>>>>>              	errorText="There was an error"
>>>>>              	loadingText="loading...">
>>>>>              	<s:property value="count"/> @ <s:property
>>>>> value="serverTime"/>
>>>>> <br/>
>>>>>      </s:div>
>>>>>
>>>>>  this is the redundant error that I get on my eclipse console :
>>>>>
>>>>> -SEVERE: Error setting expr 'dojo.transport' with value
>>>>> '[Ljava.lang.String;@e8f27e'
>>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>>> [Ljava.lang.String;@e8f27e)
>>>>> 	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
>>>>> 	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>>>>> 	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>>>>>                 ...
>>>>>
>>>>> and after a first call of the action I get this on my browser :
>>>>> ....
>>>>> DEBUG:  widget ID collision on ID: reportDivId
>>>>> ...
>>>>>
>>>>> I think this must come from the fact that with my code, I want (for the
>>>>> moment) that the action is called only once, but in fact after the 3000
>>>>> ms
>>>>> delay, the action is called again, and it returns a success to the same
>>>>> "<div id=reportDivId ...>", that's why there is a collision. Isn't it?
>>>>>
>>>>> If so, what it is the way to make sure that my div tag doesn't recall
>>>>> my
>>>>> action more than once ?
>>>>> Moreover, how come th samples of the Showcase does NOTprovide the
>>>>> corresponding action and struts.xml files. Because it works on the
>>>>> showcase,
>>>>> so with the right code it should work "at home"
>>>>>
>>>>> thanks.
>>>>>
>>>>> Walid
>>>>>
>>>>>
>>>>>
>>>>> Musachy Barroso-2 wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> You are seeing that error in your server logs right? There's a couple
>>>>>> of 
>>>>>> things that we still need to fix for this integration between Struts
>>>>>> and 
>>>>>> Dojo, but the application should work anyway.
>>>>>>
>>>>>> musachy
>>>>>>
>>>>>> walidito wrote:
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> thanks, but I get an error with the code you gave me :
>>>>>>> SEVERE: Error setting expr 'dojo.transport' with value
>>>>>>> '[Ljava.lang.String;@179567c'
>>>>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>>>>> [Ljava.lang.String;@179567c)
>>>>>>>
>>>>>>> thanks
>>>>>>>
>>>>>>>
>>>>>>> Musachy Barroso-2 wrote:
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>>>> I think you should take a look at the Struts2/Webwork tutorials 
>>>>>>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>>>>>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>>>>>>
>>>>>>>> If you look at the showcase code you will see this for the AjaxTest
>>>>>>>> action:
>>>>>>>>
>>>>>>>> in struts-ajax.xml:
>>>>>>>>
>>>>>>>> <action name="AjaxTest" 
>>>>>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>>>>>>     <result>/ajax/AjaxResult.jsp</result>
>>>>>>>>  </action>
>>>>>>>>
>>>>>>>> in AjaxTestAction.java:
>>>>>>>>
>>>>>>>> public class AjaxTestAction implements Action, Serializable {
>>>>>>>>
>>>>>>>>     private static int counter = 0;
>>>>>>>>     private String data;
>>>>>>>>
>>>>>>>>     public long getServerTime() {
>>>>>>>>         return System.currentTimeMillis();
>>>>>>>>     }
>>>>>>>>
>>>>>>>>     public int getCount() {
>>>>>>>>         return ++counter;
>>>>>>>>     }
>>>>>>>>
>>>>>>>>     public String getData() {
>>>>>>>>         return data;
>>>>>>>>     }
>>>>>>>>
>>>>>>>>     public void setData(String data) {
>>>>>>>>         this.data = data;
>>>>>>>>     }
>>>>>>>>
>>>>>>>>     public String execute() throws Exception {
>>>>>>>>         return SUCCESS;
>>>>>>>>     }
>>>>>>>> }
>>>>>>>>
>>>>>>>> and AjaxResult.jsp:
>>>>>>>>
>>>>>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>>>>>
>>>>>>>> <%
>>>>>>>>     request.setAttribute("decorator", "none");
>>>>>>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>>>>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>>>>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>>>>>>> proxy server
>>>>>>>> %>
>>>>>>>>
>>>>>>>> Result: <s:property value="count"/> @ <s:property
>>>>>>>> value="serverTime"/>
>>>>>>>> <br/>
>>>>>>>> <s:property value="data"/>
>>>>>>>>
>>>>>>>> musachy
>>>>>>>>
>>>>>>>> walidito wrote:
>>>>>>>>     
>>>>>>>>         
>>>>>>>>             
>>>>>>>>                 
>>>>>>>>> I,
>>>>>>>>> I wanna run this type of example app :
>>>>>>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>>>>>>> :
>>>>>>>>> <s:div
>>>>>>>>> 13:         id="once"
>>>>>>>>> 14:         theme="ajax"
>>>>>>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>>>>>>> 16:         href="/AjaxTest.action"
>>>>>>>>> 17:         delay="5000"
>>>>>>>>> 18:         loadingText="loading...">
>>>>>>>>> 19:     Initial Content
>>>>>>>>> </s:div>
>>>>>>>>>
>>>>>>>>> In other word, a basic ajax component that allows a refreshment of
>>>>>>>>> only
>>>>>>>>> a
>>>>>>>>> part of my page.
>>>>>>>>>
>>>>>>>>> But I didn't get how to write the corresonding action and action
>>>>>>>>> mapping. 
>>>>>>>>> For the moment I've tried to put a "success" return in my action (
>>>>>>>>> is
>>>>>>>>> it
>>>>>>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>>>>>>> inside
>>>>>>>>> the <action name="blablabla" ...> tag. If I put nothing, of course
>>>>>>>>> it's
>>>>>>>>> wrong.
>>>>>>>>> If I only put a success-type result, It creates an infinite loop
>>>>>>>>> (always
>>>>>>>>> displays "loading").
>>>>>>>>> Can sobdy help please?
>>>>>>>>>   
>>>>>>>>>       
>>>>>>>>>           
>>>>>>>>>               
>>>>>>>>>                   
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> 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
>>>>>>
>>>>>>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>   
>>>>>       
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
>>
>>     
>
>   


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


Re: Still Ajax and Struts 2

Posted by walidito <wa...@sgcib.com>.
I don't hink I'm adding anything.
Here is my code :
the action :
	public String execute() throws Exception
	{
		return SUCCESS;
	}

the struts.xml:

        <action name="AjaxTestAction"
class="dashboard.actions.AjaxTestAction">
        	<result>/JSPs/Menu.jsp</result>
        </action>
and the jsp :
<head>
    ...   
 	 <s:head theme="ajax" debug="false"/>
 	...
</head>
<body>
               <s:div
	id="once"
             	cssStyle="border: 2px solid red;"
             	href="%{ajaxTest}"
          	 theme="ajax">
             	                   hhookayy
     			</s:div>
</body>


I know it's working on the shwocase, but my app is not working... Since the
showcase action and struts sources are not available...
What I see on my screen is the "top" of jsp that is written twice, in fact,
the top html is loaded once (normal), but after the action call, the top is
written another time, I don't know why... Moreover, the eclipse console
displays the same error (dojo.transport) again and again...

Regards,
Walid




Musachy Barroso-2 wrote:
> 
> Are you sure you are not adding anything else to it and you are looking 
> at the right one? I just check it out on showcase and it only loads 
> once. Can you see if you have the same problem on showcase?
> 
> regards
> musachy
> 
> walidito wrote:
>> Sorry but it didn't...
>> It loads it many times....
>>
>>
>> Musachy Barroso-2 wrote:
>>   
>>> That needs to be fixed in struts, this is the jira ticket: 
>>> https://issues.apache.org/struts/browse/WW-1551
>>>
>>> from showcase:
>>>
>>> <s:div
>>>         id="once"
>>>         theme="ajax"
>>>         cssStyle="border: 1px solid yellow;"
>>>         href="%{ajaxTest}">
>>>     Initial Content</s:div>
>>>
>>> That should load the div only once.
>>>
>>> musachy
>>>
>>> walidito wrote:
>>>     
>>>> Hi,
>>>> Actually, I get this error both in my eclipse "console" and in my web
>>>> page
>>>> (debug enabled).
>>>> First of all here is the "jsp" code that I use:
>>>>     <s:div
>>>> 	            id="reportDivId"
>>>>              	cssStyle="border: 2px solid red;"
>>>>              	href="/AjaxTestAction.do"
>>>>           	    theme="ajax"
>>>>           	    delay="3000"
>>>>              	errorText="There was an error"
>>>>              	loadingText="loading...">
>>>>              	<s:property value="count"/> @ <s:property
>>>> value="serverTime"/>
>>>> <br/>
>>>>      </s:div>
>>>>
>>>>  this is the redundant error that I get on my eclipse console :
>>>>
>>>> -SEVERE: Error setting expr 'dojo.transport' with value
>>>> '[Ljava.lang.String;@e8f27e'
>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>> [Ljava.lang.String;@e8f27e)
>>>> 	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
>>>> 	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>>>> 	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>>>>                 ...
>>>>
>>>> and after a first call of the action I get this on my browser :
>>>> ....
>>>> DEBUG:  widget ID collision on ID: reportDivId
>>>> ...
>>>>
>>>> I think this must come from the fact that with my code, I want (for the
>>>> moment) that the action is called only once, but in fact after the 3000
>>>> ms
>>>> delay, the action is called again, and it returns a success to the same
>>>> "<div id=reportDivId ...>", that's why there is a collision. Isn't it?
>>>>
>>>> If so, what it is the way to make sure that my div tag doesn't recall
>>>> my
>>>> action more than once ?
>>>> Moreover, how come th samples of the Showcase does NOTprovide the
>>>> corresponding action and struts.xml files. Because it works on the
>>>> showcase,
>>>> so with the right code it should work "at home"
>>>>
>>>> thanks.
>>>>
>>>> Walid
>>>>
>>>>
>>>>
>>>> Musachy Barroso-2 wrote:
>>>>   
>>>>       
>>>>> You are seeing that error in your server logs right? There's a couple
>>>>> of 
>>>>> things that we still need to fix for this integration between Struts
>>>>> and 
>>>>> Dojo, but the application should work anyway.
>>>>>
>>>>> musachy
>>>>>
>>>>> walidito wrote:
>>>>>     
>>>>>         
>>>>>> thanks, but I get an error with the code you gave me :
>>>>>> SEVERE: Error setting expr 'dojo.transport' with value
>>>>>> '[Ljava.lang.String;@179567c'
>>>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>>>> [Ljava.lang.String;@179567c)
>>>>>>
>>>>>> thanks
>>>>>>
>>>>>>
>>>>>> Musachy Barroso-2 wrote:
>>>>>>   
>>>>>>       
>>>>>>           
>>>>>>> I think you should take a look at the Struts2/Webwork tutorials 
>>>>>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>>>>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>>>>>
>>>>>>> If you look at the showcase code you will see this for the AjaxTest
>>>>>>> action:
>>>>>>>
>>>>>>> in struts-ajax.xml:
>>>>>>>
>>>>>>> <action name="AjaxTest" 
>>>>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>>>>>     <result>/ajax/AjaxResult.jsp</result>
>>>>>>>  </action>
>>>>>>>
>>>>>>> in AjaxTestAction.java:
>>>>>>>
>>>>>>> public class AjaxTestAction implements Action, Serializable {
>>>>>>>
>>>>>>>     private static int counter = 0;
>>>>>>>     private String data;
>>>>>>>
>>>>>>>     public long getServerTime() {
>>>>>>>         return System.currentTimeMillis();
>>>>>>>     }
>>>>>>>
>>>>>>>     public int getCount() {
>>>>>>>         return ++counter;
>>>>>>>     }
>>>>>>>
>>>>>>>     public String getData() {
>>>>>>>         return data;
>>>>>>>     }
>>>>>>>
>>>>>>>     public void setData(String data) {
>>>>>>>         this.data = data;
>>>>>>>     }
>>>>>>>
>>>>>>>     public String execute() throws Exception {
>>>>>>>         return SUCCESS;
>>>>>>>     }
>>>>>>> }
>>>>>>>
>>>>>>> and AjaxResult.jsp:
>>>>>>>
>>>>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>>>>
>>>>>>> <%
>>>>>>>     request.setAttribute("decorator", "none");
>>>>>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>>>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>>>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>>>>>> proxy server
>>>>>>> %>
>>>>>>>
>>>>>>> Result: <s:property value="count"/> @ <s:property
>>>>>>> value="serverTime"/>
>>>>>>> <br/>
>>>>>>> <s:property value="data"/>
>>>>>>>
>>>>>>> musachy
>>>>>>>
>>>>>>> walidito wrote:
>>>>>>>     
>>>>>>>         
>>>>>>>             
>>>>>>>> I,
>>>>>>>> I wanna run this type of example app :
>>>>>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>>>>>> :
>>>>>>>> <s:div
>>>>>>>> 13:         id="once"
>>>>>>>> 14:         theme="ajax"
>>>>>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>>>>>> 16:         href="/AjaxTest.action"
>>>>>>>> 17:         delay="5000"
>>>>>>>> 18:         loadingText="loading...">
>>>>>>>> 19:     Initial Content
>>>>>>>> </s:div>
>>>>>>>>
>>>>>>>> In other word, a basic ajax component that allows a refreshment of
>>>>>>>> only
>>>>>>>> a
>>>>>>>> part of my page.
>>>>>>>>
>>>>>>>> But I didn't get how to write the corresonding action and action
>>>>>>>> mapping. 
>>>>>>>> For the moment I've tried to put a "success" return in my action (
>>>>>>>> is
>>>>>>>> it
>>>>>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>>>>>> inside
>>>>>>>> the <action name="blablabla" ...> tag. If I put nothing, of course
>>>>>>>> it's
>>>>>>>> wrong.
>>>>>>>> If I only put a success-type result, It creates an infinite loop
>>>>>>>> (always
>>>>>>>> displays "loading").
>>>>>>>> Can sobdy help please?
>>>>>>>>   
>>>>>>>>       
>>>>>>>>           
>>>>>>>>               
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Still-Ajax-and-Struts-2-tf2776835.html#a7760574
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: Still Ajax and Struts 2

Posted by Musachy Barroso <mb...@wfscorp.com>.
Are you sure you are not adding anything else to it and you are looking 
at the right one? I just check it out on showcase and it only loads 
once. Can you see if you have the same problem on showcase?

regards
musachy

walidito wrote:
> Sorry but it didn't...
> It loads it many times....
>
>
> Musachy Barroso-2 wrote:
>   
>> That needs to be fixed in struts, this is the jira ticket: 
>> https://issues.apache.org/struts/browse/WW-1551
>>
>> from showcase:
>>
>> <s:div
>>         id="once"
>>         theme="ajax"
>>         cssStyle="border: 1px solid yellow;"
>>         href="%{ajaxTest}">
>>     Initial Content</s:div>
>>
>> That should load the div only once.
>>
>> musachy
>>
>> walidito wrote:
>>     
>>> Hi,
>>> Actually, I get this error both in my eclipse "console" and in my web
>>> page
>>> (debug enabled).
>>> First of all here is the "jsp" code that I use:
>>>     <s:div
>>> 	            id="reportDivId"
>>>              	cssStyle="border: 2px solid red;"
>>>              	href="/AjaxTestAction.do"
>>>           	    theme="ajax"
>>>           	    delay="3000"
>>>              	errorText="There was an error"
>>>              	loadingText="loading...">
>>>              	<s:property value="count"/> @ <s:property
>>> value="serverTime"/>
>>> <br/>
>>>      </s:div>
>>>
>>>  this is the redundant error that I get on my eclipse console :
>>>
>>> -SEVERE: Error setting expr 'dojo.transport' with value
>>> '[Ljava.lang.String;@e8f27e'
>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>> [Ljava.lang.String;@e8f27e)
>>> 	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
>>> 	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>>> 	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>>>                 ...
>>>
>>> and after a first call of the action I get this on my browser :
>>> ....
>>> DEBUG:  widget ID collision on ID: reportDivId
>>> ...
>>>
>>> I think this must come from the fact that with my code, I want (for the
>>> moment) that the action is called only once, but in fact after the 3000
>>> ms
>>> delay, the action is called again, and it returns a success to the same
>>> "<div id=reportDivId ...>", that's why there is a collision. Isn't it?
>>>
>>> If so, what it is the way to make sure that my div tag doesn't recall my
>>> action more than once ?
>>> Moreover, how come th samples of the Showcase does NOTprovide the
>>> corresponding action and struts.xml files. Because it works on the
>>> showcase,
>>> so with the right code it should work "at home"
>>>
>>> thanks.
>>>
>>> Walid
>>>
>>>
>>>
>>> Musachy Barroso-2 wrote:
>>>   
>>>       
>>>> You are seeing that error in your server logs right? There's a couple of 
>>>> things that we still need to fix for this integration between Struts and 
>>>> Dojo, but the application should work anyway.
>>>>
>>>> musachy
>>>>
>>>> walidito wrote:
>>>>     
>>>>         
>>>>> thanks, but I get an error with the code you gave me :
>>>>> SEVERE: Error setting expr 'dojo.transport' with value
>>>>> '[Ljava.lang.String;@179567c'
>>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>>> [Ljava.lang.String;@179567c)
>>>>>
>>>>> thanks
>>>>>
>>>>>
>>>>> Musachy Barroso-2 wrote:
>>>>>   
>>>>>       
>>>>>           
>>>>>> I think you should take a look at the Struts2/Webwork tutorials 
>>>>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>>>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>>>>
>>>>>> If you look at the showcase code you will see this for the AjaxTest
>>>>>> action:
>>>>>>
>>>>>> in struts-ajax.xml:
>>>>>>
>>>>>> <action name="AjaxTest" 
>>>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>>>>     <result>/ajax/AjaxResult.jsp</result>
>>>>>>  </action>
>>>>>>
>>>>>> in AjaxTestAction.java:
>>>>>>
>>>>>> public class AjaxTestAction implements Action, Serializable {
>>>>>>
>>>>>>     private static int counter = 0;
>>>>>>     private String data;
>>>>>>
>>>>>>     public long getServerTime() {
>>>>>>         return System.currentTimeMillis();
>>>>>>     }
>>>>>>
>>>>>>     public int getCount() {
>>>>>>         return ++counter;
>>>>>>     }
>>>>>>
>>>>>>     public String getData() {
>>>>>>         return data;
>>>>>>     }
>>>>>>
>>>>>>     public void setData(String data) {
>>>>>>         this.data = data;
>>>>>>     }
>>>>>>
>>>>>>     public String execute() throws Exception {
>>>>>>         return SUCCESS;
>>>>>>     }
>>>>>> }
>>>>>>
>>>>>> and AjaxResult.jsp:
>>>>>>
>>>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>>>
>>>>>> <%
>>>>>>     request.setAttribute("decorator", "none");
>>>>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>>>>> proxy server
>>>>>> %>
>>>>>>
>>>>>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>>>>>> <br/>
>>>>>> <s:property value="data"/>
>>>>>>
>>>>>> musachy
>>>>>>
>>>>>> walidito wrote:
>>>>>>     
>>>>>>         
>>>>>>             
>>>>>>> I,
>>>>>>> I wanna run this type of example app :
>>>>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>>>>> :
>>>>>>> <s:div
>>>>>>> 13:         id="once"
>>>>>>> 14:         theme="ajax"
>>>>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>>>>> 16:         href="/AjaxTest.action"
>>>>>>> 17:         delay="5000"
>>>>>>> 18:         loadingText="loading...">
>>>>>>> 19:     Initial Content
>>>>>>> </s:div>
>>>>>>>
>>>>>>> In other word, a basic ajax component that allows a refreshment of
>>>>>>> only
>>>>>>> a
>>>>>>> part of my page.
>>>>>>>
>>>>>>> But I didn't get how to write the corresonding action and action
>>>>>>> mapping. 
>>>>>>> For the moment I've tried to put a "success" return in my action ( is
>>>>>>> it
>>>>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>>>>> inside
>>>>>>> the <action name="blablabla" ...> tag. If I put nothing, of course
>>>>>>> it's
>>>>>>> wrong.
>>>>>>> If I only put a success-type result, It creates an infinite loop
>>>>>>> (always
>>>>>>> displays "loading").
>>>>>>> Can sobdy help please?
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> ---------------------------------------------------------------------
>> 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: Still Ajax and Struts 2

Posted by walidito <wa...@sgcib.com>.
Sorry but it didn't...
It loads it many times....


Musachy Barroso-2 wrote:
> 
> That needs to be fixed in struts, this is the jira ticket: 
> https://issues.apache.org/struts/browse/WW-1551
> 
> from showcase:
> 
> <s:div
>         id="once"
>         theme="ajax"
>         cssStyle="border: 1px solid yellow;"
>         href="%{ajaxTest}">
>     Initial Content</s:div>
> 
> That should load the div only once.
> 
> musachy
> 
> walidito wrote:
>> Hi,
>> Actually, I get this error both in my eclipse "console" and in my web
>> page
>> (debug enabled).
>> First of all here is the "jsp" code that I use:
>>     <s:div
>> 	            id="reportDivId"
>>              	cssStyle="border: 2px solid red;"
>>              	href="/AjaxTestAction.do"
>>           	    theme="ajax"
>>           	    delay="3000"
>>              	errorText="There was an error"
>>              	loadingText="loading...">
>>              	<s:property value="count"/> @ <s:property
>> value="serverTime"/>
>> <br/>
>>      </s:div>
>>
>>  this is the redundant error that I get on my eclipse console :
>>
>> -SEVERE: Error setting expr 'dojo.transport' with value
>> '[Ljava.lang.String;@e8f27e'
>> ognl.OgnlException: target is null for setProperty(null, "transport",
>> [Ljava.lang.String;@e8f27e)
>> 	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
>> 	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
>> 	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>>                 ...
>>
>> and after a first call of the action I get this on my browser :
>> ....
>> DEBUG:  widget ID collision on ID: reportDivId
>> ...
>>
>> I think this must come from the fact that with my code, I want (for the
>> moment) that the action is called only once, but in fact after the 3000
>> ms
>> delay, the action is called again, and it returns a success to the same
>> "<div id=reportDivId ...>", that's why there is a collision. Isn't it?
>>
>> If so, what it is the way to make sure that my div tag doesn't recall my
>> action more than once ?
>> Moreover, how come th samples of the Showcase does NOTprovide the
>> corresponding action and struts.xml files. Because it works on the
>> showcase,
>> so with the right code it should work "at home"
>>
>> thanks.
>>
>> Walid
>>
>>
>>
>> Musachy Barroso-2 wrote:
>>   
>>> You are seeing that error in your server logs right? There's a couple of 
>>> things that we still need to fix for this integration between Struts and 
>>> Dojo, but the application should work anyway.
>>>
>>> musachy
>>>
>>> walidito wrote:
>>>     
>>>> thanks, but I get an error with the code you gave me :
>>>> SEVERE: Error setting expr 'dojo.transport' with value
>>>> '[Ljava.lang.String;@179567c'
>>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>>> [Ljava.lang.String;@179567c)
>>>>
>>>> thanks
>>>>
>>>>
>>>> Musachy Barroso-2 wrote:
>>>>   
>>>>       
>>>>> I think you should take a look at the Struts2/Webwork tutorials 
>>>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>>>
>>>>> If you look at the showcase code you will see this for the AjaxTest
>>>>> action:
>>>>>
>>>>> in struts-ajax.xml:
>>>>>
>>>>> <action name="AjaxTest" 
>>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>>>     <result>/ajax/AjaxResult.jsp</result>
>>>>>  </action>
>>>>>
>>>>> in AjaxTestAction.java:
>>>>>
>>>>> public class AjaxTestAction implements Action, Serializable {
>>>>>
>>>>>     private static int counter = 0;
>>>>>     private String data;
>>>>>
>>>>>     public long getServerTime() {
>>>>>         return System.currentTimeMillis();
>>>>>     }
>>>>>
>>>>>     public int getCount() {
>>>>>         return ++counter;
>>>>>     }
>>>>>
>>>>>     public String getData() {
>>>>>         return data;
>>>>>     }
>>>>>
>>>>>     public void setData(String data) {
>>>>>         this.data = data;
>>>>>     }
>>>>>
>>>>>     public String execute() throws Exception {
>>>>>         return SUCCESS;
>>>>>     }
>>>>> }
>>>>>
>>>>> and AjaxResult.jsp:
>>>>>
>>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>>
>>>>> <%
>>>>>     request.setAttribute("decorator", "none");
>>>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>>>> proxy server
>>>>> %>
>>>>>
>>>>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>>>>> <br/>
>>>>> <s:property value="data"/>
>>>>>
>>>>> musachy
>>>>>
>>>>> walidito wrote:
>>>>>     
>>>>>         
>>>>>> I,
>>>>>> I wanna run this type of example app :
>>>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>>>> :
>>>>>> <s:div
>>>>>> 13:         id="once"
>>>>>> 14:         theme="ajax"
>>>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>>>> 16:         href="/AjaxTest.action"
>>>>>> 17:         delay="5000"
>>>>>> 18:         loadingText="loading...">
>>>>>> 19:     Initial Content
>>>>>> </s:div>
>>>>>>
>>>>>> In other word, a basic ajax component that allows a refreshment of
>>>>>> only
>>>>>> a
>>>>>> part of my page.
>>>>>>
>>>>>> But I didn't get how to write the corresonding action and action
>>>>>> mapping. 
>>>>>> For the moment I've tried to put a "success" return in my action ( is
>>>>>> it
>>>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>>>> inside
>>>>>> the <action name="blablabla" ...> tag. If I put nothing, of course
>>>>>> it's
>>>>>> wrong.
>>>>>> If I only put a success-type result, It creates an infinite loop
>>>>>> (always
>>>>>> displays "loading").
>>>>>> Can sobdy help please?
>>>>>>   
>>>>>>       
>>>>>>           
>>>>> ---------------------------------------------------------------------
>>>>> 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
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/Still-Ajax-and-Struts-2-tf2776835.html#a7760046
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: Still Ajax and Struts 2

Posted by Musachy Barroso <mb...@wfscorp.com>.
That needs to be fixed in struts, this is the jira ticket: 
https://issues.apache.org/struts/browse/WW-1551

from showcase:

<s:div
        id="once"
        theme="ajax"
        cssStyle="border: 1px solid yellow;"
        href="%{ajaxTest}">
    Initial Content</s:div>

That should load the div only once.

musachy

walidito wrote:
> Hi,
> Actually, I get this error both in my eclipse "console" and in my web page
> (debug enabled).
> First of all here is the "jsp" code that I use:
>     <s:div
> 	            id="reportDivId"
>              	cssStyle="border: 2px solid red;"
>              	href="/AjaxTestAction.do"
>           	    theme="ajax"
>           	    delay="3000"
>              	errorText="There was an error"
>              	loadingText="loading...">
>              	<s:property value="count"/> @ <s:property value="serverTime"/>
> <br/>
>      </s:div>
>
>  this is the redundant error that I get on my eclipse console :
>
> -SEVERE: Error setting expr 'dojo.transport' with value
> '[Ljava.lang.String;@e8f27e'
> ognl.OgnlException: target is null for setProperty(null, "transport",
> [Ljava.lang.String;@e8f27e)
> 	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
> 	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
> 	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
>                 ...
>
> and after a first call of the action I get this on my browser :
> ....
> DEBUG:  widget ID collision on ID: reportDivId
> ...
>
> I think this must come from the fact that with my code, I want (for the
> moment) that the action is called only once, but in fact after the 3000 ms
> delay, the action is called again, and it returns a success to the same
> "<div id=reportDivId ...>", that's why there is a collision. Isn't it?
>
> If so, what it is the way to make sure that my div tag doesn't recall my
> action more than once ?
> Moreover, how come th samples of the Showcase does NOTprovide the
> corresponding action and struts.xml files. Because it works on the showcase,
> so with the right code it should work "at home"
>
> thanks.
>
> Walid
>
>
>
> Musachy Barroso-2 wrote:
>   
>> You are seeing that error in your server logs right? There's a couple of 
>> things that we still need to fix for this integration between Struts and 
>> Dojo, but the application should work anyway.
>>
>> musachy
>>
>> walidito wrote:
>>     
>>> thanks, but I get an error with the code you gave me :
>>> SEVERE: Error setting expr 'dojo.transport' with value
>>> '[Ljava.lang.String;@179567c'
>>> ognl.OgnlException: target is null for setProperty(null, "transport",
>>> [Ljava.lang.String;@179567c)
>>>
>>> thanks
>>>
>>>
>>> Musachy Barroso-2 wrote:
>>>   
>>>       
>>>> I think you should take a look at the Struts2/Webwork tutorials 
>>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>>
>>>> If you look at the showcase code you will see this for the AjaxTest
>>>> action:
>>>>
>>>> in struts-ajax.xml:
>>>>
>>>> <action name="AjaxTest" 
>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>>     <result>/ajax/AjaxResult.jsp</result>
>>>>  </action>
>>>>
>>>> in AjaxTestAction.java:
>>>>
>>>> public class AjaxTestAction implements Action, Serializable {
>>>>
>>>>     private static int counter = 0;
>>>>     private String data;
>>>>
>>>>     public long getServerTime() {
>>>>         return System.currentTimeMillis();
>>>>     }
>>>>
>>>>     public int getCount() {
>>>>         return ++counter;
>>>>     }
>>>>
>>>>     public String getData() {
>>>>         return data;
>>>>     }
>>>>
>>>>     public void setData(String data) {
>>>>         this.data = data;
>>>>     }
>>>>
>>>>     public String execute() throws Exception {
>>>>         return SUCCESS;
>>>>     }
>>>> }
>>>>
>>>> and AjaxResult.jsp:
>>>>
>>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>>
>>>> <%
>>>>     request.setAttribute("decorator", "none");
>>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>>> proxy server
>>>> %>
>>>>
>>>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>>>> <br/>
>>>> <s:property value="data"/>
>>>>
>>>> musachy
>>>>
>>>> walidito wrote:
>>>>     
>>>>         
>>>>> I,
>>>>> I wanna run this type of example app :
>>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>>> :
>>>>> <s:div
>>>>> 13:         id="once"
>>>>> 14:         theme="ajax"
>>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>>> 16:         href="/AjaxTest.action"
>>>>> 17:         delay="5000"
>>>>> 18:         loadingText="loading...">
>>>>> 19:     Initial Content
>>>>> </s:div>
>>>>>
>>>>> In other word, a basic ajax component that allows a refreshment of only
>>>>> a
>>>>> part of my page.
>>>>>
>>>>> But I didn't get how to write the corresonding action and action
>>>>> mapping. 
>>>>> For the moment I've tried to put a "success" return in my action ( is
>>>>> it
>>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>>> inside
>>>>> the <action name="blablabla" ...> tag. If I put nothing, of course it's
>>>>> wrong.
>>>>> If I only put a success-type result, It creates an infinite loop
>>>>> (always
>>>>> displays "loading").
>>>>> Can sobdy help please?
>>>>>   
>>>>>       
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> 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
>>
>>
>>
>>     
>
>   


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


Re: Still Ajax and Struts 2

Posted by walidito <wa...@sgcib.com>.
Hi,
Actually, I get this error both in my eclipse "console" and in my web page
(debug enabled).
First of all here is the "jsp" code that I use:
    <s:div
	            id="reportDivId"
             	cssStyle="border: 2px solid red;"
             	href="/AjaxTestAction.do"
          	    theme="ajax"
          	    delay="3000"
             	errorText="There was an error"
             	loadingText="loading...">
             	<s:property value="count"/> @ <s:property value="serverTime"/>
<br/>
     </s:div>

 this is the redundant error that I get on my eclipse console :

-SEVERE: Error setting expr 'dojo.transport' with value
'[Ljava.lang.String;@e8f27e'
ognl.OgnlException: target is null for setProperty(null, "transport",
[Ljava.lang.String;@e8f27e)
	at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)
	at ognl.ASTProperty.setValueBody(ASTProperty.java:105)
	at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
                ...

and after a first call of the action I get this on my browser :
....
DEBUG:  widget ID collision on ID: reportDivId
...

I think this must come from the fact that with my code, I want (for the
moment) that the action is called only once, but in fact after the 3000 ms
delay, the action is called again, and it returns a success to the same
"<div id=reportDivId ...>", that's why there is a collision. Isn't it?

If so, what it is the way to make sure that my div tag doesn't recall my
action more than once ?
Moreover, how come th samples of the Showcase does NOTprovide the
corresponding action and struts.xml files. Because it works on the showcase,
so with the right code it should work "at home"

thanks.

Walid



Musachy Barroso-2 wrote:
> 
> You are seeing that error in your server logs right? There's a couple of 
> things that we still need to fix for this integration between Struts and 
> Dojo, but the application should work anyway.
> 
> musachy
> 
> walidito wrote:
>> thanks, but I get an error with the code you gave me :
>> SEVERE: Error setting expr 'dojo.transport' with value
>> '[Ljava.lang.String;@179567c'
>> ognl.OgnlException: target is null for setProperty(null, "transport",
>> [Ljava.lang.String;@179567c)
>>
>> thanks
>>
>>
>> Musachy Barroso-2 wrote:
>>   
>>> I think you should take a look at the Struts2/Webwork tutorials 
>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>
>>> If you look at the showcase code you will see this for the AjaxTest
>>> action:
>>>
>>> in struts-ajax.xml:
>>>
>>> <action name="AjaxTest" 
>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>     <result>/ajax/AjaxResult.jsp</result>
>>>  </action>
>>>
>>> in AjaxTestAction.java:
>>>
>>> public class AjaxTestAction implements Action, Serializable {
>>>
>>>     private static int counter = 0;
>>>     private String data;
>>>
>>>     public long getServerTime() {
>>>         return System.currentTimeMillis();
>>>     }
>>>
>>>     public int getCount() {
>>>         return ++counter;
>>>     }
>>>
>>>     public String getData() {
>>>         return data;
>>>     }
>>>
>>>     public void setData(String data) {
>>>         this.data = data;
>>>     }
>>>
>>>     public String execute() throws Exception {
>>>         return SUCCESS;
>>>     }
>>> }
>>>
>>> and AjaxResult.jsp:
>>>
>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>
>>> <%
>>>     request.setAttribute("decorator", "none");
>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>> proxy server
>>> %>
>>>
>>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>>> <br/>
>>> <s:property value="data"/>
>>>
>>> musachy
>>>
>>> walidito wrote:
>>>     
>>>> I,
>>>> I wanna run this type of example app :
>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>> :
>>>> <s:div
>>>> 13:         id="once"
>>>> 14:         theme="ajax"
>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>> 16:         href="/AjaxTest.action"
>>>> 17:         delay="5000"
>>>> 18:         loadingText="loading...">
>>>> 19:     Initial Content
>>>> </s:div>
>>>>
>>>> In other word, a basic ajax component that allows a refreshment of only
>>>> a
>>>> part of my page.
>>>>
>>>> But I didn't get how to write the corresonding action and action
>>>> mapping. 
>>>> For the moment I've tried to put a "success" return in my action ( is
>>>> it
>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>> inside
>>>> the <action name="blablabla" ...> tag. If I put nothing, of course it's
>>>> wrong.
>>>> If I only put a success-type result, It creates an infinite loop
>>>> (always
>>>> displays "loading").
>>>> Can sobdy help please?
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Still-Ajax-and-Struts-2-tf2776835.html#a7759152
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: Still Ajax and Struts 2

Posted by Musachy Barroso <mb...@wfscorp.com>.
You are seeing that error in your server logs right? There's a couple of 
things that we still need to fix for this integration between Struts and 
Dojo, but the application should work anyway.

musachy

walidito wrote:
> thanks, but I get an error with the code you gave me :
> SEVERE: Error setting expr 'dojo.transport' with value
> '[Ljava.lang.String;@179567c'
> ognl.OgnlException: target is null for setProperty(null, "transport",
> [Ljava.lang.String;@179567c)
>
> thanks
>
>
> Musachy Barroso-2 wrote:
>   
>> I think you should take a look at the Struts2/Webwork tutorials 
>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>> http://struts.apache.org/2.x/docs/tutorials.html
>>
>> If you look at the showcase code you will see this for the AjaxTest
>> action:
>>
>> in struts-ajax.xml:
>>
>> <action name="AjaxTest" 
>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>     <result>/ajax/AjaxResult.jsp</result>
>>  </action>
>>
>> in AjaxTestAction.java:
>>
>> public class AjaxTestAction implements Action, Serializable {
>>
>>     private static int counter = 0;
>>     private String data;
>>
>>     public long getServerTime() {
>>         return System.currentTimeMillis();
>>     }
>>
>>     public int getCount() {
>>         return ++counter;
>>     }
>>
>>     public String getData() {
>>         return data;
>>     }
>>
>>     public void setData(String data) {
>>         this.data = data;
>>     }
>>
>>     public String execute() throws Exception {
>>         return SUCCESS;
>>     }
>> }
>>
>> and AjaxResult.jsp:
>>
>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>
>> <%
>>     request.setAttribute("decorator", "none");
>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>> proxy server
>> %>
>>
>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>> <br/>
>> <s:property value="data"/>
>>
>> musachy
>>
>> walidito wrote:
>>     
>>> I,
>>> I wanna run this type of example app :
>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>> :
>>> <s:div
>>> 13:         id="once"
>>> 14:         theme="ajax"
>>> 15:         cssStyle="border: 1px solid yellow;"
>>> 16:         href="/AjaxTest.action"
>>> 17:         delay="5000"
>>> 18:         loadingText="loading...">
>>> 19:     Initial Content
>>> </s:div>
>>>
>>> In other word, a basic ajax component that allows a refreshment of only a
>>> part of my page.
>>>
>>> But I didn't get how to write the corresonding action and action mapping. 
>>> For the moment I've tried to put a "success" return in my action ( is it
>>> enough ?), but I don't see what to put in my action mapping (i mean
>>> inside
>>> the <action name="blablabla" ...> tag. If I put nothing, of course it's
>>> wrong.
>>> If I only put a success-type result, It creates an infinite loop (always
>>> displays "loading").
>>> Can sobdy help please?
>>>   
>>>       
>> ---------------------------------------------------------------------
>> 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: Still Ajax and Struts 2

Posted by walidito <wa...@sgcib.com>.
Hi, 
I'm using Struts 2.0.1 and IE 6.0.2800



Ian Roughley wrote:
> 
> What release of Struts2 are you using and which browsers?
> 
> /Ian
> 
> 
> walidito wrote:
>> thanks, but I get an error with the code you gave me :
>> SEVERE: Error setting expr 'dojo.transport' with value
>> '[Ljava.lang.String;@179567c'
>> ognl.OgnlException: target is null for setProperty(null, "transport",
>> [Ljava.lang.String;@179567c)
>>
>> thanks
>>
>>
>> Musachy Barroso-2 wrote:
>>   
>>> I think you should take a look at the Struts2/Webwork tutorials 
>>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>>> http://struts.apache.org/2.x/docs/tutorials.html
>>>
>>> If you look at the showcase code you will see this for the AjaxTest
>>> action:
>>>
>>> in struts-ajax.xml:
>>>
>>> <action name="AjaxTest" 
>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>>     <result>/ajax/AjaxResult.jsp</result>
>>>  </action>
>>>
>>> in AjaxTestAction.java:
>>>
>>> public class AjaxTestAction implements Action, Serializable {
>>>
>>>     private static int counter = 0;
>>>     private String data;
>>>
>>>     public long getServerTime() {
>>>         return System.currentTimeMillis();
>>>     }
>>>
>>>     public int getCount() {
>>>         return ++counter;
>>>     }
>>>
>>>     public String getData() {
>>>         return data;
>>>     }
>>>
>>>     public void setData(String data) {
>>>         this.data = data;
>>>     }
>>>
>>>     public String execute() throws Exception {
>>>         return SUCCESS;
>>>     }
>>> }
>>>
>>> and AjaxResult.jsp:
>>>
>>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>>
>>> <%
>>>     request.setAttribute("decorator", "none");
>>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>>> proxy server
>>> %>
>>>
>>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>>> <br/>
>>> <s:property value="data"/>
>>>
>>> musachy
>>>
>>> walidito wrote:
>>>     
>>>> I,
>>>> I wanna run this type of example app :
>>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>>> :
>>>> <s:div
>>>> 13:         id="once"
>>>> 14:         theme="ajax"
>>>> 15:         cssStyle="border: 1px solid yellow;"
>>>> 16:         href="/AjaxTest.action"
>>>> 17:         delay="5000"
>>>> 18:         loadingText="loading...">
>>>> 19:     Initial Content
>>>> </s:div>
>>>>
>>>> In other word, a basic ajax component that allows a refreshment of only
>>>> a
>>>> part of my page.
>>>>
>>>> But I didn't get how to write the corresonding action and action
>>>> mapping. 
>>>> For the moment I've tried to put a "success" return in my action ( is
>>>> it
>>>> enough ?), but I don't see what to put in my action mapping (i mean
>>>> inside
>>>> the <action name="blablabla" ...> tag. If I put nothing, of course it's
>>>> wrong.
>>>> If I only put a success-type result, It creates an infinite loop
>>>> (always
>>>> displays "loading").
>>>> Can sobdy help please?
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Still-Ajax-and-Struts-2-tf2776835.html#a7758605
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: Still Ajax and Struts 2

Posted by Ian Roughley <ia...@fdar.com>.
What release of Struts2 are you using and which browsers?

/Ian


walidito wrote:
> thanks, but I get an error with the code you gave me :
> SEVERE: Error setting expr 'dojo.transport' with value
> '[Ljava.lang.String;@179567c'
> ognl.OgnlException: target is null for setProperty(null, "transport",
> [Ljava.lang.String;@179567c)
>
> thanks
>
>
> Musachy Barroso-2 wrote:
>   
>> I think you should take a look at the Struts2/Webwork tutorials 
>> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
>> http://struts.apache.org/2.x/docs/tutorials.html
>>
>> If you look at the showcase code you will see this for the AjaxTest
>> action:
>>
>> in struts-ajax.xml:
>>
>> <action name="AjaxTest" 
>> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>>     <result>/ajax/AjaxResult.jsp</result>
>>  </action>
>>
>> in AjaxTestAction.java:
>>
>> public class AjaxTestAction implements Action, Serializable {
>>
>>     private static int counter = 0;
>>     private String data;
>>
>>     public long getServerTime() {
>>         return System.currentTimeMillis();
>>     }
>>
>>     public int getCount() {
>>         return ++counter;
>>     }
>>
>>     public String getData() {
>>         return data;
>>     }
>>
>>     public void setData(String data) {
>>         this.data = data;
>>     }
>>
>>     public String execute() throws Exception {
>>         return SUCCESS;
>>     }
>> }
>>
>> and AjaxResult.jsp:
>>
>> <%@ taglib prefix="s" uri="/struts-tags" %>
>>
>> <%
>>     request.setAttribute("decorator", "none");
>>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>>     response.setDateHeader ("Expires", 0); //prevents caching at the 
>> proxy server
>> %>
>>
>> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
>> <br/>
>> <s:property value="data"/>
>>
>> musachy
>>
>> walidito wrote:
>>     
>>> I,
>>> I wanna run this type of example app :
>>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>>> :
>>> <s:div
>>> 13:         id="once"
>>> 14:         theme="ajax"
>>> 15:         cssStyle="border: 1px solid yellow;"
>>> 16:         href="/AjaxTest.action"
>>> 17:         delay="5000"
>>> 18:         loadingText="loading...">
>>> 19:     Initial Content
>>> </s:div>
>>>
>>> In other word, a basic ajax component that allows a refreshment of only a
>>> part of my page.
>>>
>>> But I didn't get how to write the corresonding action and action mapping. 
>>> For the moment I've tried to put a "success" return in my action ( is it
>>> enough ?), but I don't see what to put in my action mapping (i mean
>>> inside
>>> the <action name="blablabla" ...> tag. If I put nothing, of course it's
>>> wrong.
>>> If I only put a success-type result, It creates an infinite loop (always
>>> displays "loading").
>>> Can sobdy help please?
>>>   
>>>       
>> ---------------------------------------------------------------------
>> 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: Still Ajax and Struts 2

Posted by walidito <wa...@sgcib.com>.
thanks, but I get an error with the code you gave me :
SEVERE: Error setting expr 'dojo.transport' with value
'[Ljava.lang.String;@179567c'
ognl.OgnlException: target is null for setProperty(null, "transport",
[Ljava.lang.String;@179567c)

thanks


Musachy Barroso-2 wrote:
> 
> I think you should take a look at the Struts2/Webwork tutorials 
> http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
> http://struts.apache.org/2.x/docs/tutorials.html
> 
> If you look at the showcase code you will see this for the AjaxTest
> action:
> 
> in struts-ajax.xml:
> 
> <action name="AjaxTest" 
> class="org.apache.struts2.showcase.ajax.AjaxTestAction">
>     <result>/ajax/AjaxResult.jsp</result>
>  </action>
> 
> in AjaxTestAction.java:
> 
> public class AjaxTestAction implements Action, Serializable {
> 
>     private static int counter = 0;
>     private String data;
> 
>     public long getServerTime() {
>         return System.currentTimeMillis();
>     }
> 
>     public int getCount() {
>         return ++counter;
>     }
> 
>     public String getData() {
>         return data;
>     }
> 
>     public void setData(String data) {
>         this.data = data;
>     }
> 
>     public String execute() throws Exception {
>         return SUCCESS;
>     }
> }
> 
> and AjaxResult.jsp:
> 
> <%@ taglib prefix="s" uri="/struts-tags" %>
> 
> <%
>     request.setAttribute("decorator", "none");
>     response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
>     response.setHeader("Pragma","no-cache"); //HTTP 1.0
>     response.setDateHeader ("Expires", 0); //prevents caching at the 
> proxy server
> %>
> 
> Result: <s:property value="count"/> @ <s:property value="serverTime"/>
> <br/>
> <s:property value="data"/>
> 
> musachy
> 
> walidito wrote:
>> I,
>> I wanna run this type of example app :
>> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
>> :
>> <s:div
>> 13:         id="once"
>> 14:         theme="ajax"
>> 15:         cssStyle="border: 1px solid yellow;"
>> 16:         href="/AjaxTest.action"
>> 17:         delay="5000"
>> 18:         loadingText="loading...">
>> 19:     Initial Content
>> </s:div>
>>
>> In other word, a basic ajax component that allows a refreshment of only a
>> part of my page.
>>
>> But I didn't get how to write the corresonding action and action mapping. 
>> For the moment I've tried to put a "success" return in my action ( is it
>> enough ?), but I don't see what to put in my action mapping (i mean
>> inside
>> the <action name="blablabla" ...> tag. If I put nothing, of course it's
>> wrong.
>> If I only put a success-type result, It creates an infinite loop (always
>> displays "loading").
>> Can sobdy help please?
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/Still-Ajax-and-Struts-2-tf2776835.html#a7748842
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: Still Ajax and Struts 2

Posted by Musachy Barroso <mb...@wfscorp.com>.
I think you should take a look at the Struts2/Webwork tutorials 
http://www.opensymphony.com/webwork/wikidocs/Tutorial.html and 
http://struts.apache.org/2.x/docs/tutorials.html

If you look at the showcase code you will see this for the AjaxTest action:

in struts-ajax.xml:

<action name="AjaxTest" 
class="org.apache.struts2.showcase.ajax.AjaxTestAction">
    <result>/ajax/AjaxResult.jsp</result>
 </action>

in AjaxTestAction.java:

public class AjaxTestAction implements Action, Serializable {

    private static int counter = 0;
    private String data;

    public long getServerTime() {
        return System.currentTimeMillis();
    }

    public int getCount() {
        return ++counter;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String execute() throws Exception {
        return SUCCESS;
    }
}

and AjaxResult.jsp:

<%@ taglib prefix="s" uri="/struts-tags" %>

<%
    request.setAttribute("decorator", "none");
    response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0); //prevents caching at the 
proxy server
%>

Result: <s:property value="count"/> @ <s:property value="serverTime"/>
<br/>
<s:property value="data"/>

musachy

walidito wrote:
> I,
> I wanna run this type of example app :
> http://www.planetstruts.org/struts2-showcase/viewSource.action?page=/ajax/remotediv/example1.jsp 
> :
> <s:div
> 13:         id="once"
> 14:         theme="ajax"
> 15:         cssStyle="border: 1px solid yellow;"
> 16:         href="/AjaxTest.action"
> 17:         delay="5000"
> 18:         loadingText="loading...">
> 19:     Initial Content
> </s:div>
>
> In other word, a basic ajax component that allows a refreshment of only a
> part of my page.
>
> But I didn't get how to write the corresonding action and action mapping. 
> For the moment I've tried to put a "success" return in my action ( is it
> enough ?), but I don't see what to put in my action mapping (i mean inside
> the <action name="blablabla" ...> tag. If I put nothing, of course it's
> wrong.
> If I only put a success-type result, It creates an infinite loop (always
> displays "loading").
> Can sobdy help please?
>   


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