java - HttpServletRequest stored in model gets replaced -


i'm working on legacy code (spring 2.5.x, java 1.5), controller passes http servlet request view this:

     public modelandview handlerequest(httpservletrequest request, httpservletresponse response) throws exception {          map attributes = new hashmap();         attributes.put("httprequest", request);         return new modelandview("/path/to/page.jsp", attributes);      } 

however happens httprequest attribute indeed exist in jsp page context, contains current request (jsp page) , not original (controller). passed request being used extract information url. appears can around problem using bunch of "javax.servlet.forward.*" attributes. puzzles me pretty simple thing , i'd happy work anyways or @ least know why doesn't work now. has ideas?

to begin with, bad idea store request attribute of request. if need specific data current request, can retrieve directly using ${requestcontext}, if need access url, use ${requestcontext.requesturl}. if need access parts of url display in client side, better parse url in server side (controller) first obtaining using stringbuffer url = request.getrequesturl(); , setting required data attributes.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -