File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 custom components checkbox JSP

 
vijay saraf
Ranch Hand
Posts: 141
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

actually i wanted to place a check box in iterator tag for each row to provide mutiple edit facility, and i am unable to do it with <s:checkbox>,i think this can be done with custom components.
i wanted to know what are steps to create a custom component in struts for JSP.
however i have done a lot of googling but didn't get some solid document regarding custom components.

 
vijay saraf
Ranch Hand
Posts: 141
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bazzzzz......... Ranchers..........
i will appreciate even a link of custom component.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see EaseUp and PatienceIsAVirtue.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why can't you just use a checkbox tag? If you're wrapping up the HTML inside an iterator I don't see what the issue is.
 
vijay saraf
Ranch Hand
Posts: 141
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ohh!!! I am sorry and definitely i will wait at least for a day to get the answer.

Why can't you just use a checkbox tag? If you're wrapping up the HTML inside an iterator I don't see what the issue is


i agree with you but i was looking inside struts to achive that...

ok i have done like this...



and it means we can't completely omit the old HTML tags...
any ways ...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't see what the issue is with using an S2 tag, but there's also no reason not to use straight HTML when it works (unless you need to display the values pre-populated).
 
vijay saraf
Ranch Hand
Posts: 141
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK Mr. David,
Actually , i have declared a selectedIndex as List<Integer> in my action and want to collect those selected Indexes
and more with this is, till date i am not clear about Indexed property in S2.
and as per my understanding checkbox value in struts2 must be boolean like [please correct me if i am wrong]
<s:checkbox value="boolean" />
but in html i can supply any string type value...and OGNL convert and populate this selectedIndex List for me...
If you can please show me the code sample useing S2 checkbox, i will be thankful to you.


 
Anbarasu Aladiyan
Ranch Hand
Posts: 182
Chrome Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vijay saraf,

I think this is what you are asking for.

---
A.A.Anbarasu

 
vijay saraf
Ranch Hand
Posts: 141
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Aladiyan & David,
Actually i was not awre of fieldValue.
I have done that using filedValue attribute of s:checkbox,


where employees is a List<EmployeeBean> and seletedIndex is a List<Integer>.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic