Re: Live search with Dojo (Ajax) and Struts 2
step1. google.com step2 search with autocomplete + dojo On 7 April 2010 01:15, Celinio Fernandes wrote: > Hi, > I am using Struts 2.1.8 and the Dojo plugin. > What i am trying to realize is the following : > the user has to fill a field that corresponds to a REFERENCEID. I want to > help that user to type in the REFERENCEID > by suggesting 20 REFERENCEID as soon as he types in a digit. > For instance, if he types in 1, i want to make a SQL request in the > database and bring the 20 first REFERENCEID that start with 1. > Then if the user types 13, i do another SQL request and bring the 20 first > REFERENCEID that start with 13. > And so on. > > Has anyone done that ? I would be interested in sample code. > > Is there a component in Dojo that already does that ? > > I am looking for something a bit like this demo with Ext JS : > http://www.extjs.com/deploy/dev/examples/form/forum-search.html > > Also, does that field have to be a combobox ? can it be a text input > ()? > If it is a text input tag, where do i display the result (20 suggestions) ? > In a DIV ? > > > I am using Struts 2 which, as you know, comes with a nice plugin for Dojo. > So I have and tags at my disposal. > > Thanks for helping with sample code or any suggestion that might help. > > >
Live search with Dojo (Ajax) and Struts 2
Hi, I am using Struts 2.1.8 and the Dojo plugin. What i am trying to realize is the following : the user has to fill a field that corresponds to a REFERENCEID. I want to help that user to type in the REFERENCEID by suggesting 20 REFERENCEID as soon as he types in a digit. For instance, if he types in 1, i want to make a SQL request in the database and bring the 20 first REFERENCEID that start with 1. Then if the user types 13, i do another SQL request and bring the 20 first REFERENCEID that start with 13. And so on. Has anyone done that ? I would be interested in sample code. Is there a component in Dojo that already does that ? I am looking for something a bit like this demo with Ext JS : http://www.extjs.com/deploy/dev/examples/form/forum-search.html Also, does that field have to be a combobox ? can it be a text input ()? If it is a text input tag, where do i display the result (20 suggestions) ? In a DIV ? I am using Struts 2 which, as you know, comes with a nice plugin for Dojo. So I have and tags at my disposal. Thanks for helping with sample code or any suggestion that might help.
Re: ajax and struts 2
read my mail... on the serverside you can use WebContextFactory.get().getSession() David Harland wrote: Im using DWR. The problem is that the java class that the javascript talks to does not have access to the session. What would be better would be for the dwr javascript to talk to an action. -Original Message- From: Lance [mailto:[EMAIL PROTECTED] Sent: 13 April 2007 16:35 To: Struts Users Mailing List Subject: Re: ajax and struts 2 ew... that sounds icky! have you considered DWR, it marshalls calls from javascript to java then marshalls the result back into javascript objects for you. http://getahead.org/dwr/overview/dwr on the serverside you can use WebContextFactory.get().getSession() Mahesh Parab wrote: Hi David, u can able to read the session variable in javascript, e.g var intId intId='<%=session.getValue("id")%>' ; try this , Thanks, mahesh. On 4/12/07, David Harland <[EMAIL PROTECTED]> wrote: I am new to ajax and have just written my first ajax function. In my function I am passing a user id into the function and are being returned a List of Contacts to populate a select. Presently I am putting the id in a hidden field in the jsp and then passing it from there. What I would prefer to do is have the javascript function call an action so that the Java code can access the user id from the session. How do I do this please? Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - -- ML {UFI} __ Ufi Limited Registered in England No. 3980770 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP learndirect Solutions Ltd Registered in England No. 5081669 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP UFI Charitable Trust Registered in England No. 3658378 Registered Charity No. 1081028 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP This email has been scanned by the MessageLabs Email Security System. __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ajax and struts 2
Thanks Dave, I think that is exactly what I was looking for. -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: 13 April 2007 16:54 To: Struts Users Mailing List Subject: RE: ajax and struts 2 --- David Harland <[EMAIL PROTECTED]> wrote: > Im using DWR. The problem is that the java class that the javascript > talks to does not have access to > the session. http://getahead.org/dwr-demo/javadoc/uk/ltd/getahead/dwr/WebContext.html But there are better ways to handle this in S2. d. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - -- ML {UFI} __ Ufi Limited Registered in England No. 3980770 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP learndirect Solutions Ltd Registered in England No. 5081669 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP UFI Charitable Trust Registered in England No. 3658378 Registered Charity No. 1081028 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP This email has been scanned by the MessageLabs Email Security System. __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ajax and struts 2
--- David Harland <[EMAIL PROTECTED]> wrote: > Im using DWR. The problem is that the java class > that the javascript talks to does not have access to > the session. http://getahead.org/dwr-demo/javadoc/uk/ltd/getahead/dwr/WebContext.html But there are better ways to handle this in S2. d. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: ajax and struts 2
Im using DWR. The problem is that the java class that the javascript talks to does not have access to the session. What would be better would be for the dwr javascript to talk to an action. -Original Message- From: Lance [mailto:[EMAIL PROTECTED] Sent: 13 April 2007 16:35 To: Struts Users Mailing List Subject: Re: ajax and struts 2 ew... that sounds icky! have you considered DWR, it marshalls calls from javascript to java then marshalls the result back into javascript objects for you. http://getahead.org/dwr/overview/dwr on the serverside you can use WebContextFactory.get().getSession() Mahesh Parab wrote: > Hi David, > u can able to read the session variable in javascript, e.g var intId > intId='<%=session.getValue("id")%>' ; > > try this , > > Thanks, > mahesh. > > On 4/12/07, David Harland <[EMAIL PROTECTED]> wrote: >> >> I am new to ajax and have just written my first ajax function. In my >> function I am passing a user id into the function and are being >> returned a List of Contacts to populate a select. Presently I am >> putting the id in a hidden field in the jsp and then passing it from >> there. What I would prefer to do is have the javascript function call >> an action so that the Java code can access the user id from the >> session. >> >> How do I do this please? >> >> >> >> >> Don't be flakey. Get Yahoo! Mail for Mobile and always stay >> connected to friends.http://mobile.yahoo.com/mail >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - -- ML {UFI} __ Ufi Limited Registered in England No. 3980770 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP learndirect Solutions Ltd Registered in England No. 5081669 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP UFI Charitable Trust Registered in England No. 3658378 Registered Charity No. 1081028 Registered Office: Dearing House, 1 Young Street, Sheffield, S1 4UP This email has been scanned by the MessageLabs Email Security System. __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax and struts 2
ew... that sounds icky! have you considered DWR, it marshalls calls from javascript to java then marshalls the result back into javascript objects for you. http://getahead.org/dwr/overview/dwr on the serverside you can use WebContextFactory.get().getSession() Mahesh Parab wrote: Hi David, u can able to read the session variable in javascript, e.g var intId intId='<%=session.getValue("id")%>' ; try this , Thanks, mahesh. On 4/12/07, David Harland <[EMAIL PROTECTED]> wrote: I am new to ajax and have just written my first ajax function. In my function I am passing a user id into the function and are being returned a List of Contacts to populate a select. Presently I am putting the id in a hidden field in the jsp and then passing it from there. What I would prefer to do is have the javascript function call an action so that the Java code can access the user id from the session. How do I do this please? Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax and struts 2
Hi David, u can able to read the session variable in javascript, e.g var intId intId='<%=session.getValue("id")%>' ; try this , Thanks, mahesh. On 4/12/07, David Harland <[EMAIL PROTECTED]> wrote: I am new to ajax and have just written my first ajax function. In my function I am passing a user id into the function and are being returned a List of Contacts to populate a select. Presently I am putting the id in a hidden field in the jsp and then passing it from there. What I would prefer to do is have the javascript function call an action so that the Java code can access the user id from the session. How do I do this please? Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax and struts 2
Good Morning David- I would start with looking at the ajax examples from struts2-showcase-2.0.6 and find the example which mostly closely exemplifies your task for example example7 illustrates population of a div tag in your form and if you run struts from localhost on port 8080 you can view results at http://localhost:8080/struts2-showcase-2.0.6/viewSource.action?page=/ajax/remotediv/example7.jsp Note that In your WEB-INF/classes/struts-ajax.xml note the specification onf testjs.jsp which will store the results /ajax/testjs.jsp /ajax/testjs.jsp HTH Martin This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: "David Harland" <[EMAIL PROTECTED]> To: "struts" <[EMAIL PROTECTED]> Sent: Thursday, April 12, 2007 2:14 AM Subject: ajax and struts 2 I am new to ajax and have just written my first ajax function. In my function I am passing a user id into the function and are being returned a List of Contacts to populate a select. Presently I am putting the id in a hidden field in the jsp and then passing it from there. What I would prefer to do is have the javascript function call an action so that the Java code can access the user id from the session. How do I do this please? Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax and struts 2
Did you realize about use struts tags? Inside an Action you can use ActionContext.getContext().getSession() to get a Map that represents the session. If you can't use Struts tags, then you can use DWR, but I don't know how to get session using DWR. Good Look. Felipe David Harland wrote: > > I am new to ajax and have just written my first ajax function. In my > function I am passing a user id into the function and are being returned a > List of Contacts to populate a select. Presently I am putting the id in a > hidden field in the jsp and then passing it from there. What I would > prefer to do is have the javascript function call an action so that the > Java code can access the user id from the session. > > How do I do this please? > > > > > Don't be flakey. Get Yahoo! Mail for Mobile and always stay > connected to friends.http://mobile.yahoo.com/mail > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/ajax-and-struts-2-tf3563636.html#a9958559 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ajax and struts 2
I am new to ajax and have just written my first ajax function. In my function I am passing a user id into the function and are being returned a List of Contacts to populate a select. Presently I am putting the id in a hidden field in the jsp and then passing it from there. What I would prefer to do is have the javascript function call an action so that the Java code can access the user id from the session. How do I do this please? Don't be flakey. Get Yahoo! Mail for Mobile and always stay connected to friends.http://mobile.yahoo.com/mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
>>>>>>>>> >>>>>>>>> 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: @ >>>>>>>> value="serverTime"/> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> 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 >>>>>>>>>> >>>>>>>>>> : >>>>>>>>>> >>>>>>>>> 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 >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> 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 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: [EMAIL PROTECTED] >>>>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> - >>>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> - >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: /JSPs/Menu.jsp and the jsp : ... ... hhookayy 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: Initial Content 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: @ 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 "", 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: class="org.apache.struts2.showcase.ajax.AjaxTestAction"> /ajax/AjaxResult.jsp 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: @ musachy walidito wrote:
Re: Still Ajax and Struts 2
> 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: >>>>>>> >>>>>>> >>>>>> class="org.apache.struts2.showcase.ajax.AjaxTestAction"> >>>>>>> /ajax/AjaxResult.jsp >>>>>>> >>>>>>> >>>>>>> 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: @ >>>>>> value="serverTime"/> >>>>>>> >>>>>>> >>>>>>> >>>>>>> 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 >>>>>>>> >>>>>>>> : >>>>>>>> >>>>>>> 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 >>>>>>>> >>>>>>>> >>>>>>>> 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 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: [EMAIL PROTECTED] >>>>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> - >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: Initial Content 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: @ 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 "", 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: class="org.apache.struts2.showcase.ajax.AjaxTestAction"> /ajax/AjaxResult.jsp 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: @ 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 : 19: Initial Content 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
ic 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: @ >>>>> >>>>> >>>>> >>>>> 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 >>>>>> >>>>>> : >>>>>> >>>>> 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 >>>>>> >>>>>> >>>>>> 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 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: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
That needs to be fixed in struts, this is the jira ticket: https://issues.apache.org/struts/browse/WW-1551 from showcase: Initial Content 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: @ 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 "", 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: class="org.apache.struts2.showcase.ajax.AjaxTestAction"> /ajax/AjaxResult.jsp 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: @ 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 : 19: Initial Content 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: @ 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 "", 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: >>> >>> >> class="org.apache.struts2.showcase.ajax.AjaxTestAction"> >>> /ajax/AjaxResult.jsp >>> >>> >>> 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: @ >>> >>> >>> >>> 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 >>>> >>>> : >>>> >>> 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 >>>> >>>> >>>> I
Re: Still Ajax and Struts 2
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: >>> >>> >> class="org.apache.struts2.showcase.ajax.AjaxTestAction"> >>> /ajax/AjaxResult.jsp >>> >>> >>> 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: @ >>> >>> >>> >>> 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 >>>> >>>> : >>>> >>> 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 >>>> >>>> >>>> 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 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: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: class="org.apache.struts2.showcase.ajax.AjaxTestAction"> /ajax/AjaxResult.jsp 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: @ 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 : 19: Initial Content 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: class="org.apache.struts2.showcase.ajax.AjaxTestAction"> /ajax/AjaxResult.jsp 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: @ 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 : 19: Initial Content 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: > > class="org.apache.struts2.showcase.ajax.AjaxTestAction"> > /ajax/AjaxResult.jsp > > > 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: @ > > > > 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 >> >> : >> > 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 >> >> >> 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 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Still Ajax and Struts 2
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: class="org.apache.struts2.showcase.ajax.AjaxTestAction"> /ajax/AjaxResult.jsp 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: @ 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 : 19: Initial Content 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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 : 19: Initial Content 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 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]