[ https://issues.apache.org/jira/browse/WW-4968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16648345#comment-16648345 ]
Aleksandr Mashchenko commented on WW-4968: ------------------------------------------ Read [this | https://stackoverflow.com/q/25551470/1700321]. > 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 > Priority: Major > > 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)