Now, one of the things I like about the Rock-Paper-Scissors application that forwards the user to one of four JSPs, win.jsp, lose.jsp, tie.jsp and failure.jsp, is the fact that it very much emphasizes the ability of Java ServerFaces to manage application flow, and control, based on the programatically determined outcome of a ‘doXYZ’ method of a managed bean, to which page a client will be directed after an interaction with the server.
However, despite my adrogodgical affection for the four or five pages Rock-Paper-Scissors application, I must confess that I think having this many pages is a bit of overkill. After all, why do we need to redirect the user to another page after they have just played a round? Why not return them to the same page, but have different content displayed on the page. That way, we can not only show the user the results of their last game, but also display the form objects, like the textfield and the submit button, that are needed to play again.
So, this is what I’m going to do. I’m going to re-jig the Rock Paper Scissors application to use just one and only one web page – the index.jsp page. And all interactions will return the user to this same JSP, albeit, each time they return, different information will appear.
No comments:
Post a Comment