Jul 4th, 2007, 10:01 PM
Controller URLs visible in Browser address bar?
I am facing a problem regarding automatic storage of controller URLs in the browser history. I login to the application using http://localhost:8080/myapp/login.view and then access different pages. In all the JSPs I have used POST as the method for form submission. The problem is if I start typing the application url in the browser address bar, it shows me various controller URLs there like -
I have no idea why all these are getting stored in the browser history. Is there anything which I am missing while submitting the form?
I thought that this was happening due to the usage of RedirectView, since I need to pass control to another controller from one controller, so I was using new ModelAndView(new RedirectView(controllerName)) as the return value in onSubmit method. Since redirect caused a new request to be issued from the browser so I thought this might have been a problem, so I changed the onSubmit return value to new ModelAndView("forward:"+controllerName). But this still does not solve the problem and I still get the various controller calls in the browser address bar.
Can someone please help in this to sort it out.
Thanks in advance!
Jul 4th, 2007, 10:24 PM
the browser is storing the URL's since they are all Http GET,
This is the default behaviour, you can clearing the history and again reopen the browser, it wouldnot remember the urls.
Jul 4th, 2007, 10:29 PM
But I am not making any GET request. In all my forms I have specified the method as POST. I thought sending a Redirect could have been a problem since it would pass a get request, but even changing it to forward does not solve the problem.
Clearing the browser history does it, I dont want the users to see the various controller calls when they type the application URL, so that is the reason I want to avoid it.
Thanks & Regards,
Jul 4th, 2007, 11:25 PM
try using the cache control directives,
you can add cacheSeconds property set it to "0" in the controllers,
you can also try using the <meta http-equiv="Cache-Control" content="NO-CACHE"/> in the head section of the html.
Jul 4th, 2007, 11:45 PM
I tried both the options, but still it continues to work in the same way. My BaseController extends SimpleFormController and in the constructor of my controller, I call super() , since the AbstractFormController makes a call to setCacheSeconds(0); in its constructor.