Problem with simple registration page

Hi all,

I have a simple registration page which users can get to by clicking on a link or by pushing a button. The link is coded as an anchor tag like <a href='...'>register</a>. The button is a h:commandButton and uses JSF navigation.

Either way when the user registers, everything work ok. But as soon as they click on the register link or button again, when they submit the registration form its command buttons action is not called. Debugging into the JSF code, it appears as though JSF is getting the previous state from the session and trying to restore the page, but its not actually restored because the fields are blank when the response is displayed.

Page caching is causing me huge problems. In my experience, you dont want to cache page information at all. If you are working on an enterprise system your pages are normally showing data from say a database. every time that form is refreshed, you want to get your results from the db again, in case they have changed. sure there are cases where you want to cache data, or where you want to save page state. but its not the norm. so how do i get a page to be completely reset after its been submitted?

Cheers,

Ant

[1225 byte] By [ant.kutscheraa] at [2007-10-2 4:38:08]
# 1

OK - I got a step further with my problem.

If it switch off my HTTPS security constraint on the registration page, then the page works exactly as expected. Debugging deeper into JSF it seems that JSF checks if the request parameters are null, and if so just renders the page without calling the action. That makes complete sense. But in my case, what I have submitted does contain a query string (I can see it inside Tomcat code - thats how low level I am debugging!). But when JSF checks if the parameter map in the request is empty, it thinks it is.

As soon as I put my security constraint back and start up tomcat again, it goes back to the old problems...

Any thoughts more than welcome...?

ant.kutscheraa at 2007-7-16 0:11:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

May have solved it...

After playing with a packet sniffer to work out that I was indeed sending post data to the server even though it reckoned I was not, I started to look into Tomcat a bit more and bugs related to lost HTTPS / SSL data.

Then I found this...

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=50&t=005789 which solved it. On IE 6 there is a bug whereby when sending HTTPS requests the post data can be lost. Great huh? So Ive increased the keep alive time in Apache to 60 seconds, although its not really going to help is it? If the user takes more than a minute to submit the request, they will have the same problem. Still, at least I know its not everyone who is affected - only those with IE6 and a certain hotfix...

So, how long have I wasted on this bug? Over a week :-( If only I could charge that consulting time to someone!

ant.kutscheraa at 2007-7-16 0:11:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

In fact, the MS KB article states that setting the keep-alive to 60 seconds will fix the problem because thats what IE is expecting.

After some rigourous testing, I can confirm this seems to have fixed the problem.

Because JSF simply re-renders the page when the request parameters are empty, it was a complete red herring. I assumed that it was related to page caching or something. I cannot tell you all how close I was to dropping JSF in the bin. But I'm sure glad I didn't.

ant.kutscheraa at 2007-7-16 0:11:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
After a month of more development and going live in production, I can confirm that this problem was never seen again. The posts above do indeed solve the problem.
ant.kutscheraa at 2007-7-16 0:11:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...