views:

90

answers:

2

I am performing UAT on someone else's web-based application. the system is quite large with tens of forms, and hundreds of seperate input fields. Overall it seems well built and usable.

I have noticed one thing that seems very strange to me. Every link I click on actually performs a POST request (containing details of the page I want) to the page I am already on, the response with which is then an HTTP redirect to the page I want. I can understand doing something like this for pages whwre data has been changed - this would allow the system to save data without the user explicitly forcing it. However, this behaviour is also used on pages with no user inputs.

Why is this done? It seems to be intoducing some major slowdowns in the systems.

If it's a help, this system is written using JSF.

+2  A: 

I will not pretend to be a developer who has worked extensively w/ JSF. However, I have created many web applications on other technologies.

Generally speaking, for navigation using POST requests that send extra data does increase the data load and may cause a small slowdown in speed. Generally it is considered best practice for navigation to perform GET requests. POST requests are generally saved for situations where the is an action being performed that requires ancillary data.

Now for POST'ing then receiving a redirect in the response, that is weird and would cause slowdown as you are incurring two network requests instead of one. I would ask, "why not just make the link point to the page I am being reidrected to?". The only answers I could fathom, would be some kind of custom made session management that doesn't use cookies or url session parameters.

There might be more reasons for it, but that type of design seems quite unnecessary and honestly whatever the reason is I am sure there is a better way to implement the system to not do that.

Raegx
Thanks, I was thinking pretty much the same thing - good to know I'm not the only one!
jwoolard
A: 

When you use a <h:commandButton> or <h:commandLink> in your JSF page then it will perform an HTTP POST; never a GET.

If a GET is required then <h:outputLink> should be used, however often developers use the former two tags as they allow the opportunity to call actions before the navigation - ie. before opening some page the developer may want a method in a backing bean to run that sets-up/initialises some variables. So there may be a good reason why the web app is performing POSTs.

If no action is required, for instance if the navigation is a menu, then I'd consider changing to use <h:outputLink> or just use Facelets and regular anchor tags.

Damo