Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

How to make EL expression evaluate its values?

Thread view: 
Ray - 30 Jan 2007 03:25 GMT
Hello,

We have this xml string tht is dynamically generated every request,
and it is output using <c:out>.

The problem is, we'd like to have JSTL tags inside that as well. A
simple example:

<c:out value="<html:text ..... />"/>

or

${"<html:text .... />"}

Is there a way so that that value is evaluated? That is, it becomes
<input type="text" ... > instead of "<html:text .... />"

Thanks in advance,
Ray
Lew - 30 Jan 2007 05:39 GMT
> We have this xml string tht is dynamically generated every request,
> and it is output using <c:out>.
[quoted text clipped - 3 lines]
>
> <c:out value="<html:text ..... />"/>

<html:text> is not a JSTL tag.

> or
>
> ${"<html:text .... />"}
>
> Is there a way so that that value is evaluated? That is, it becomes
> <input type="text" ... > instead of "<html:text .... />"

EL is not a macro language that stands in for HTML. It is a standin for Java
code. It represents values and expressions present at the time the JSP is
generated.

So you don't "<c:out>" a value that equals a tag, you just place the tag in
your JSP and use EL to plug in specific values inside the tag.

This part of the JSP should look like:

<input type="text" ... value="${someRequestAttribute.member}" />

You don't need <c:out> at all, as far as I can see.

- Lew
Ray - 30 Jan 2007 07:53 GMT
> > ${"<html:text .... />"}
>
[quoted text clipped - 13 lines]
>
> You don't need <c:out> at all, as far as I can see.

I know that part, basically the reason is this: we have an existing
big application. Most of the content of the file is generated using
XSLT transform.

So in the "skeleton" page, we have something like:

<html:form action...>

<c:out value=<that XSLT-generated big string, which is stuffed into a
request attribute> escapeXml="false"/>

</html:form>

So all the tags (JSTL or otherwise) are written as they are--they're
not evaluated. When inside the big string we put things like <c:if...>
and so on, when I view the source it will be <c:if...> instead of the
result.

I was wondering if there's a quick way to just tell the page,
"evaluate all tags in this dynamically generated string".

Thanks,
Ray

> - Lew
Lew - 30 Jan 2007 15:05 GMT
Lew wrote:
>> So you don't "<c:out>" a value that equals a tag, you just place the tag in
>> your JSP and use EL to plug in specific values inside the tag.
>> You don't need <c:out> at all, as far as I can see.

> I know that part, basically the reason is this: we have an existing
> big application. Most of the content of the file is generated using
[quoted text clipped - 13 lines]
> and so on, when I view the source it will be <c:if...> instead of the
> result.

Of course. You have instructed the JSP to generate that string as a literal.

> I was wondering if there's a quick way to just tell the page,
> "evaluate all tags in this dynamically generated string".

You do not put the "big string" inside a <c:out>. Do not use <c:out> for this.

You put your dynamic tags directly on the JSP.

- Lew


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.