You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Nate (JIRA)" <ji...@apache.org> on 2018/10/12 14:52:00 UTC
[jira] [Created] (WW-4968) combining s:set and s:property where the
property retrieved is null has unexpected results
Nate created WW-4968:
------------------------
Summary: combining s:set and s:property where the property retrieved is null has unexpected results
Key: WW-4968
URL: https://issues.apache.org/jira/browse/WW-4968
Project: Struts 2
Issue Type: Bug
Components: Core Tags
Affects Versions: 2.5.14.1
Reporter: Nate
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.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)