[
https://issues.apache.org/struts/browse/WW-2816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Philip Luppens resolved WW-2816.
--------------------------------
Resolution: Not A Problem
A couple of things.
- the test attribute is always evaluated, so don't use %{..}.
- both && and 'and' work, just like || and 'or'.
Please run this type of question by the user mailing list first.
If this is really a problem (although I cannot imagine, but hey .. ), please
reopen.
> s:if test do not seem to work with logic and
> --------------------------------------------
>
> Key: WW-2816
> URL: https://issues.apache.org/struts/browse/WW-2816
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - Tags, Value Stack
> Affects Versions: 2.0.11.2
> Environment: Windows XP, Websphere, JSP
> Reporter: Philip Chan
>
> Apache documentation show simple s:if test usage. e.g. s:if
> test="%{mode=='AddEdit'}"
> I try to use a little more complex test s:if test="%{mode=='AddEdit'} &&
> %{id==null}" and it fail to evaluate properly.
> EmployeeUsername is assigned when created. Once created it should not be
> changed while other field like first name may be changed. There are 3 modes
> (Add/Edit/ViewOnly)
> Here is the sample code that somehow works. It allow data entry in
> employeeUsername in Add/Edit mode. The problem is it allow data entry after
> username is assigned.
> <s:if test="%{mode=='AddEdit'}">
> <td><s:textfield name="employeeUsername"/></td>
> </s:if>
> <s:else>
> <td><s:textfield name="employeeUsername" readonly="true"/></td>
> </s:else>
> Here is code that try to fix the above problem but do not work (The textfield
> is always readonly even when mode is 'AddEdit' and id is really null).
> <s:if test="%{mode=='AddEdit'} && %{id==null}">
> <td><s:textfield name="employeeUsername"/></td>
> </s:if>
> <s:else>
> <td><s:textfield name="employeeUsername" readonly="true"/></td>
> </s:else>
> I got around the problem with 2 individual s:if test but that is a ugly
> solution.
> Is this a OGNL problem (OGNL document say and/or is allowed)?
> Is this a struts s:if tag problem or simply s:if limitation? There is simply
> no documentation that said s:if support this behavior or not.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.