Description
I have the following s:set definition:
<s:set var="name"
value="buildEnvironmentSearchView.name" scope="request"></s:set>
which I further on use as such in a Dojo input:
<input data-dojo-type="dijit/form/ComboBox"
data-dojo-props="store:nameIdentificationStore, searchAttr:'name', value:'${name}'"
name="buildEnvironmentSearchView.name"
id="buildEnvironmentSearchView.name" />
I needed to escape the value this generated for Javascript so single quotes didn't corrupt the dojo-props, so I replaced it withÂ
<s:set var="name" scope="request">
<s:property value="buildEnvironmentSearchView.name" escapeJavaScript="true"/>
</s:set>
This worked if buildEnvironmentSearchView.name is not null, but when it is evaluated to be null, instead of name being set to null, it was evaluated to the toString value of the top element on my valueStack: be.companyname.productname.client.struts2.layout.FieldFormatter@19b82032
I'm not sure why this happens. In the end, I managed to resolve it by putting the s:property directly into the data-dojo-props object, but I don't really get why this happened. Is it intended that if you do an s:set with a null value, it returns the top value of the stack? This doesn't seem to be documented anywhere.