How can I prevent a user from neglecting the normal work flow of a struts application? For example, I have a list of products. This products have options like view edit whatever. If you click on edit, you will be redirected to a page like /editProductInfo.do
and there will be no problem if you go there from List and then click edit a bean will be created with the information of the requested product from database.
Now if you are not logged in and try to access this page /editProductInfo.do
you will be asked to log in and if you do so there will be a NullPointerException
because the Bean that is needed to fill the form of this /editProductInfo.do
is not initialized or even created because the application does not even know which product was requested.
So I want to prevent Users from crossjumping from开发者_开发知识库 side to side which has no link to each other. Is this possible in Struts?
Thanks for advice :)
Ah you mention struts 1 :) We successfully used the Struts Workflow Extension for exactly that case. http://www.livinglogic.de/Struts/ It lets you define page flows and lets you react if users atempt to break these flows by reloading, entering URLs, using invalid bookmarks...
Encode the product in the URI; that way you beat both your problem and the problem of two open tabs/windows on different products...
精彩评论