Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

Archive for the ‘Struts 2’ Category

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”
Like:

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.

Advertisements

Posted in Struts 2 | 2 Comments »

Captcha in Struts 2

Posted by Pankil Patel on April 12, 2010

http://www.roseindia.net/struts/struts2/captcha/java-captcha-example.shtml

Posted in Core Java, Struts 2 | Leave a Comment »

Fileupload

Posted by Pankil Patel on March 29, 2010

http://www.vaannila.com/struts-2/struts-2-example/struts-2-file-Upload-example-1.html

Posted in Struts 2 | Leave a Comment »

How to overrride fileUpload interceptor in struts 2?

Posted by Pankil Patel on March 29, 2010

<interceptor-ref name=”fileUpload”>
<param name=”maximumSize” >1024</param>
<param name=”allowedTypes”>image/png,image/gif,image/jpeg,image/jpg</param>
</interceptor-ref>

Just put those lines inside of your action definition in your struts.xml.

Posted in Struts 2 | Leave a Comment »

Struts 2

Posted by Pankil Patel on March 16, 2010

1) Date / datetimepicker

http://www.roseindia.net/struts/struts2/date/struts-2-datetimepicker.shtml

2) How will work in struts2?

myAppUserList -> List in supported Action file

selectedId -> value will be set in this property of supported Action file, after page submit

user.id -> ComboBox’s value component

user.name -> ComboBox’s text(display) component

key / label=”Select User” -> Use key for properties file & label for Hard Coding in jsp.

<s:select list=’myAppUserList’ listKey=”user.id” listValue=”user.name” key=”Select User” name=”selectedId” id=”id”/>

Posted in Struts 2 | Leave a Comment »