Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

clearing cache in struts 2

 
Anand Sivathanu
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I am trying to clear the cache for a simple web application which i developed using struts 2

In tiles.xml,
<definition name="addUserURL" extends="welcome">
<put-attribute name="myBody" value="/user/addUser.jsp"/>
</definition>

In struts.xml,

<action name="*UserURL" method="{1}" class="com.action.user.UserAction">
<result name="add" type="tiles">addUserURL</result>
</action>

<action name="addUser" class="com.action.user.AddUser">

<result name="success" type="tiles">addUserURL</result>
<result name="input">/user/addUser.jsp</result>
</action>



On clicking the addUserURL link in web page(*UserURL), addUser.jsp is called.On adding the user(submitting the page),I would like to call the addUser.jsp.On action "addUser" and on "success" ,
I am calling "addUserURL".(<result name="success" type="tiles">addUserURL</result>).So addUser.jsp is called again.So far so good.But the thing is history is not cleared.So the form is
not reseted.i.e fields having old data displayed on the web page form again.how to clear the cache?

I have googled and found the below suggestion

1.Add the below code

<%
response.addHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache,no-store,must-revalidate");
response.addHeader("Cache-Control","pre-check=0,post-check=0");
response.setDateHeader("Expires",0);
%>

2.include tiles-jsp-.jar in classpath.

I have followed the suggestion but cache is not cleared.

Please help in this issue.

Regards,
Anand


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic