If you really need space sometimes,you can use  

On Mon, 18 Jun 2007 09:47:39 -0700 (PDT)
LiuYan_刘研 <[EMAIL PROTECTED]> wrote:

> 
> Thank you Leon, the 'trimSpaces' servlet parameter works fine except some
> little issues: 
> 1. The span it trimmed is a little wider, it even trimmed the continuous
> empty lines and the leading white spaces of the first line after directives..
> <[EMAIL PROTECTED]>
> <[EMAIL PROTECTED]>
> 
> 
> 
> <[EMAIL PROTECTED]>
> will output nothing to client, but I want to keep the empty line 3,4,5 which
> are not in the same lines to directives.
> 
> 
> 2. the evaluated body in <c:forEach></forEach> is trimmed as the same indent
> as the tag directive if there are differnce between them. see the following
> example JSP code:
> --------------------------------------------------------
> 
> 
> 
> 
> 
> 
> 
> 
> <%@ page
>   session="true"
>   contentType="text/html; charset=UTF-8"
>   import="java.util.*"
> %>
> 
> <%-- JSTL 1.1 tag library --%>
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
> <%-- JSTL 1.0 tag library --%>
> <%--@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; --%>
> 
> <%-- 中文 used for save this file as UTF-8 encoding --%>
> <html>
> <head>
> <style type="text/css">
> pre,code { border:1px solid}
> </style>
> </head>
> <body>
> 
> <%
> ArrayList<String> arrayTest =  new ArrayList<String>();
> pageContext.setAttribute ("test", arrayTest);
> for(int i=1; i<=5; i++)
> {
>       arrayTest.add (String.valueOf(i));
> }
> %>
> 
> 
>       <pre>
>               Case 1: c:forEach has 0 indent, non-whitespace characters 
> occurs BEFORE
> c:out
> <c:forEach var="t" items="${test}">
>               Line <c:out value="${t}"/>
> </c:forEach>
>       </pre>
>       <pre>
>               Case 2: c:forEach has 2 tabs indent, non-whitespace characters 
> occurs
> BEFORE c:out
>               <c:forEach var="t" items="${test}">
>               Line <c:out value="${t}"/>
>               </c:forEach>
>       </pre>
>       <pre>
>               Case 3: c:forEach has 0 indent, non-whitespace characters 
> occurs AFTER
> c:out
> <c:forEach var="t" items="${test}">
>               <c:out value="${t}"/> Line
> </c:forEach>
>       </pre>
>       <pre>
>               Case 4: c:forEach has 2 tabs indent, non-whitespace characters 
> occurs
> AFTER c:out
>               <c:forEach var="t" items="${test}">
>               <c:out value="${t}"/> Line
>               </c:forEach>
>       </pre>
>       <pre>
>               Case 5: c:forEach has 2 tabs indent, there are no non-whitespace
> characters around c:out
>               <c:forEach var="t" items="${test}">
>               <c:out value="${t}"/>
>               </c:forEach>
>       </pre>
>       <table border="1">
>               <tr>
>                       <c:forEach var="t" items="${test}">
>                       <td>
>                               <c:out value="${t}"/>
>                       </td>
>                       </c:forEach>
>               </tr>
>       </table>
> 
> </body>
> </html>
> --------------------------------------------------------
> Unfortunately, non of these 5 cases meet my demand.
> 
> The behaviour of 'trimSpaces' in my mind will be:
> 1. Trim only whitespace characters if there are no non-whitespace characters
> in the directive line
> 2. An exception to 1: Do not trim whitespace characters which the directive
> will generate outputs (such as c:out of JSTL or bean:write, bean:message of
> struts ), maybe this is a trouble to JSP compiler, because it needs knows
> behaviour of tags: which tags are logical tags and which tags are html tags,
> but it is really good if 'trimSpaces' can achieve this.
> 3. Do not trim any other lines which does not contain directives.
> 
> Wish the JSP compiler can enhance 'trimSpaces' in details...
> (I'm thinking: Am I a boring man... -_-!)
> 
> But anyways, the 'trimSpaces' parameter is a good stuff for me now than
> having not it.
> 
> 
> 
> Leon Rosenberg-3 wrote:
> > 
> > trimSpaces was once a setting in the declaration of the jsp servlet in
> > the web.xml
> > 
> >    <servlet>
> >         <servlet-name>jsp</servlet-name>
> >        
> > <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
> >         <init-param>
> >             <param-name>trimSpaces</param-name>
> >             <param-value>true</param-value>
> >         </init-param>
> > ...
> > 
> > 
> > regards
> > Leon
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Is-there-a-config-for-JSP-compiler-to-ignore--%5Cs--chars-in-JSP-directive-line--tf3939116.html#a11179552
> Sent from the Tomcat - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

----------------------------
吴熊敏 <[EMAIL PROTECTED]>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to