这个jsp调用之间的间隔有问题
have a problem with the spacing between this jsp calls
<tr> <%=Constants.getTextInput("", Texts.RNG_IDENT_MSG, "", "", 19)%> <%=Constants.getTextInput("", Texts.RNG_IDENT_MSG_UNTIL, "", "", 19)%> </tr>在屏幕中间有一个空格,我想删除它。 有人可以帮我吗?
In the screen there's a space between them, that i want to remove. Can someone help me?
我试过css和其他格式,但仍然没有。
P.S. i tried css and other formats but still nothing.
PS2:这是一个HTML页面,getTextInput它是一个函数来创建一个盒子。 b $ b
P.S.2: This is in a HTML page and getTextInput it's a function to "create" a box
推荐答案您可以使用指令 trimDirectiveWhitespaces $ b
You can use the directive trimDirectiveWhitespaces
<%@ page trimDirectiveWhitespaces="true"%>这应该会消除动作,脚本和指令之间的空白。
This should remove white spaces between actions, scriptlets and directives.
下面是我在Glassfish 4.0上获得的一个例子:
Here an example of what i get on Glassfish 4.0:
with<%@ page trimDirectiveWhitespaces = jsp中的true%>
with <%@ page trimDirectiveWhitespaces="true"%> in the jsp
<%@ page trimDirectiveWhitespaces="true"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="java.sun/jsp/jstl/core" prefix="c" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <table> <tr> <%="1111111111"%> <%="2222222222"%> <c:out value="c:out"></c:out> <c:out value="LOOP"></c:out> <c:forEach begin="1" end="5" step="1" var="y"> ${'qqqqq'} ${'RRR'} <c:out value="c:out"></c:out> <% out.println("InTheLoop"); %> </c:forEach> </tr> </table> </body> </html>
浏览器中收到的源代码:
Source code received in browser:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <table> <tr> 11111111112222222222c:outLOOPqqqqqRRRc:outInTheLoop qqqqqRRRc:outInTheLoop qqqqqRRRc:outInTheLoop qqqqqRRRc:outInTheLoop qqqqqRRRc:outInTheLoop </tr> </table> </body> </html>
与上面相同的JSP代码,但加上 或 without trimDirectiveWhitespaces 在所有 中生成浏览器中收到的以下代码:
The same JSP code as above but with <%@ page trimDirectiveWhitespaces="false"%> Or without trimDirectiveWhitespaces at all produce the folowing code received in browser:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <table> <tr> 1111111111 2222222222 c:out LOOP qqqqq RRR c:out InTheLoop qqqqq RRR c:out InTheLoop qqqqq RRR c:out InTheLoop qqqqq RRR c:out InTheLoop qqqqq RRR c:out InTheLoop </tr> </table> </body> </html>
所以trimDirectiveWhitespace =true:
- 您可以删除动作,脚本,表达式,指令之间的空格。 但是,您不能删除其他html标记之间的空格
- you can remove whitespaces between actions, scriptlets, expressions, directives.
- But you can NOT remove whitespaces between other html tags
更多推荐
删除JSP变量之间的间距
发布评论