Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

  • Advertisements

How to use “s:checkbox” in Struts 2 in iterator

Posted by Pankil Patel on April 13, 2010

When you have requirement to use “s:checkbox” as a iterator / multiple / group wise, How you will use it?

Here is the sample example or way to it:

Step 1: Create List of “String” in you action file like:

private List symptomCheckBoxList = new ArrayList();

And create it’s getter and setter.

Step 2: Put “s:checkbox” into your “s:iterator”

Here symptomList in s:iterator is the list “private List symptomList = new ArrayList();” which is having generic type “Symptom” POJO for this list in your action file.

‘ s:property value=”symptomName” ‘ is the value to display for checkbox and here it is property type String into the Symptom POJO.

And “symptomCheckBoxList” is the list in which you will get the the selected / checked value from the display list. It must be in string format.


2 Responses to “How to use “s:checkbox” in Struts 2 in iterator”

  1. limewire said

    dang cool stuff bro.

  2. shoot fun stuff bro.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: