Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

postback model and AJAX

Vikas Kapoor
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
  • 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?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic