• 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

Which one approach is good for comunicateing data between server and JSP page?

 
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there

I am working on a web application In which I am comunicating between my JSP page and Controller class and database.Let me explain my seneraio

1)I have a section called getAllNews I can get data first call to PageController->Page Controller call DAo and set Object is request->forward it to JSP->JSP parse using JSTL tags+Java Sccript


2)Call for front page to page controller->Page loaded->A AJAX Script will call to server and get the response of server side controller->Parse JSON using JAvaScript


Both way I can acheive same result.
My Question is IS there
1)will be any perfomance difference in two approaches?
2)Which approach is good in which seneraio?

Thanks
 
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
Does the content need to update after the page is loaded? If so, then the Ajax approach is best for that. But for the initial load, you might want to consider pre-loading the page with content so that there's no delay. So, sometimes, the answer is both.

That said, most often I will see Ajax used for the first load as well, which sometimes results in a momentary delay while the first content is loaded.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In My Project like this if a page is first time loaded then I use first approach

And If there any change in page without reloading the web page then I use second approach

is this fine?
 
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Having two approachs for same scenario/functionality is never good idea.
Try implementing suggestion given in above post

But for the initial load, you might want to consider pre-loading the page with content so that there's no delay.

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Abhay
Thanks for suggestion
reply
    Bookmark Topic Watch Topic
  • New Topic