View Full Version : JSTL-Outputs in ExtJS

2 Jan 2011, 9:21 AM
Hi there !!

I am working with the Spring Framework and passing data through a controller with the method referenceData to a JSP view where I am coding ExtJS-Code.
Normally I am using JSTL-Code in my JSPs like this:

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:out value="${test}" />

Is there a possibility to use this JSTL in my ExtJS?
What not functions is this for example in my JSP:

<script type="text/javascript">
var tabs = new Ext.TabPanel({
items: [{
title: '<c:out value="\${test}\" />',

Thanks for some help

2 Jan 2011, 10:56 AM
Spring, JSP and JSTL are all server-side technologies. When a request comes in they will run on the server and the resulting HTML/JavaScript will be sent back across the wire as the response. Any JavaScript, including ExtJS, will be evaluated client-side in the web browser. By the time the ExtJS is run the JSTL tags will be long gone.

There is nothing to stop you using JSTL with ExtJS. Both of these examples worked for me:

title: '<c:out value="${test}" />',
title: '${test}',The biggest gotcha is ensuring that you escape things correctly. The top example with apply some HTML escaping whereas the bottom one won't. The title config option for Ext.Panel takes HTML so the top example is probably better in this case. For cases where you don't want values HTML escaped you'll need to take care to ensure that they are escaped for use in JavaScript string literals.