PDA

View Full Version : Whats the best way to exchange parameters between jsp and js files?



mbalusu
20 Feb 2008, 12:29 PM
So I have written a beautiful mockup which everybody loves in my company. I used JQuery+ExtJS. Now I am converting the html pages into jsp files and I use a lot of scriplets in my jsp files. The question is now can I access jsp page imports from js file or is the access between these 2 files just one way. Call functions in js files with scriplet (<%=IJobServlet.Action%>) values as parameters?

I have a lot of grid's that take JSON data, so make the call to the servlet in the jsp file and then pass the json file to the js file so that it fills the grid? Somehow this seems to defeat the purpose of scripts in js files? Yes, I am new to jsp/js world...

Please post some thoughts...I am sure you all have figured this out by now...

Thanks!

mbalusu
21 Feb 2008, 6:35 PM
bump

Condor
21 Feb 2008, 11:26 PM
You could generate all your JSON data with taglibs (e.g. json-taglib (http://json-taglib.sourceforge.net/)). This data could either be remote loaded by the store or used directly in the javascript code itself (see the data config option and/or the loadData method of Store).

ps. I prefer not to generate my javascript files with jsp (I only use it for stuff that is stored in the session).