3 Replies Latest reply: Jul 30, 2013 12:46 PM by user3924533 RSS

    EL problem in JSP page, boolean vs. String

    748953
      We are migrating from WebSphere 6 to WebLogic 11g and are receiving the following error from the JSP pages where we use EL to determine if an element is readonly or not:

      The method setReadonly(boolean) in the type BaseHandlerTag is not applicable for the arguments (String)

      In doing some testing I can simplify the problem to this:

      -----

      works (just using EL to set tab index)
      jsp:
      <c:set var="myTabIndex" value="765" />

      <html:text property="user.email" size="28" tabindex="${myTabIndex}" readonly="true" />

      source output:
      <input type="text" name="user.email" size="28" tabindex="765" value="abc@def.com" readonly="readonly">

      doesn't work (added EL to set readonly attribute)
      jsp:
      <c:set var="myTabIndex" value="765" />
      <c:set var="myReadOnly" value="true" />

      <html:text property="user.email" size="28" tabindex="${myTabIndex}" readonly="${myReadOnly}" />

      error output:
      userProfile.jsp:60:86: The method setReadonly(boolean) in the type BaseHandlerTag is not applicable for the arguments (String)
      <html:text property="user.email" size="28" tabindex="${myTabIndex}" readonly="${myReadOnly}" />

      -----

      I'm not sure what is going on here and have spent two days researching this and trying different things to no avail. I don't believe any casting should be necessary. I thought for a while EL was not enabled but in my working sample EL is being used to determine tab index. The 'does not work' code works ok in WebSphere 6 and Tomcat 6, so it is just WebLogic we are having an issue with.

      Thanks in advance for any help that can be provided.
      Michael
        • 1. Re: EL problem in JSP page, boolean vs. String
          748953
          Found more output in the log file that might be helpful (this is output from the real code, not the sample code I mentioned previously):

          weblogic.servlet.jsp.CompilationException: Failed to compile JSP /WEB-INF/modules/ContactTile.jsp
          ContactTile.jsp:241:17: The method setReadonly(boolean) in the type BaseHandlerTag is not applicable for the arguments (String)
          readonly="${displayonly}"
          ^--------------^

          at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:226)
          at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:162)
          at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:256)
          at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:216)
          at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:243)
          Truncated. see log file for complete stacktrace


          Michael
          • 2. Re: EL problem in JSP page, boolean vs. String
            867013
            I am not sure if you identified a solution for this problem. I ran into the same issue. All I did was replace the taglib http://struts.apache.org/tags-html-el with http://struts.apache.org/tags-html. It is working fine for me.
            • 3. Re: EL problem in JSP page, boolean vs. String
              user3924533

              Convert strin value to boolean using Boolean.parseBoolean() method then problem will disappear.

               

              For example :  instead of readonly="true"  

                                    use readonly = "<%=Boolean.parseBoolean("true")%>"

              Hope it helps.