I already posted a answer to Q like this . which displays a radio button as
against ur checkbox . So just use checkbox instead of radio button and it
will work

Do something like this
in strtus-config.xml file -

  <!-- Do nut -->
  <action path="/donut"
     type="example.DoNutAction"
     name="doNutForm">
   <forward name="success"  path="/donut.jsp"/>
  </action>

In the donut.jsp -
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<html:form action="/donut.do">
<html:radio property="donut" value="yes" >
 <bean:message key="yes" />
</html:radio>
<html:radio property="donut" value="no" />
 <bean:message key="no" />
</html:radio>
<html:submit>
<bean:message key="button.submit" />
</html:submit>
</html:form>
</html:html>

In the DoNutForm.java

package example;
import org.apache.struts.action.*;
import javax.servlet.http.*;
public class DoNutForm extends ActionForm {
 private String donut;
 public DoNutForm() {
 }
 public void reset(ActionMapping mapping , HttpServletRequest req) {
  donut = "yes";
 }
 public void setDonut(String donut) {
  System.out.println(" **in the setter donut** "+ donut);
  this.donut  = donut ;
 }
 public String getDonut() {
  System.out.println(" in the getter" + donut);
  return donut;
 }
}

In the DoNutAction.java
public final class DoNutAction extends Action {
   public ActionForward perform(ActionMapping mapping,
                               ActionForm form,
                               HttpServletRequest request,
                               HttpServletResponse response)
   throws IOException, ServletException {
  return mapping.findForward("success");

 }
}



----- Original Message -----
From: Leander Jedamus <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 12, 2001 8:41 AM
Subject: Re: multiple checkboxes


Hi!

Now my question is, how do I get the aid from the Form into the
checkbox?

Meeraj Kunnumpurath wrote:
>
> You can use the multibox tag
>
> Regards
>
> <Meeraj/>
>
> -----Original Message-----
> From: Leander Jedamus [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 12, 2001 8:21 AM
> To: [EMAIL PROTECTED]
> Subject: multiple checkboxes
>
> Hi!
>
> I have one problem I cannot solve on my own.
> I have an not known number of answers with answer-ids in my database.
> Now I want to create a Form to reflect that.
> How do I manage an array of checkboxes?
> What do I have to do to get the following HTML-code?:
> <input type="checkbox" name="aids" value="4">Text
> <input type="checkbox" name="aids" value="2" checked>Text2
>
> Thanks in advance
> Leander
> --
> Dipl.-Inf. (FH) Leander Jedamus
> Presse- und Öffentlichkeitsarbeit
> Fachhochschule Worms, Erenburgerstr. 19, 67549 Worms, Tel.: 06241
> 509-169
> mailto:[EMAIL PROTECTED]

--
Dipl.-Inf. (FH) Leander Jedamus
Presse- und Öffentlichkeitsarbeit
Fachhochschule Worms, Erenburgerstr. 19, 67549 Worms, Tel.: 06241
509-169
mailto:[EMAIL PROTECTED]

Reply via email to