struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Accesssing a bean from a jsp without struts tags
Date Sat, 07 Apr 2007 14:27:45 GMT
--- mansour77@yahoo.com wrote:
> Can you give an example please. I am newbie  and it
> sounds like greek to me. my original question was
how
> to retrieve an object using useBean from struts?

Your original question was how to access a bean from
something like an iterator; the quick answer is you
don't do anything differently (JSP 2.0, if < 2.0 then
use <c:out.../> in the loop body), so if you had a
list of beans "myBeans" each with a property "foo":

<c:forEach items="${myBeans}" var="b">
  ${b.foo}
</c:forEach>

Note that some people don't like to fix idioms in
their JSP and would prefer to use <s:iterator.../>
etc. Personally, I don't mind using ${...} if JSP 2.0+
since it makes more sense to me than typing out
<s:property.../> all over, but that might just be me.
I just really hate typing when it's pointless. (...and
I like pointers when they're typeless. Sorry.)

Your *second* question was dealing with the following
error:

> <dg:dataGrid items="${accountBean.invoices}" 
>              var="inv" 
>              name="datagrid1">
> [...]
> According to TLD or attribute directive in tag file,

> attribute items does not accept any expressions

I have no idea what that tag library is or what its
TLD looks like etc. but my impression is that the
error isn't telling you you're exposing your beans
improperly (like on a playground), but that according
to its TLD you're providing it (the tag) something it
is not expecting.

Are you using a JSP 2.0 container?

d.



 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

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


Mime
View raw message