SJS
SJS

Reputation: 5667

Spring, JSP, Ajax and JQuery how should I model my project?

Spring, JSP, Ajax and JQuery how should I model my project?

In the past I did Spring/Java programming and I made each screen a JSP file. So everytime I need it to display a new screen I did a call to the server and loaded a new JSP.

NOW WITH JQUERY.

I am thinking that using JQuery will make me cut down on the number of JSP pages I have. I can have the JSP page and then use JQuery to change the screen with DIVs to make it look like new pages without going to the server, The only issue is how to I display this?? any easy way

Upvotes: 0

Views: 394

Answers (2)

ejb_guy
ejb_guy

Reputation: 1125

Something that I am doing for my hobby project. I have set of div in my main file. Data for rest of the div are in separate html file (1 file/div). When ever I have to display a div for first time, I load the file using Ajax and if required load the dynamic data required by div in separate call to servlet. JS is also separated in multiple files. THis way no one file is too big or "god" file. Hope this helps

Upvotes: 1

Varun Achar
Varun Achar

Reputation: 15099

I'd recommend your earlier approach. Putting a lot of code into a single JSP page will make it very hard to maintain. But if you really want to go with the new approach you could simply use

$('myDiv').hide();

and

$('myDiv').show();

myDiv will be the parent of the whole section that you want to display/hide

Upvotes: 0

Related Questions