struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: calling method of a bean from JSP
Date Fri, 15 Sep 2006 18:26:59 GMT
Lixin Chu wrote:
>>
>>
>> What are you trying to achieve? Maybe you're trying to put logic in your
>> JSPs that more properly belongs in an action.
>>
>>
> thanks. what i am trying to do is to get the value of a field. Say I get a
> list of items:
> 
> class item {
> Set values;
> ....
> }
> 
> The item has a set of Values:
> class Value {
> Attribute attribute;
> String value;
> }
> 
> What I wanted to do is to get one particular value based on attribute 
> ID. in
> this case I have to add a method in the Item class, someting like this:
> 
> String getValue (String id) {
>  while (it.hasNext()) {
>     Value value = (value) it.next();
>     if (value.attribute.getId().toString().equals (id)
>        return value.value;
>  }
> 
> So from JSP, I would like to call this method <c:out value="${item.getValue
> (id}"/>

<c:out value="${item.value[id]}"/> ?

L.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message