my dog learned polymorphism
The moose likes JSP and the fly likes Using JSP Code in a variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Using JSP Code in a variable" Watch "Using JSP Code in a variable" New topic
Author

Using JSP Code in a variable

JohnDunning
Greenhorn

Joined: Feb 10, 2006
Posts: 1
Hi, for starters I'll mention that I am new to Java/JSP.

I am trying to store the results of an XSL Tranformation as a variable, but the embedded JSP code in the transformation result is not being evaluated -- it is basically just being spat out as a string.

Does anyone know of a way (with examples, preferably) of having a variable contain markup with executable JSP expressions? The reason I am using a variable is that it's not allowed to write files to the server

For example, the pseudo-code from the XSLT result might be:

<!-- variable in 'head.inc' file, included by many JSPs -->
<tr>
<td>Hello <%=user%></td>
<td><%if (referringPage='login.jsp'){%>welcome back<% }else{ %>Register<%}%>
</td>
</tr>

This is being developed using RAD for WebSphere.

TIA,
John
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63225
    
  69

"JohnDunning",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63225
    
  69

As to your question: no. JSP markup is evaluated during the translation phase of the JSP life cycle. Once you reach execution phase, the opportunity for translation is long past.

You might find this article helpful.
[ February 10, 2006: Message edited by: Bear Bibeault ]
 
Have you checked out Aspose?
 
subject: Using JSP Code in a variable
 
It's not a secret anymore!