Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JSP Code in a variable

 
JohnDunning
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic