Re: JavaScript / AJAX + Struts 2?

2009-12-18 Thread Brian Thompson
On Fri, Dec 18, 2009 at 6:37 AM, Jim Collings wrote: > Here is the answer that I was provided & used: > > 1. You can use the ${somethingFromTheValueStack} notation like so: > > onclick="onjavaScriptMethod('${value}');" > > I tried this but missed the ' marks because it's been so long since I > di

Re: JavaScript / AJAX + Struts 2?

2009-12-18 Thread Jim Collings
Here is the answer that I was provided & used: 1. You can use the ${somethingFromTheValueStack} notation like so: onclick="onjavaScriptMethod('${value}');" I tried this but missed the ' marks because it's been so long since I did any JavaScript. I haven't tried this trick in an actual embedded s

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Brian Thompson
Thanks :) Oh, and to the OP ... my (somewhat sloppy) pseudocode is only one way to do it. You could also set up Ajax calls to get data in JSON format from the server. It's simpler to start out by writing javascript values for whatever you need from the value stack, though. -Brian On Thu, Dec

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread dusty
I like how code is declared #fail because there probably is not a toString method. lawl. Please do not be distractedBrian's code was a perfectly good example. Brian Thompson-5 wrote: > > In context of the other two examples, you're right; I should have used > something like > > var foo

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Brian Thompson
In context of the other two examples, you're right; I should have used something like var foo = ; //int, boolean, etc. instead to be more clear. The lack of quotes was deliberate, though ... you wouldn't want to quote a numeric value when you're setting it up that way. -Brian 2009/12/17 Pawe

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Paweł Wielgus
Hi Brian, i din't notice that it is a continuation of comment, so You are wright. As for first assignement, there are no ' or " chars around scriptlet so it will not work because most probably there is no variable named as the foo's toString value. Second and third assignement has them an will work

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Brian Thompson
TBH, I just wrote it as a quick "off the top of my head" example. The basic structure is sound, though -- I did that sort of thing all the time in my struts project earlier this year. What do you think is wrong with it? n.b. "foo.getBat()" does not belong on its own line - it's part of the "//st

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Paweł Wielgus
Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = ; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson : > Bwuh?  Just because your fridge doesn't have a buil

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Paweł Wielgus
Hi James, the code You have shown is generating java script on server side, and then on browser side you run it in browser. For example You can't do this: var myList = ''; myList.toUpperCase(); and expect that on server side inside action, zipCodes variable is updated with new uppereCased value. A

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Johannes Geppert
Hello Jim, if you like to use AJAX with struts2 take a look at the build in dojo plugin or to one of the other (jquery, yui) plugins you can found in the Plugin Registry. http://cwiki.apache.org/S2PLUGINS/home.html Best Regards Johannes Geppert jcllings wrote: > > So I have two actions and

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread john feng
You can use the action to get data from server to display in the thru JS. e.g., in your jsp, user selects a dropdown element of country name, then it will get the state/province names data to be displayed in the . You can invoke an action for the dropdown value-change event to get the data back (s

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Brian Thompson
Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: var foo = ; //int, bool

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread james billa
Pawel, I am doing something like shown below and it works good for me. Isn't it calling the values from model/stack value from java script? zipCodes is in my model. Please tell me ur option. that would help me underst it better. I am using struts 2.1.6. Thanks. function showmylist() { var myL

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Jim Collings
So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus : > Hi Jim, > action is on server side and javascript is on browser side, > they don't interact, You can generate js server side but that's it. > Js will be run in browser so it

Re: JavaScript / AJAX + Struts 2?

2009-12-17 Thread Paweł Wielgus
Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings : > So I have two actions an

JavaScript / AJAX + Struts 2?

2009-12-17 Thread Jim Collings
So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To

Re: AJAX + Struts, IE Problem

2006-09-22 Thread Daniel Chacón Sánchez
Yeap, I try the two solutions, give the url a random number (don´t work for me, but for many people did) and use the 3 lines that I put on a previus mail for no caching, that works for me. Thanks 2006/9/22, Francesco Azzola <[EMAIL PROTECTED]>: It is possible to append ad the URL end a random

Re: AJAX + Struts, IE Problem

2006-09-22 Thread Francesco Azzola
It is possible to append ad the URL end a random number to avoid cache problems. I tried it and it works fine with IE and FireFox. Bye F. __ Do You Yahoo!? Poco spazio e tanto spam? Yahoo! Mail ti protegge dallo spam e ti da tanto spazio gratuito

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
I made it, in fact was a cache problem: <% 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 %> With that my application ran on IExplorer, thanks all for the

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Chris Pratt
Why not do a post? It's not any harder. You just have to add one extra line and move the arguments from the URL to the send: ajax.open("POST","/GetCustomers.aspx",true); ajax.setRequestHeader ("Content-Type","application/x-www-form-urlencoded"); ajax.onreadystatechange = fu

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
alredy do the url change, I'm reading this: http://www.enja.org/david/?p=25 Click Here function uncache(url,form){ var d = new Date(); var time = d.getTime(); url += '&time='+time; retrieveURL(url,form); } I will keep reading

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
Frank ist seams like it's a caching problem This is a note for myself but it could be useful for anybody writing some Ajax calls. If you use a GET method to send an asynchronous request to your server side code, if you don't do anything Internet Explorer will cache locally your request, so obvio

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Frank W. Zammetti
Gotta give me some time, I have work to do to you know :) Are you asking for a complete AJAX project? If so, take a look at struts.sourceforge.net, where you'll find AjaxChat. Or are you asking for a client-side logging implementation? Frank -- Frank W. Zammetti Founder and Chief Software A

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Chris Pratt
Instead of rolling your own AJAX object (which seems to be all the craze in books and magazines). I'd look at something like Sarissa, it's tried and true and it's whole purpose in life is to bring cross browser support to AJAX. (*Chris*) On 9/21/06, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wro

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
Frank?? 2006/9/21, Daniel Chacón Sánchez <[EMAIL PROTECTED]>: Thanks Frank, obviously I made test and used alerts and saw lines numbers and I didn´t found the error. Of that 100 implementions that I can quickly find in Google, can you give me two links (more if possible), to make that an appli

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
Thanks Frank, obviously I made test and used alerts and saw lines numbers and I didn´t found the error. Of that 100 implementions that I can quickly find in Google, can you give me two links (more if possible), to make that an application that was made in struts, and it's already finnished, in wh

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Frank W. Zammetti
Have you dont some basic troubleshooting yet? Things as simple as throwing some alerts() in various functions and between various lines and seeing where it fails? If you have Visual Studio installed, you'll have a full debugger, which can help, but without that it's a bit trickier on IE... you ca

Re: AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
Sorry, the problem is the same on IE 7 and IE 6, so is not a version problem. And I don´t receive a javascript error, that was for something else that I alredy fix, someone, any help?? 2006/9/21, Daniel Chacón Sánchez <[EMAIL PROTECTED]>: Hi all, I'm using struts with AJAX I introduced Ajax t

AJAX + Struts, IE Problem

2006-09-21 Thread Daniel Chacón Sánchez
Hi all, I'm using struts with AJAX I introduced Ajax to my struts application based on the article: *"**Sprinkle Some AJAX Magic in Your Struts Web Application" http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-struts-webapp.html?page=1 * I use the ajax javascript and the fu

Re: AJAX + Struts problem on IE 7

2006-09-09 Thread Frank W. Zammetti
Daniel Chacón Sánchez wrote: Ok I will try with alerts, but is something strange, beacause it works perfectly with firefox and netscape, any other idea? Not really strange though because IE7 is largely an unknown quantity... I don't know too many people that have tested code against it yet (I

Re: AJAX + Struts problem on IE 7

2006-09-09 Thread Daniel Chacón Sánchez
Ok I will try with alerts, but is something strange, beacause it works perfectly with firefox and netscape, any other idea? Some time ago I send a mail to [EMAIL PROTECTED]<[EMAIL PROTECTED]> (author of the article), but doesn´t respond, someone else use this artilcle to use ajax?

Re: AJAX + Struts problem on IE 7

2006-09-09 Thread Frank W. Zammetti
Have you figured out which line of code is causing the error? Some alert()'s sprinkled in are in order. You've probably found an IE7 compatibility issue, I for one would be very interested to know what it is. Frank Daniel Chacón Sánchez wrote: Hi all, I'm using struts with AJAX I introduc

AJAX + Struts problem on IE 7

2006-09-09 Thread Daniel Chacón Sánchez
Hi all, I'm using struts with AJAX I introduced Ajax to my struts application based on the article: *"**Sprinkle Some AJAX Magic in Your Struts Web Application" http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-struts-webapp.html?page=1 * I use the ajax javascript and the fu

Re: AJAX + Struts

2006-08-22 Thread Frank W. Zammetti
In short: it depends on what your passing in to the server. If you do regular POSTs and GETs, you can write Actions, just like always, there is zero difference. If you want to pass JSON or XML, then you'll have to add some code to handle that, either modifying the RP (or RP chain in 1.3), or else

Re: AJAX + Struts

2006-08-22 Thread Nikhil Walvekar
Hello, I have some questions, what should be used on server side? we send XMLHttpRequest from client it should be received in action or we have to write servlet to process it? If we can use action, then what should be forward for that action. Thanks and Regards, Nikhil On 8/22/06, Puneet Lakh

Re: AJAX + Struts

2006-08-22 Thread Puneet Lakhina
http://wiki.apache.org/struts/AjaxStruts. There is a lot of fantastic info there.. thanks!!! -- Puneet

Re: AJAX + Struts

2006-08-22 Thread Bart Busschots
Go to Google, type in "Ajax struts" and RTFM. Just looking at the first page of results I'd strongly suggest reading http://wiki.apache.org/struts/AjaxStruts. A.Mohan wrote: Dear All, How can i use Ajax with struts , Thanks and R

AJAX + Struts

2006-08-22 Thread A.Mohan
Dear All, How can i use Ajax with struts , Thanks and Regards Mohan - Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail.

Announcement: Ajax/Struts article & Wiki update

2005-04-01 Thread Frank W. Zammetti
Evening all, I just completed an article and sample webapp to go along with it about using the Ajax concept (XMLHttpRequest) with Struts. I've posted a link off the Wiki front page and started a new Wiki page that I hope others will expand upon over time. The idea is to share interesting ways