struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonios Gkogkakis <gkogk...@tcd.ie>
Subject Re: if/elseif tag syntax
Date Thu, 27 Jun 2013 09:20:01 GMT
I would temporarily remove  ${certificate.status} from the else and I would
check if the getStatus is called for the conditionals

Antonios


On 27 June 2013 09:56, Fabian Richter <frichter@mtg.de> wrote:

> All objects have getters/setters set, this is the except of the jsp code
> with the problem (trying to write a text that depends on the value of
> certificate.status into a table cell):
>
> <td class="cell" valign="top">
> <s:if test="%{certificate.status==1}**">
>     <fmt:message key="certificate.status.valid" />
> </s:if>
> <s:elseif test="%{certificate.status==2}**">
>     <fmt:message key="certificate.status.**revoked" />
> </s:elseif>
> <s:elseif test="%{certificate.status==4}**">
>     <fmt:message key="certificate.status.**onhold" />
> </s:elseif>
> <s:elseif test="%{certificate.status==5}**">
>     <fmt:message key="certificate.status.**expired" />
> </s:elseif>
> <s:else>
>         ${certificate.status}
> </s:else>
> </td>
>
> The result is that in every of these table cells only the integer value is
> written, hence the else branch is executed.
>
> Any idea why?
>
> Best
> Fabian
>
>
>
> Am 27.06.2013 10:50, schrieb Antonios Gkogkakis:
>
>> Long would be fine as well,
>> I tested option 2 and 3 and it works, the important thing is to have
>> gettersfor certificate and status. and an object that has a
>>
>> certificate field in
>> your value stack,
>>
>> Your last option is probably not valid unless you have used s:set to push
>> a
>> bean in the value stack with name certificate (not 100% sure though)
>>
>>
>>
>> On 27 June 2013 09:42, Fabian Richter <frichter@mtg.de> wrote:
>>
>>  Stupid me, getStatus was what I was reading and that one returns an int.
>>>
>>> Am 27.06.2013 10:33, schrieb Fabian Richter:
>>>
>>>   Hi Antonios,
>>>
>>>>
>>>> you mean the java source Code or something I can extract from the jsp?
>>>>
>>>> The source code is confidential.
>>>>
>>>> I checked the get/set methods and getId on certificate returns a Long if
>>>> thats what you wanted to know...
>>>>
>>>> Best
>>>> Fabian
>>>>
>>>> Am 27.06.2013 10:24, schrieb Antonios Gkogkakis:
>>>>
>>>>  Hi Fabian,
>>>>>
>>>>> Can you give as the code of the Action that is in the Value Stack?
>>>>>
>>>>> Antonios
>>>>>
>>>>>
>>>>> On 27 June 2013 09:16, Fabian Richter <frichter@mtg.de> wrote:
>>>>>
>>>>>   Hey,
>>>>>
>>>>>>
>>>>>> so I tried to use the <s:if test=""> tag in one of my jsps
and
>>>>>> couldnt get
>>>>>> neither working:
>>>>>>
>>>>>> <s:if test="!empty certificate.status">isTrue</s:******if>
>>>>>>
>>>>>> <s:if test="certificate.status == 1">isTrue</s:if>
>>>>>> <s:if test="%{certificate.status == 1}">isTrue</s:if>
>>>>>> <s:if test="%{#certificate.status == 1}">isTrue</s:if>
>>>>>>
>>>>>> but
>>>>>>
>>>>>> ${certificate.status}
>>>>>>
>>>>>> outputs a 1. Using ${certificate.status}  within test="" throws a
JSP
>>>>>> exception that "attribute test does not accept any expressions"
>>>>>>
>>>>>> The only thing that works is:
>>>>>>
>>>>>> <s:if test="%{true}">isTrue</s:if>
>>>>>>
>>>>>> What am I missing?
>>>>>>
>>>>>> TIA and best
>>>>>> Fabian
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>  --
>>> media transfer AG
>>>
>>> Fabian Richter, M.Sc.
>>> Softwareentwickler
>>>
>>> Mail:    frichter@mtg.de
>>> Telefon: +49 6151 8193-24
>>> Telefax: +49 6151 8193-41
>>> Web:     http://www.mtg.de
>>>
>>> Firmensitz: Dolivostraße 11, 64293 Darmstadt
>>> Registergericht: Amtsgericht Darmstadt, HRB 8901
>>> Vorstand: Jürgen Ruf (Vors.), Tamer Kemeröz
>>> Aufsichtsratsvorsitzender: Dr. Thomas Milde
>>>
>>>
>>>
>>
> --
> media transfer AG
>
> Fabian Richter, M.Sc.
> Softwareentwickler
>
> Mail:    frichter@mtg.de
> Telefon: +49 6151 8193-24
> Telefax: +49 6151 8193-41
> Web:     http://www.mtg.de
>
> Firmensitz: Dolivostraße 11, 64293 Darmstadt
> Registergericht: Amtsgericht Darmstadt, HRB 8901
> Vorstand: Jürgen Ruf (Vors.), Tamer Kemeröz
> Aufsichtsratsvorsitzender: Dr. Thomas Milde
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message