tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Viewing JSP's compiled code
Date Fri, 29 Jan 2010 21:26:35 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fred,

On 1/29/2010 12:07 PM, fred basset wrote:
> What I am trying to do is access a variable from a forEach loop.  In
> the example below I want to call a java function to do some
> calculations on each "p" variable in the loop and output the results
> of the calculation in the table.  How do I do this?

What do you want to do with that variable?

When you use tag libraries and beans and stuff like that, you're
supposed to kind of live in that environment exclusively. There's no
guarantee that the lcoal variable "p" will exist, so you can't just do this:

<%
   p.toString();
%>

All the "variables" defined through things like <c:forEach> are likely
to be stored in the "page" context which isn't represented directly by
local variables (or, at least, isn't guaranteed to be).

Perhaps there's a tag for what you want to do with this variable.
Perhaps you'll have to develop one.

If this is all JSTL, then you may be able to just do:

${p}.toString()

..or something like that.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktjUosACgkQ9CaO5/Lv0PBOYgCfQTGD/BlYAaLZsmhEAfOOViaA
1hoAnRbg7s+xk15wxrx2Fb1epzKsMA5i
=NkUJ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message