[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Struts 1 radio button default selection at page start

Asked by ilginyarimagan in Jakarta Struts

Hello,

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...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
below is the paymentlist.jsp that the radio buttons is added 
   <html:form  action="/paymentEdit">
....... 
 
<%-- start with an iterate over the collection payments --%>
          <logic:iterate name="paymentListForm" property="payments" id="payment">
            <tr>
              <%-- payment information --%>
              <td>
              <!--  <input type="checkbox" value="<bean:write name="payment" property="id"/>" name="savePaymentSelection"> --> 
              
        
              
             <html:radio property="selectedItemInterate" idName="payment" value="id" onclick="paymentClicked()">
              	
            </html:radio>
 
 
 
 
Below are where I reset the selectedItemInterate ()
 
public class PaymentListForm extends ActionForm {
 
	 private String selectedItemInterate;
 
	public void reset(ActionMapping mapping, HttpServletRequest request) {
 
		payments = new Payment[0];
		this.selectedItemInterate = null;
      }
[+][-]09/19/09 10:10 AM, ID: 25373709Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Jakarta Struts
Sign Up Now!
Solution Provided By: mrjoltcola
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625