Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Nov 2006

    Struts with XHTML...Caching

    I am using Struts (server side with JSPs) and XHTML to develop an application.
    On pressing submit in my page the specific action.do gets called and data gets submitted in the database.
    A page gets displayed "Request Successfully Sent"
    Is that if the user now clicks back button of CELL PHONE the same action.do gets called again with the same data, and the data gets submitted again.
    Have tried my best but am not able to remove the data from CACHE.
    have used the following headers in response
    response.setHeader("Cache-Control","no-store,must-revalidate,post-check=0,pre-check=0"); //HTTP 1.1
    response.setHeader("Pragma","no-cache"); //HTTP 1.0
    response.setDateHeader ("Expires", 0);
    and meta tags
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="max-age" content="0">

    However this works fine in the Internet Explorer.
    Problem comes only when I use Nokia 6230i Emulator or any Series 40 Mobile Phone.

    Please help me find a solution.

  2. #2
    Registered User
    Join Date
    Dec 2005
    Johannesburg, South Africa

    Re: Struts with XHTML...Caching

    Goodday !


    Stand to corrrection, but here is a suggestion:

    In the struts-config.xml file, try setting the scope attribute to "request" in the action tag:

    For example, see the code snippet below:

    <action name="loginForm" path="/login" scope="request" type="com.sbsa.gi.wap.actions.authenticate.LoginAction" input="/pages/authenticate/login.jsp">


    Just for information:
    scope="request" allows the data to be submitted to be valid only for a single request.
    scope="session", allows data to be valid for the duration of single session based on user sign-on or time-outs

    Try this, and all the best

    Much appreciated.


  3. #3
    Registered User
    Join Date
    Sep 2005
    Timisoara, Romania

    Re: Struts with XHTML...Caching


    It seems to me like a typical multiple submission problem, check
    for solving this.

    Hope it helps.

    Best Regards

  4. #4
    Registered User
    Join Date
    Dec 2005
    Johannesburg, South Africa

    Thumbs up Re: Struts with XHTML...Caching

    Good article. The saveToken() method should resolve this in Struts.

    Just for interest, we had the exact same problem using the .Net Mobile Framework. Tried clearing the cache, invalidating and abandoning the session but all that was of no use when the phones back button was pressed.

    The way we got around it in .Net, was to manully set an indicator for a referer .asp page, and re-submit only if the request came from that referrer .asp page.

Similar Threads

  1. A Jtidy and XHTML question
    By mikeliu1976 in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2004-09-30, 05:06
  2. define xhtml as mime-type in tomcat (URGENT)
    By tserivdd in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2004-05-06, 13:17
  3. XHTML WAP gateway problem?
    By huffschmid in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2004-04-07, 17:14
  4. XHTML Caching
    By nitinchandola in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2003-09-12, 11:51
  5. Can <meta http-equiv="Cache-Control". .. /> be used in xHTML MP?
    By janssonteppo in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-12-10, 03:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts