File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Problem with JSP form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with JSP form" Watch "Problem with JSP form" New topic

Problem with JSP form

swarupa patil
Ranch Hand

Joined: Feb 22, 2006
Posts: 62
Hi guys
I am using Struts and JSP genrated Registration form. It works fine
but when we requesr for the same registration form I got the page with
previous values entered in the form. Can anybody tell me where is the problem. Please Help.
[ June 01, 2006: Message edited by: Bear Bibeault ]
Aravind Prasad
Ranch Hand

Joined: Dec 28, 2005
Posts: 265
Hi swarupa patil
Can you please send the code of that registration page.. if so it is easy to find the problem.
swarupa patil
Ranch Hand

Joined: Feb 22, 2006
Posts: 62
response.setHeader("Cache-Control","no-cache, no-store, must-revalidate");
response.addHeader("Cache-Control","pre-check=0, post-check=0");
response.setDateHeader("Expires", 0);

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>


<html:html xhtml="true">

<title><bean:message key="formpage.title"/></title>
function showalert()
alert("Are you sure you dont want to receive email alerts");
<body background="images/blueAndWhiteBackground.gif">
<div align="center">
<h2><bean:message key="formpage.title"/></h2>


<html:form action="/submitCustomerForm" focus="firstName" method="POST">

<table width="60%">
<td align="right"><bean:message key="prompt.customer.firstname" />:</td>
<td align="left"><html:text property="firstName" size="16" maxlength="25"

<td align="right"><bean:message key="prompt.customer.lastname"/>:</td>
<td align="left"><html:text property="lastName" size="16" maxlength="25" tabindex="2"/></td>

<td align="right"><bean:message key=""/>:</td>
<td align="left"><html:text styleClass="mytxtbox" property="emailAddress" size="16" maxlength="30" tabindex="3"/></td>

<td align="right"><bean:message key=""/>:</td>
<td align="left"><html:text property="mobile" size="16" maxlength="30" tabindex="4"/></td>

<td align="right"><bean:message key="prompt.customer.username"/>:</td>
<td align="left"><html:text property="username" size="16" maxlength="25" tabindex="5"/></td>

<td align="right"><bean:message key="prompt.customer.password"/>:</td>
<td align="left"><html assword property="password" size="16" maxlength="25" tabindex="6"/></td>
<td align="right"><bean:message key="prompt.customer.reenter"/>:</td>
<td align="left"><html assword property="reenterpassword" size="16" maxlength="25" tabindex="7"/></td>
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63844

Please post questions about Struts in the Struts forum. This has been moved there.

[Asking smart questions] [About Bear] [Books by Bear]
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
What is the scope of the form in struts-config?
swarupa patil
Ranch Hand

Joined: Feb 22, 2006
Posts: 62
I used Session Scope for Form
Is any other problem then tell me
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 751
hmmm... maybe you should try putting something like this in your Action class, after you have made use of the information...

HttpSession session;

session = request.getSession()

session.invalidate(); //This would destroy all your session info including login info

or solution 2... Narrow down your scope to request scope

SCJP 1.5
I agree. Here's the link:
subject: Problem with JSP form
It's not a secret anymore!