Using Multibox in Struts

By: Ivan Lim Emailed: 1728 times Printed: 2331 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Multibox is a collection of checkbox. When a single checkbox exists, it should be mapped to a Boolean. Such condition does not apply to collection of checkboxes. Here we map it to a String array

  1. Recall that Checkbox cannot exist outside a form. Hence start by defining a form to handle the
    checkboxes around the search display list as follows (Simplified for clarity):

    <html:form action="/manageCustomerList">

    <c:if test='${not empty CUSTOMER_SUMMARY_OBJECTS}'>
    ..
    <html-el:multibox property="idSelections">
    <c:out value='${customer.id}'/>
    </html-el:multibox>

    ..
    </c:if>
    </html:form>
  2. Define ManageCustomersForm to hold the checkbox information and initialize the string array
    as follows.

    public class ManageCustomersForm extends ActionForm {
    private String[] idSelections;
    //getters and setters
    public ManageCustomersForm() {
    init();
    }
    protected void init() {
    idSelections = new String[] { "" };
    }
    ..
    }
  3. Create a ManageCustomersAction to handle it in the package struts.example.search. Leave its execute() method empty.
  4. Add an ActionMapping in struts-config.xml. to associate /manageCustomerList.do with
    ManageCustomersAction and ManageCustomersForm Build Deploy and See how the page displays at this point. This should give you a clear picture of using multibox.

Struts Home | All Struts Tutorials | Latest Struts Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Ivan Lim
Requesting a Signed Certificate from a Certification Authority example using keytool in Java
The if-then Statement in Java
SELECT Statements
The BodyTag Interface in JSP
Handling Duplicate Form Submissions in Struts
Standard Input and Output in C
A sample that shows Java Beans, Servlets and JSP working together
Recursion in C
Using Multibox in Struts
switch in C
Word Counting sample program in C
Java Bean Scopes in JSF
Using cout.width() in C++
Types of configurations in J2ME
How to get the CLDC and MIDP version from a J2ME program

More Tutorials in Struts
Configuring JDBC DataSources in Struts
Struts Classes
FAQ: Why was reload removed from Struts (since 1.1)?
FAQ: Why are my checkboxes not being set from ON to OFF?
Using JavaScript to submit a form in Struts
How to prepopulate a form in Struts
Simple example of using the requiredif Validator rule in Struts
Chaining actions in Struts
When is the best time to validate input in Struts
What is a Plug-in and how to use Java plug-ins with Struts?
7 Best Practices of Struts
Origin and Architecture of Struts
ActionErrors and ActionError in Struts
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
Handling multiple buttons in HTML Form in Struts

More Latest News
Most Viewed Articles (in Struts )
Struts 1 vs Struts 2
Introduction to Struts Architecture
ActionErrors and ActionError in Struts
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
What is Struts? Which Version of Struts to use?
Model 1 Architecture
ForwardAction in Struts
DispatchAction in Struts
Handling Duplicate Form Submissions in Struts
XDoclet struts-config.xml in Struts
What is a Plug-in and how to use Java plug-ins with Struts?
Using JavaScript to submit a form in Struts
Configuring JDBC DataSources in Struts
Downloading and installing Struts
The directories and files of a Struts application
Most Emailed Articles (in Struts)
MVC with configurable controller
Installing and configuring Tomcat and Struts
Guidelines for Struts Application Development
Simple example of using the requiredif Validator rule in Struts
What is Struts? Which Version of Struts to use?
WebWork 2 is now Apache Struts 2
Struts 1 vs Struts 2
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
Handling multiple buttons in HTML Form in Struts
IncludeAction in Struts
DispatchAction in Struts
Struts-GUI and Struts Console
Origin and Architecture of Struts
Is Struts the most popular web application framework for Java?
What is a Model View Controller (MVC) Model?