Using Multibox in Struts

By: Ivan Lim Emailed: 1587 times Printed: 2041 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 )
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?
Handling Duplicate Form Submissions in Struts
Struts 1 vs Struts 2
ForwardAction in Struts
ActionErrors and ActionError in Struts
Using JavaScript to submit a form in Struts
DispatchAction in Struts
Chaining actions in Struts
Model 1 Architecture
MVC Architecture (Model 2 Architecture)
Introduction to Struts Architecture
Simple example of using the requiredif Validator rule in Struts
Configuring JDBC DataSources in Struts
Struts and Tiles - Steps to use Struts and Tiles
Most Emailed Articles (in Struts)
Downloading and installing Struts
The directories and files of a Struts application
Editing web.xml in a Struts Application
Editing struts-config.xml in a Struts Application
Creating the first application using Struts 2
Model 1 Architecture
MVC Architecture (Model 2 Architecture)
Installing and configuring Tomcat and Struts
Guidelines for Struts Application Development
MVC with configurable controller
Using Checkbox & Radio Tags, html:select, html:options in Struts Forms
Tutorial on Struts Configuration File - struts-config.xml in Struts - from the book: Struts Survival Guide. Basics to Best Practices
ForwardAction in Struts
Using JavaScript to submit a form in Struts
Simple example of using the requiredif Validator rule in Struts