5 Replies Latest reply on Jul 29, 2016 9:38 AM by dniklas

    Does Wildfly support jsp trim space?

    peppem

      Hello guys,

      Does wildfly 9 supports trim space for jsp container?

      (if a jsp contains html with many spaces.. the jsp container remove they automatically)

       

      In

      Undertow (web) subsystem configuration - WildFly 9 - Project Documentation Editor

      seems there aren't any directive.

        • 1. Re: Does Wildfly support jsp trim space?
          ctomc

          Yes,

           

          you can configure jsp container inside undertow subsystem, see wildfly/wildfly-undertow_2_0.xsd at 9.0.1.Final · wildfly/wildfly · GitHub for all configuration options, on of them being trim-spaces as well.

          • 2. Re: Does Wildfly support jsp trim space?
            peppem

            Thank you Tomaz!

            I add it in my standalone-full.xml

             

            <servlet-container name="default" default-encoding="utf-8">

                            <jsp-config trim-spaces="true"/>

                            <persistent-sessions path="session" relative-to="jboss.server.temp.dir"/>

                            <websockets/>

            </servlet-container>

             

            but with this test.jsp:

             

            <html>

                <head>

                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

                    <title>JSP Page</title>

                </head>

                <body>

                    <h1>  Hello World!</h1>

                   

                    <div>                               prova</div>

                </body>

            </html>

             

            the spaces are not trimmed..

            • 3. Re: Does Wildfly support jsp trim space?
              dniklas

              Hi,

               

              same problem here (Wildfly 10). I tried this configuration:

                          <servlet-container name="default">

                              <jsp-config trim-spaces="true"/>

                              <websockets/>

                          </servlet-container>

              Spaces are no trimmed, what is missing?

               

              Best regards

              Daniel

              • 4. Re: Does Wildfly support jsp trim space?
                jaikiran

                Daniel, what do your JSP pages look like and what do they look like when rendered? Which exact file did you make that change to and how (directly to xml?) and what command do you use to start the server?

                • 5. Re: Does Wildfly support jsp trim space?
                  dniklas

                  Hi,

                   

                  i used "ClusterWebApp.war" for this test. I changed ./<wildfly-home>/standalone/configuration/standalone.xml (when server was stopped) and i start the server with./<wildfly-home>/standalone.bat.

                  There is an (simple) index.jsp included. I added some more whitespace, somthing like this:

                   

                  <html>

                  <head>

                      <title>Session test App</title>

                  </head>

                  <body>

                  <center>

                      <h1>Session Replication test App.</h1>

                      <%

                           session.setAttribute("SessionKey","SessionKeyValue Set at "+new java.util.Date());

                           System.out.println("\n\t index.jsp setAttribute() called on Session with value = "+(String)session.getAttribute("SessionKey"));

                      %>

                   

                   

                     <h2>Attribute "SessionKey" is set in the HttpSession</h2>

                      session.getAttribute("SessionKey") = <%=session.getAttribute("SessionKey") %>  

                      <BR>       <BR>

                      session.getId() = <%=session.getId() %> 

                     <BR> <BR>

                     <a href="sessionCheck.jsp">Click Here to move to nextPage sessionCheck.jsp</a>

                    </center>

                  <BR>

                  <BR>

                  <b><font color="red">NOTE:</font></b> Please check the value of HttpSession Attribute which displays the timestamp when the attribute was created & set inside the HttpSession, Which is useful to check whether it's a new HttpSession with new Attribute or the replicated HttpSession with the same attribute.

                   

                   

                      As many times you will refresh the "index.jsp" page a new HttpSession attribute will be added with current TimeStamp.

                   

                   

                  </body>

                  </html>

                   

                  The response looks like this:

                  <html>

                  <head>

                      <title>Session test App</title>

                  </head>

                  <body>

                  <center>

                      <h1>             Session Replication test App.                     </h1>

                      <h2>Attribute "SessionKey"                             is set in the                               HttpSession</h2>

                      session.getAttribute("SessionKey") = SessionKeyValue Set at Fri Jul 29 15:37:42 CEST 2016<BR>       <BR>

                      session.getId() = RMVniwgpYJY4-O7pSSnC61tr5VpsxfdBEq8W9hb-<BR> <BR>

                     <a href="sessionCheck.jsp">Click Here to move to nextPage sessionCheck.jsp</a>

                    </center>

                  <BR>

                  <BR>

                  <b><font color="red">NOTE:</font></b> Please                              check the value of HttpSession Attribute which displays the timestamp when the attribute was created & set inside the HttpSession, Which is useful to check whether it's a new HttpSession with new Attribute or the replicated HttpSession with the same attribute.

                  <BR>

                      As many times you will refresh the "index.jsp" page a new HttpSession attribute will be added with current TimeStamp.

                   

                   

                  </body>

                  </html>

                   

                  In my opinion, to much whitespace left ;-)

                   

                  Daniel