Community
Participate
Working Groups
Build Identifier: I20100519-1548 When the JSF XHTML template is used for JSP files in a JSF project, these JSP's fail to deploy. Reproducible: Always Steps to Reproduce: 1. Create a new dynamic web project with the JSF 2.0 facet (or 1.2 facet) 2. Right-click on the WebContent folder in the project > New > JSP file 3. Enter a name for the JSP and click Next. 4. Select the JSP template "New JavaServer Faces (JSF) Page (xhtml)" 5. Add a managed bean called "LoginBean" 6. Add the following tag to the JSP: <h:inputText value="#{loginBean.name}"></h:inputText> 7. Deploy the JSP (say on Tomcat) Expected Result: The JSP should deploy successfully. Actual Result: An exception is thrown pointing to the EL expression. org.apache.jasper.JasperException: /index.jsp(16,25) #{..} is not allowed in template text org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102) org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:711) org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:935) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2394) org.apache.jasper.compiler.Node$Root.accept(Node.java:489) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338) org.apache.jasper.compiler.Validator.validate(Validator.java:1737) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:178) org.apache.jasper.compiler.Compiler.compile(Compiler.java:306) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:273) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542) com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:355) com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
I was able to reproduce this bug when using even a simple JSF file without any EL expressions: ---------------------------------------- index.jsp ---------------------------------------- <?xml version="1.0" encoding="ISO-8859-1" ?> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Insert title here</title> </head> <body> <f:view> <h:outputLabel value="SomeText"></h:outputLabel> </f:view> </body> </html> ---------------------------------------- If the above page is deployed, no exception is seen, but a blank page is rendered.
This bug also appears to apply when deploying a JSP file created using the "New JSP (xhtml)" template.
I'm confused, why are you using an XHTML template when creating a JSP? The index.jsp you quoted is not a JSP. It's a Facelet. Is your project configured to run facelets that use .jsp extension? For example, what's the value of DEFAULT_SUFFIX context-param in your web.xml?
Comment 3