This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 61092
    
  66

"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: 61092
    
  66

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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using JSP Code in a variable