• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

postback model and AJAX

 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My web page is divided into Tabs,Header,Body and Footer.

Tabs : Tabs and their sub tabs . for each tab there is different header and body but for all the subtabs that belong to one tab share same header but body is different.
Header : Header contains couple of drop down boxes. They are being populated from database. One is main combo box and other are filter combo boxes. They filter out records of the main combo box. So this is also DB trip.
Body : No. of elements being populated from database.
Footer : Not much of importance for the question.


Now the flow is,
- I click on one of the Tabs. It loads the header and body for that tab. Now I can move to different sub tabs with different body but same header.

1) Postback Model : If I go with this, the whole page will get refreshed as it is postback model but ideally only the body contents should be changed and whenever I change the combo boxes to filter out the records of main combo box, header would be refreshed but this is not as frequent as move-from-one-tab-to-another. Because of this I thought of using AJAX.

2) AJAX : In this I come out from the issues of postback model and only the body part is getting refreshed. But the way it's been implemented is highly doubtful. We used vanilla AJAX and not any frameworks like scriptaculous,DWR etc. The way programmers are saving the code is, On click of save button, call a JS function that makes the AJAX call. To save, need to get the values of different elements, for that they are doing getElementById. And we have 100s elements in the body so the code gets clumsy,messy. Now If you compare it with postback model, the elements are bound to model/POJO, and we use hibernate, so everything gets saved in one shot.

So both the models have their pros and cons.
I tried my best to be clear and to the point with my question.
I think this is very common scenario. How do you handle this? Am I thinking correct or completely off the road?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic