Announcement Announcement Module
Collapse
No announcement yet.
Scripting elements ...... are disallowed here Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scripting elements ...... are disallowed here

    I have the following scriptlet in a jsp file

    <%
    System.out.println( "Evaluating date now" );
    java.util.Date date = new java.util.Date();
    %>
    Hello! The time is now <%= date %>

    But I get the following error, anybody knows how to fix this?
    I am using Spring 3 and Tile 2.2.1


    org.apache.jasper.JasperException: /WEB-INF/jsp/product.jsp(816,2) Scripting elements ( &lt;%!, &lt;jsp:declaration, &lt;%=, &lt;jsp:expression, &lt;%, &lt;jsp:scriptlet ) are disallowed here.
    org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:88)
    org.apache.jasper.compiler.Parser.parseElementsScr iptless(Parser.java:1454)
    org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1385)
    org.apache.jasper.compiler.Parser.parseBody(Parser .java:1630)
    org.apache.jasper.compiler.Parser.parseOptionalBod y(Parser.java:974)
    org.apache.jasper.compiler.Parser.parseCustomTag(P arser.java:1242)
    org.apache.jasper.compiler.Parser.parseElementsScr iptless(Parser.java:1467)
    org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1385)
    org.apache.jasper.compiler.Parser.parseBody(Parser .java:1630)
    org.apache.jasper.compiler.Parser.parseOptionalBod y(Parser.java:974)
    org.apache.jasper.compiler.Parser.parseCustomTag(P arser.java:1242)
    org.apache.jasper.compiler.Parser.parseElementsScr iptless(Parser.java:1467)
    org.apache.jasper.compiler.Parser.parseBody(Parser .java:1633)
    org.apache.jasper.compiler.Parser.parseOptionalBod y(Parser.java:974)
    org.apache.jasper.compiler.Parser.parseCustomTag(P arser.java:1242)
    org.apache.jasper.compiler.Parser.parseElementsScr iptless(Parser.java:1467)
    org.apache.jasper.compiler.Parser.parseBody(Parser .java:1633)
    org.apache.jasper.compiler.Parser.parseOptionalBod y(Parser.java:974)
    org.apache.jasper.compiler.Parser.parseCustomTag(P arser.java:1242)
    org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1418)
    org.apache.jasper.compiler.Parser.parse(Parser.jav a:130)
    org.apache.jasper.compiler.ParserController.doPars e(ParserController.java:255)
    org.apache.jasper.compiler.ParserController.parse( ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:185)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:347)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:327)
    org.apache.jasper.compiler.Compiler.compile(Compil er.java:314)
    org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:589)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
    org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:238)
    org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:1047)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:817)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.p rocessRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:617)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
    Last edited by shahin; May 25th, 2011, 12:22 AM.

  • #2
    I am using Tile 2.2.1. when I put the scriplet out of tile tag then there is no problem.

    <tiles:insertDefinition name="${_template}" flush="true">
    <tilesutAttribute name="content" type="string">

    JSTL code...

    </tilesutAttribute>
    </tiles:insertDefinition>

    Comment

    Working...
    X