As I've been working with Struts for a little while, I've noticed something. It's almost like working with frames sometimes. I can have a page, say a user details page. The request goes from a JSP to the action then to a details JSP. The URL is not unique for that user.
If a user wants to bookmark that page, the bookmark won't work the next time they use it.
Is there a way to make this work? Something I can change?
In a web application, where you have a flow that the user is supposed to follow, anticipating that the user may bookmark one of the pages and handling it is part of your development strategy.
In the above example, suppose that a user isn't supposed to access the customer home page unless they're logged on. It's up to the developer to put logic in the customerHomeInit action to check for a valid logon and either give an error message or redirect back to the logon page. [ February 22, 2006: Message edited by: Merrill Higginson ]
I appreciate the reply, and in many situations, bookmarking the action is fine. My question is, say you have a page with a search button on it. You type in your search criteria and the JSP goes to your action which build a bean of the results and then through an ActionForward sends to the JSP to display the results.
The bookmark will just be the search.do action, so bookmarking that page of results will not be helpful since the bean of results will not be there next time.
Thanks Merrill. I was thinking that in a normal JSP -> JSP you might just send it as URL parameters and then a bookmark would work. I suppose it might still work OK like this in Struts, but I'm not positive.
I may have to continue to play with it some. I'm just trying to make it easy for my users to send links to another person and have it work. I guess if I sent it over using URL parameters...
Thanks for the suggestions. I'll send it via GET instead. Probably a question that should be in the servlet forum, but quickly, is there a guideline on when GET should be used over POST (other than already discussed)? Sorry, probably a very basic servlet question...
The main difference between the get and post methods is visibility. Get passes parameters in the URI, while post passes them in the HTTP headers. In some cases, such as when you're uploading a file, Post is your only option, and generally speaking, post is the best option when using forms. You generally don't want everything that's passed by your form to be visible in the URI.
However, in a case like this where you're doing a serach and you want the search parameters to be visible and available for bookmarking, get is the better option.