You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by La...@ic.gc.ca on 2002/06/11 17:19:32 UTC

radio button into an iterate tag...

Hi, (Sorry for my english... I will try hard to explain my problem
correctly)
I have a big problem with my radio buttons... I have a list of radio buttons
that are populate from the database with a collection... with an iterate
tag.
The problem is : the last radio button is checked by default.  And when I
look to the source(view source on the browser) I can see that all the radio
buttons are checked.  Maybe it's the reason of why it's the last radio
button that is check.

I want to know how to have just one radio button checked and how I can  have
the good radio button pressed by the client before sending the form...

Maybe I was not clear.. just let me know...

Here is a portion of my code...
-----------------------------------------------(jsp page)
<logic:iterate id="user" type="cipo.tm.paladin.model.UserDetails"
name="userListForm" property="children" scope="session">
	<tr>
      <td width=100><form:radio name="user" property="userId" value="<%=
user.getUserId() %>"> <bean:write name="user" property="userId" scope="page"
/></form:radio></td>
      <td width=100><bean:write name="user" property="depositAccount"
scope="page" /></td>
      <td width=100>bean:write name="user" property="descriptionE"
scope="page" /></td>
	</tr>
</logic:iterate>

-----------------------------(form bean)

/**
	 * The collection of children for the root agentNumber.
	 */
	private Collection children = null;

/**
	 * Property setter for children.  Used to populate the list of
children for the
	 * agent identified by agentNumber.
	 * @param children A collection of Agents.
	 */
	public void setChildren(Collection children) {
		this.children = children;
	}
	
	/**
	 * Property getter for children.
	 * @return A collection of Agents.
	 */
	public Collection getChildren() {
		return this.children;
	}

----------------------------------(action)

public ActionForward perform(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws IOException, ServletException {
		
		// Extract attributes we will need
		Locale locale = getLocale(request);
		MessageResources messages = getResources();
		HttpSession httpSession = request.getSession();
		Enumeration attrbNames = request.getAttributeNames();
		Enumeration paramNames = request.getParameterNames();
		
		String operation = ((UserListForm) form).getOperation();
		UserCatalogHelper userCatalog = new UserCatalogHelper();
		Collection userInfo = new Vector();
		
		// Validate the request parameters specified by the user
		ActionErrors errors = new ActionErrors();
		
		// Lookup the operation based on locale
		if (operation.equals(messages.getMessage(locale,
"submit.administer"))){
			operation = new String("success");  // default
access to home page
			
			AgentDetails agentInfo = (AgentDetails)
httpSession.getAttribute(Constants.ADMINISTER_AGENT);
			String abbreviatedName =
agentInfo.getAbbreviatedName();
			((UserListForm)
form).setAbbreviatedName(abbreviatedName);
			
			Integer agentNumber = agentInfo.getAgentNumber(); 
			try {
			userInfo = userCatalog.getUsersByAgent(agentNumber);
			((UserListForm) form).setChildren(userInfo);
			}catch
(cipo.tm.paladin.web.controller.CatalogException cx) {
				errors.add("agentNumber",new
ActionError("errors.agent.administer.nousers"));

			}



Brigitte Lavoie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>