Hi Struts users,
I am having problems migrating from version 2.3.1.2 to
version 2.3.15.1. This upgrade seems pretty important as
it fixes a known security issue.
The problem I am having is the that apparently, I can no
longer check if a property has been given to my Struts
component (using s:component and s:param) by testing
that the value associated to the parameter key in the
"parameters" is equal to null.
Test
This is the code of the component that I call:
<h1>Param items</h1>
<s:property value="parameters.items.class.name"/>
<h1>Radom param name</h1>
<s:property value="parameters.radomParamnameDynamo.class.name"/><br/>
<s:property value="parameters.radomParamnameDynamo"/><br/>
<s:property value="parameters.radomParamnameDynamo"/><br/>
<s:property value="parameters.radomParamnameDynamo2"/>
<s:property value="test"/>
Here is the call to the component:
<s:component template="TestComponent.jsp">
</s:component>
And here is the produced output (without html
marking)
Param items
java.lang.Object #Output of <s:property value="parameters.items.class.name"/>
Radom param name
java.lang.Object #Output of <s:property value="parameters.radomParamnameDynamo.class.name"/>
java.lang.Object@3c0e5477 #Output of <s:property value="parameters.radomParamnameDynamo"/>
java.lang.Object@3c0e5477 #Output of <s:property value="parameters.radomParamnameDynamo"/> (the second one)
java.lang.Object@e91824 #Output of <s:property value="parameters.radomParamnameDynamo2"/>
test #Output of <s:property value="test"/>
Note: test is a property of the action that
should return the "test" string. OK. I
Environment
- Java 6
- struts-javatemplate-plugin (same version as
struts)
- JRebel
- Tomcat (restarted and cleaned), Eclipse(restarted
& project recompiled)
Analysis
- Action properties are acting as before (I've
checked with the debugger, and the non existence of
an action property result in a null value)
- The Component "parameters" object will always
return a value (even if it is an object)
- By using the debugger, we can see that accessing
an unexisting "parameters" key will result in the
creation of this "parameters" key and its
association to an object of type Object.
- 2 unexisting "parameters" key will result in the
association of 2 distinct objects of type Object.
(as illustrated in the output of the Test)
What I have tried
I hope I provided enough information and that you will
be able to tell me what I do wrong, how I could get out
of this mess or that there is a bug ;).
Best regards, and thanks to the Team for all the good
work,
--
Thim Anneessens
IT Department