This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread 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


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: 61309
    
  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: 61309
    
  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 ]
 
GeeCON Prague 2014
 
subject: Using JSP Code in a variable