struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chetan Pandey" <cpan...@bluesingapore.com>
Subject RE: Browser Back Button
Date Wed, 10 Jan 2007 12:17:59 GMT
Hi Chris:

> What browser are you using? Is your setup action being executed again,
> or is the browser serving the page from the cache? If the browser is not
> contacting the server, there's nothing you can do.

I am using IE 7.0.

Regarding contacting the server, something very weird is happening.

If my execute method has the following line:

request.getSession().setAttribute("eventForm", new EventForm() );

It will contact the Server - as all debug statements are printed.

However, if I remove this one line, then it doesn't contact the server and
fetches everything from cache - since no debug statement is printed.

I have checked other places also. Clicking back button doesn't go to the
server. Since no debug statement is printed.

Only the presence of the above line makes a weird difference.



Chetan Pandey wrote:
> To avoid this problem I introduced the following
> request.getSession().setAttribute("eventForm", new EventForm()).

>If you are using Struts form beans, it might be better to blank the
>existing bean instead of creating a new one. Something like this:

>EventForm ef = (EventForm)form;

>ef.setFoo(null);
>ef.setBar(null);
>// etc.

It didn't help. Still went to the Server.

> I go to the form page and then click add. It goes to the Preview page.
> Everything shows perfectly. Now I click on the Back Button. Lo and Behold
> !!!!! The Add Fields are all empty.

>What browser are you using? Is your setup action being executed again,
>or is the browser serving the page from the cache? If the browser is not
>contacting the server, there's nothing you can do.

> (Actually, that's not true... if you are using javascript to do some
>funny things with the form, submission, etc., then you are likely
>causing your own problems. If, however, your form is standard then the
>browser /should/ be keeping the form data there if you do a SUBMIT
>followed by a BACK).

>If the browser /is/ contacting the server, then you need to look at what
>is happening in your action. For instance, if the above code is running,
>then /of course/ you are ending up with a blank bean.

>One way around this would be to put an action /in front/ of the editing
>action that blanks any existing form bean and then redirects (not
>forwards) to the editing action (which does /not/ blank the bean). In
>this case, you'll get a fresh bean for editing, but pressing BACK will
>result in the user returning to the "edit" action instead of the
>"blank-and-then-edit" action. Of course, if the user presses BACK twice,
>then you'll get a blank bean again. ;)

>Hope that helps,
>- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFo8Iu9CaO5/Lv0PARAtAHAJ9RkZfhNyjOdMttiFmuaO9m7TW74ACeLKxB
jStpytMzn+2l6dPLELV//lo=
=qP9A
-----END PGP SIGNATURE-----

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


Thanks. 

Chetan




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


Mime
View raw message