struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Bacon <keithbaconstr...@yahoo.com>
Subject RE: page do not refresh
Date Tue, 12 Feb 2002 12:16:39 GMT
There was a post the other day mentioning the trick of putting a timestamp in the query string
at
the end of the URL's.

--- Frédéric_Houbie_-_ABSIS-GROUP <jdev@absis-group.be> wrote:
> In fact, the value in the session is ok, but it seems that the proxy is
> caching a lot, because the url inn the browser is the Action servlet name
> instead of JSP page, so the url /Online/TenancySchedule.do is always the
> same and the Actionforward to the jsp is transparent. How can I force the
> proxy to regenerate the jsp page, here is my code
> 
> public class SelectSiteAction extends org.apache.struts.action.Action {
> 
>     /** Creates new LogonAction */
>     public SelectSiteAction() {
>     }
> 
>     public org.apache.struts.action.ActionForward
> perform(org.apache.struts.action.ActionMapping mapping,
> org.apache.struts.action.ActionForm form,
> javax.servlet.http.HttpServletRequest request ,
> javax.servlet.http.HttpServletResponse response) throws java.io.IOException,
> javax.servlet.ServletException {
> 	// Extract attributes we will need
> 	Locale locale = getLocale(request);
> 	MessageResources messages = getResources();
> 
> 	// Validate the request parameters specified by the user
> 	HttpSession session = request.getSession();
> 	ActionErrors errors = new ActionErrors();
>         System.out.println("SelectSiteAction [Start]");
> 
>         String strCellIDParam = request.getParameter("CellID");
>         System.out.println("CellID received in URL " + strCellIDParam);
> 
>         // Report any errors we have discovered back to the original form
> 
>         // Is there a currently logged on user?
> 	reqReoUser reoUser = (reqReoUser) session.getAttribute("User");
> 	if (reoUser  == null) {
>             if (servlet.getDebug() >= 1)
>                 servlet.log(" User is not logged on in session "
>                             + session.getId());
> 	    return (servlet.findForward("logon"));
>         }
>         // Get Datasource configured from struts-config.xml
> 
>         DataSource dataSource = (DataSource)
> servlet.getServletContext().getAttribute(Action.DATA_SOURCE_KEY);
>         java.sql.Connection conn = null;
>         try
>         {
>             // Get a connection to database from the Generic Pool
>             conn = dataSource.getConnection();
>             // Put a session value specifying the Site ID on which every
> report will work
>              if (session.getAttribute("Site") != null)
>                 session.removeAttribute("Site");
>             session.setAttribute("Site", strCellIDParam);
>             System.out.println("Site session value");
>             System.out.println(session.getAttribute("Site"));
>             // Put a request attribute with record of the Site
>             if (session.getAttribute("SiteCard") != null)
>                 session.removeAttribute("SiteCard");
> 
>             session.setAttribute("SiteCard", reqSiteCard.findByCellID(conn,
> Integer.parseInt(strCellIDParam)));
> 
>             DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT,
> locale);
>             session.setAttribute("Today", df.format(new Date()));
> 
>         }
>         catch (SQLException sqle)
>         {
> //            servlet.log(sqle);
>             sqle.printStackTrace();
>             session.setAttribute("SQLError", sqle);
>             return (mapping.findForward("failure"));
>         }
>         finally
>         {
>             try
>             {
>                 conn.close();
>             }
>             catch (SQLException sqle)
>             {
>                 System.out.println(sqle);
>             }
>             conn = null;
> 
>         }
> 
>         System.out.println("SelectSiteAction [End]");
>         return (mapping.findForward("ShowCard"));
>         // Forward control to the specified success URI
>     }
> 
> }
> 
> -----Original Message-----
> From: Max Cooper [mailto:max@maxcooper.com]
> Sent: mardi 12 février 2002 11:19
> To: Struts Users Mailing List
> Subject: Re: page do not refresh
> 
> 
> Frédéric,
> 
> If the query string is different between the two requests, it is not likely
> to be a page caching problem. The query string is part of the URL, so things
> that cache pages by URL will see the two requests as two different URLs.
> 
> Try using the request scope, rather than the session scope, for passing the
> object from your Action to the JSP page. This is preferable unless you need
> to keep the value in the session for some other reason. However, if it does
> need to be in the session, it doesn't seem like the action is replacing the
> value in the session and needs further review (perhaps you could post the
> code that puts/gets the value in the session).
> 
> -Max
> 
> ----- Original Message -----
> From: "Frédéric Houbie - ABSIS-GROUP" <jdev@absis-group.be>
> To: "Struts-User" <struts-user@jakarta.apache.org>
> Sent: Tuesday, February 12, 2002 1:34 AM
> Subject: page do not refresh
> 
> 
> > Hi,
> >
> > I have a problem in my struts application, I have a page that call an
> action
> > servlet which store a value received in url  in session, than forward to a
> > jsp page. If I this action servlet is called with another value in url,
> the
> > jsp page do not change, it seems to come from the proxy. I put expire meta
> > tag in jsp, but no changes, the url in the adress bar is always the .do
> > action. Does it means that I must make the action servlet expire ?
> >
> > I don't understand the process,
> >
> > thanks for help
> >
> > Frédéric houbie
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:struts-user-help@jakarta.apache.org>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message