Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2206

sx:submit does not evaluate expressions in the src attribute

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.1.0
    • Plugin - Mechanism
    • None

    Description

      While attempting to run the showcase app, I found an exception in the remotebutton example. The exception is as follows -
      2007-09-25 10:18:28,046 ERROR (org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[jsp]:250) - Servlet.service() for servlet jsp threw exception
      org.apache.jasper.JasperException: /ajax/remotebutton/index.jsp(52,0) According to TLD or attribute directive in tag file, attribute src does not accept any expressions
      at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
      at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
      at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
      at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:952)
      at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:706)
      at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1442)
      at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2164)
      at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2214)
      at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2220)
      at org.apache.jasper.compiler.Node$Root.accept(Node.java:457)
      at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2164)
      at org.apache.jasper.compiler.Validator.validate(Validator.java:1484)
      at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:167)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:296)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
      at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
      at java.lang.Thread.run(Thread.java:619)

      The offending JSP code is -

      <sx:submit type="image" label="Alt Text" targets="t1"
      src="${pageContext.request.contextPath}/images/struts-power.gif" href="%

      {ajaxTest}

      " />

      The generated TLD file indicates that expressions should not be evaluated in the src attribute. I will attach a patch which would fix the issue.

      Attachments

        1. Submit.java.patch
          0.6 kB
          Wes Wannemacher
        2. showcase-remotebutton-index.jsp.patch
          0.6 kB
          Wes Wannemacher

        Activity

          People

            musachy Musachy Barroso
            wesw@wantii.com Wes Wannemacher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: