Improve flexibility for optGroup tag in Struts 2
------------------------------------------------
Key: WW-3285
URL: https://issues.apache.org/struts/browse/WW-3285
Project: Struts 2
Issue Type: Improvement
Components: Plugin - Tags
Affects Versions: 2.1.8
Reporter: Thang Minh Le
Priority: Minor
It would be nice if optGroup tag can support this:
<s:optGroup
builderClass="com.test.OptionBuilderImpl"
builderArgs="prop1:value1;prop2:value2;prop3:value3"
visitorClass="com.test.OptionVisitorImpl"
visitorArgs="prop3:value3;prop4:value4"
/>
Attributes:
- builderClass: accepts class name
- builderArgs: accepts list of values in pair (key and value) separated by
semicolon ";"
- visitorClass: similar as in builderClass
- visitorArgs: similar as in builderArgs
Roles:
- builder class is to build option list
- visitor class is to perform any change (modify/delete/add) to option list
produced by builder class. But visit class should not overlap the role of
builder class
OptGroup takes a role as controller which will perform these:
1) Use reflection to create instance of class defined "builderClass"
2) Load values in builderArgs to Properties and set this properties to builder
class
3) Execute builder class
4) Set option list returned from step 3 to optGroup
5) Construct visitor class instance
6) Load values in visitorArgs to Properties and set this properties to visitor
class
7) execute visit(OptGroup options)
Since optGroup is creating builder class and visitor instances, whatever
environment information accessible from optGroup should make available to
builderClass and visitorClass (PageContext is one of a good candidate).
It is great to make this improvement on both Struts1& Struts2. If this
improvement is going to be done, please make sure JSP Container doesn't
recompile jsp page using optGroup tag every time it gets loaded.
Looking forward to your comments.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.