- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHello,
I am a new Struts 1 developer and had a problem while using <html:radio> tag.
The scenario is as follows:
I have a payment list inside a form and each payment is identified by the radio button on its first column. Whenever the user clicks a radio button from the page, the radio button sends the id of the
"payment" to the server. Then the user can click "Edit", "Delete" , "Print" buttons on the specific payment. Everything works normal up to now.
The problem starts after the user logs off. If I login as another user, then no problem again. Each user has his own payments so the list form and the radio buttons inside it gets refreshed etc.
However if I login as the same user again, the page opens at the state that last selected radio button appears selected at initial open.
I save the id of the selected radio button in selectedItem String on form. In reset method of the form, I make the String null. So the radio buttons property in server gets "null"ed on every logoff.
The form is in session scope btw.
However the form on the jsp doesnt get resetted or refreshed somehow. So there happens an
inconsistency. Browser shows the last selected radio button from the previous logon as checked but the at the server inside the Form action the corresponding propery is null due to reset. Then when user tries to edit the item which as "shown" as selected on the page is actually isnt selected on server, the system craches since it tries to edit a null payment.
At first I thought its a browser cache problem, and added
<controller>
<set-property property="noCache" value="true"/>
</controller>
to my struts-config.xml
and
<meta http-equiv="pragma" content="no-cache" />
inside my jsp,
I also manually deleted by browsers cache but none of them worked.
I cant find the reason of the situation. Is it because my logout doesnt delete the session etc?
But the problem is on jsp page not on the server (since reset is called successfully all the time).
Is there any way to make the jsp to understand session is renewed on first page open only for once so that <html:radio> tag wont show the last selected from last session .
The problem doesnt happen between different browsers btw. (If I login from IE, then login from FF as the same person last selected radio isnt selected)
I have been struggling with this for 2 days and the bug is really annoying. I would appreacite any help...
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: mrjoltcolaPosted on 2009-09-19 at 10:10:53ID: 25373709
Are you writing these selected values to a persistent store, like a database?
Probably a good idea to ensure you are invalidating the session on logout, just to make sure there is no cross-session bean interference.
General JSP approach for logout action, or even more safe to do it in your login action, to ensure no
recycled session gets used:
HttpSession session = request.getSession(false);
if(session!=null)
session.invalidate();
session = request.getSession(true);