• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSTL or JQuery plug-ins?

 
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recently ran across jqGrid and it looks super slick. Would you suggest this over JSTL <c:forEach>? The difference would be a servlet returning a list of Beans or a servlet returning JSON. Any ideas on which would be faster? Easier? I currently have both working. Just wondering what you though?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Without having made any direct comparisons, I really can't comment. Seems like a "6 of one" scenario at first guess.

And there's really no JSTL or jQuery debate. I use both. JSTL is still ultra-useful on the server for formatting whatever's going to be retuned to the client, be it a full page or just an HTML fragment requested via Ajax.
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well there's my claim to fame JSTL vs jQuery

haha

if only I can form some hypothesis now. Let the debate begin!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's like debating peanut butter or jelly. Both please!
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, they really are suited for best for different uses. It would be nice though to look at the areas they overlap and see which is better.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There really isn't any overlap. JSTL is used in conjunction with JSP to generate the body of the response sent to the client. jQuery operates on the client to make JavaScript easier to write and manage.

What you may be thinking about really has nothing to do with either technology and that's "do I do everything on the server and fully refresh every page for every action, or do I write a rich Internet application that leverages client-side capabilities".

Such as decision is at a much higher level than what specific technologies one decides to use for server-side templating and client-side DOM manipulation.
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was thinking that I can load a table of data with jQuery, via jqGrid, or I can use JSTL, via <c:forEach>. But the only real difference is whether you pass back a JSON string to jqGrid or a Bean(or in my case a list of beans) in the case of JSTL. What I've done is I actually create the list of beans server side, and instead of setting the Bean(or list) to the session I use StringTree JSON and send that back to the javascript instead.

6 of one half dozen of the other?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DisplayTag is a custom JSP tag library that can do basically what jqGrid does but without AJAX. DisplayTag would do full page refreshing for paging and sorting the data.
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but if it doesn't do AJAX like jqGrid then that kind of limits its usefulness. Its amazing how much I hate full page refreshes now that I've got ajax working. Unless there is some very large significant change to a page then there really isn't a reason to do a full page refresh. In almost all cases AJAX will be quicker, cleaner, and an all around better solution.

Don't mind me too much...I didn't have my morning coffee today....sorry if I grumble a bit...
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bryce Martin:
but if it doesn't do AJAX like jqGrid then that kind of limits its usefulness


What is "it"? JSTL? Even using Ajax, what do you think is the best server-side tool to format the response? JSTL. It doesn't matter if the response is a full page refresh or an HTML fragment that's going to be stuffed into an existing DOM.

So I assert once again that it's never Ajax or JSTL, but AJax and JSTL.

Of course, I may have completely missed your point. I'm pre-caffeine as well.
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was searching around the forums and I ran across this post that I started a few months ago. After working with jqGrid and JSTL a few months more I would like to share what I've found.

Bear, you are right. Its not a matter of JSTL or AJAX, but JSTL and AJAX. I have found that for data that is page specific and won't change while the user is on the page it is best to use JSTL in conjunction with beans to display data from the server. If there is data that needs to change on the page then its probably (in most cases) going to be best to use AJAX to avoid a page refresh.

Thats my story and I'm sticking to it
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bryce Martin:
I was searching around the forums and I ran across this post that I started a few months ago. After working with jqGrid and JSTL a few months more I would like to share what I've found.

Bear, you are right. Its not a matter of JSTL or AJAX, but JSTL and AJAX. I have found that for data that is page specific and won't change while the user is on the page it is best to use JSTL in conjunction with beans to display data from the server. If there is data that needs to change on the page then its probably (in most cases) going to be best to use AJAX to avoid a page refresh.

Thats my story and I'm sticking to it



For the sake of argument I'd only recommend that just because you use jqGrid it doesn't mean you *have* to use all its features (sorting, paging, etc, via Ajax). If it were me (and it has been on past projects) I go for consistency. It's much better, in my opinion, to use the same patters and the same type of code across the board than to mix and match with the caveat that you aren't creating more work on yourself in the process.

It's pretty easy to tell jqGrid to just display some static data that won't change and you get not only the server side consistency but the client side with regards to your javascript and your css.
 
Bryce Martin
Ranch Hand
Posts: 269
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But you don't always want to display the information in a grid. For instance... my user does a search by PO and Cust#. Well when I go to the results page I want to show them their search criteria as well as a few details associated with the given customer they looked up. So I don't need a grid to show the customer name and other details. In fact that would be a little over kill. So I just have a bean I fill on the server and in the JSP I have some divs that reference those variables for display as a header.

Below this header is my grid with its search results. No reason for two grids. It is quicker to do it with one grid and some JSTL as opposed the user seeing two grids loading...

I hope I'm expressing myself clearly...if it wasn't an internal app I'd show you pictures...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic