title: JSP & EL conflict with JSF 1.x actionListener
body: <p>I was working on a JSF 1.x example, which has some EL conflict in JSPs.
  the line <code>actionListener="#{helloBean.addControls}</code> is shooting an issue.</p>
  
  <p>The error is :</p>
  
  <pre><code>HTTP Status 500 - /JSP/hello.jsp (line: 37, column: 2) A literal value was specified for attribute actionListener that is defined as a deferred method with a return type of void. JSP.2.3.4 does not permit literal values in this case
  </code></pre>
  
  <p>My project Description is as follows :</p>
  
  <p><strong>Package Structure :</strong></p>
  
  <p><img src="https://i.stack.imgur.com/8Pev2.jpg" alt="POC"></p>
  
  <p><strong>Maven Dependencies :</strong> </p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.achutha.labs&lt;/groupId&gt;
      &lt;artifactId&gt;02JsfExample&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;name&gt;02JsfExample&lt;/name&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-api&lt;/artifactId&gt;
              &lt;version&gt;1.2_14&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;javax.faces&lt;/groupId&gt;
              &lt;artifactId&gt;jsf-impl&lt;/artifactId&gt;
              &lt;version&gt;1.2_14&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;jstl&lt;/artifactId&gt;
              &lt;version&gt;1.2&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
              &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
              &lt;artifactId&gt;jsp-api&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- EL --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.glassfish.web&lt;/groupId&gt;
              &lt;artifactId&gt;el-impl&lt;/artifactId&gt;
              &lt;version&gt;2.2&lt;/version&gt;
          &lt;/dependency&gt;
  
  
      &lt;/dependencies&gt;
  
  
      &lt;build&gt;
          &lt;finalName&gt;JavaServerFaces&lt;/finalName&gt;
  
          &lt;plugins&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;tomcat-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;url&gt;http://localhost:8090/manager/text&lt;/url&gt;
                      &lt;server&gt;TomcatServer&lt;/server&gt;
                      &lt;path&gt;/balaji&lt;/path&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p><strong>Faces Configuration :</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;!DOCTYPE faces-config PUBLIC
       "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd"&gt;
  
  &lt;faces-config&gt;
      &lt;managed-bean&gt;
          &lt;description&gt; The one and only HelloBean.&lt;/description&gt;
          &lt;managed-bean-name&gt;helloBean&lt;/managed-bean-name&gt;
          &lt;managed-bean-class&gt;com.achutha.bean.HelloBean&lt;/managed-bean-class&gt;
          &lt;managed-bean-scope&gt;session&lt;/managed-bean-scope&gt;
      &lt;/managed-bean&gt;
  
  
  
      &lt;navigation-rule&gt;
          &lt;description&gt;Navigation From the Hello Page.&lt;/description&gt;
          &lt;from-view-id&gt;/JSP/hello.jsp&lt;/from-view-id&gt;
          &lt;navigation-case&gt;
              &lt;from-outcome&gt;success&lt;/from-outcome&gt;
              &lt;to-view-id&gt;/JSP/goodbye.jsp&lt;/to-view-id&gt;
          &lt;/navigation-case&gt;
      &lt;/navigation-rule&gt;
  
  &lt;/faces-config&gt;
  </code></pre>
  
  <p><strong>Deployment Descriptor (web.xml) :</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
      "http://java.sun.com/dtd/web-app_2_3.dtd"&gt;
  
  &lt;web-app&gt;
      &lt;display-name&gt;Hello, World!&lt;/display-name&gt;
      &lt;description&gt;Welcome to JavaServer Faces&lt;/description&gt;
  
      &lt;servlet&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;servlet-class&gt;javax.faces.webapp.FacesServlet&lt;/servlet-class&gt;
          &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;/servlet&gt;
  
      &lt;servlet-mapping&gt;
          &lt;servlet-name&gt;Faces Servlet&lt;/servlet-name&gt;
          &lt;url-pattern&gt;/faces/*&lt;/url-pattern&gt;
      &lt;/servlet-mapping&gt;
  
      &lt;welcome-file-list&gt;
          &lt;welcome-file&gt;/JSP/hello.jsp&lt;/welcome-file&gt;
      &lt;/welcome-file-list&gt;
  
  
  &lt;/web-app&gt;
  </code></pre>
  
  <p><strong>hello.jsp</strong></p>
  
  <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%&gt;
  
  &lt;f:view&gt;
      &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;JSF In Action - Hello, world!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h:form id="welcomeForm"&gt;
          &lt;h:outputText id="welcomeOutput" value="Welcome to JavaServer Faces !"
              style="font-family: Arial, sans-serif; font-size: 23; color: green;" /&gt;
  
          &lt;p&gt;
              &lt;h:message id="errors" for="helloInput" style="color: red" /&gt;
          &lt;/p&gt;
  
          &lt;p&gt;
              &lt;h:outputLabel for="helloInput"&gt;
                  &lt;h:outputText id="helloInputLabel"
                      value="Enter Number of controls to display: "&gt;
  
                  &lt;/h:outputText&gt;
  
                  &lt;h:inputText id="helloInput" value="#{helloBean.numControls}"
                      required="true"&gt;
                      &lt;f:validateLongRange minimum="1" maximum="500" /&gt;
                  &lt;/h:inputText&gt;
              &lt;/h:outputLabel&gt;
          &lt;/p&gt;
  
          &lt;p&gt;
              &lt;h:panelGrid id="controlPanel" binding="#{helloBean.controlPanel}"
                  columns="20" border="1" cellspacing="0" /&gt;
          &lt;/p&gt;
  
          &lt;h:commandButton id="redisplayCommand" type="submit" value="Redisplay"
              actionListener="#{helloBean.addControls}" /&gt;
  
          &lt;h:commandButton id="goodbyeCommand" type="submit" value="Goodbye"
              actionListener="#{helloBean.goodbye}" immediate="true"/&gt;
  
      &lt;/h:form&gt;
  
  &lt;/body&gt;
  
      &lt;/html&gt;
  
  &lt;/f:view&gt;
  </code></pre>
  
  <p><strong>goodbye.jsp :</strong></p>
  
  <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%&gt;
  &lt;f:view&gt;
      &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Jsf in Action - Hello World!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h:form id="goodbyeForm"&gt;
          &lt;p&gt;
              &lt;h:outputText id="welcomeOutput" value="Good Bye"
                  style="font-family: Arial, sans-serif; font-size: 24; font-style: bold; color: green;" /&gt;
  
          &lt;/p&gt;
          &lt;p&gt;
              &lt;h:outputText id="helloBeanOutputLabel"
                  value="Number of controls displayed: " /&gt;
              &lt;h:outputText id="helloBeanOutputLabel"
                  value="#{helloBean.numControls}" /&gt;
          &lt;/p&gt;
      &lt;/h:form&gt;
  
  &lt;/body&gt;
      &lt;/html&gt;
  &lt;/f:view&gt;
  </code></pre>
  
  <p><strong>Bean class :</strong></p>
  
  <pre><code>package com.achutha.bean;
  
  import java.util.List;
  
  import javax.faces.application.Application;
  import javax.faces.component.UIComponent;
  import javax.faces.component.html.HtmlOutputText;
  import javax.faces.component.html.HtmlPanelGrid;
  import javax.faces.context.FacesContext;
  import javax.faces.event.ActionEvent;
  
  public class HelloBean {
  
      private int numControls;
      private HtmlPanelGrid controlPanel;
  
      public int getNumControls() {
          return numControls;
      }
  
      public void setNumControls(int numControls) {
          this.numControls = numControls;
      }
  
      public HtmlPanelGrid getControlPanel() {
          return controlPanel;
      }
  
      public void setControlPanel(HtmlPanelGrid controlPanel) {
          this.controlPanel = controlPanel;
      }
  
      public void addControls(ActionEvent actionEvent) {
          Application application = FacesContext.getCurrentInstance()
                  .getApplication();
  
          List&lt;UIComponent&gt; children = controlPanel.getChildren();
  
          children.clear();
  
          for (int count = 0; count &lt; numControls; count++) {
              HtmlOutputText output = (HtmlOutputText) application
                      .createComponent(HtmlOutputText.COMPONENT_TYPE);
              output.setValue(" " + count + " ");
              output.setStyle("color: blue");
              children.add(output);
          }
      }
  
      public String goodbye() {
          return "success";
      }
  
  }
  </code></pre>
  
  <p><strong>Clean Deployment :</strong> The application is deploying itself fine on Tomcat 7. I checked the deployed package structure on &amp;tomcat_home%/webapps and everything is in proper place as expected.</p>
  
  <p>But when i run the application on a browser I get the following error  :</p>
  
  <pre><code>HTTP Status 500 - /JSP/hello.jsp (line: 37, column: 2) A literal value was specified for attribute actionListener that is defined as a deferred method with a return type of void. JSP.2.3.4 does not permit literal values in this case
  
  type Exception report
  
  message /JSP/hello.jsp (line: 37, column: 2) A literal value was specified for attribute actionListener that is defined as a deferred method with a return type of void. JSP.2.3.4 does not permit literal values in this case
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  org.apache.jasper.JasperException: /JSP/hello.jsp (line: 37, column: 2) A literal value was specified for attribute actionListener that is defined as a deferred method with a return type of void. JSP.2.3.4 does not permit literal values in this case
      org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
      org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
      org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:149)
      org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1151)
      org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:875)
      org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
      org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
      org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:894)
      org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
      org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
      org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:894)
      org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
      org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428)
      org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434)
      org.apache.jasper.compiler.Node$Root.accept(Node.java:475)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376)
      org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1795)
      org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  </code></pre>
  
  <p>I am not finding a suitable one stop solution for this issue. 
  It is the EL used on the line <code>actionListener="#{helloBean.addControls}</code> which is raising the complications.
  Please let me know the solution.</p>