简体   繁体   English

如何配置JBoss来修剪JSP生成的其他空格?

[英]How do you configure JBoss to trim additional whitespaces generated by JSPs?

Getting lots of additional whitespace in the html output, looks like its because of the JSP tags =/ 在html输出中获得大量额外的空格,看起来像是因为JSP标签= /

I saw this referenced somewhere: 我在某处看到了这个引用:

<init-param>
  <param-name>trimSpaces</param-name>
  <param-value>true</param-value>
</init-param>

That should put it in web.xml , I tried that but that didn't seem to work. 这应该把它放在web.xml ,我尝试过,但似乎没有用。 Maybe I'm not putting it in the right node. 也许我不把它放在正确的节点上。 Or maybe theres another way to do this. 或者也许是另一种方式来做到这一点。

Thanks 谢谢

I dont have the CATALINA_HOME var set anywhere. 我没有在任何地方设置CATALINA_HOME var。

The mentioned <init-param> should be added to the "jsp" servlet in $CATALINA_HOME/conf/web.xml . 应将提到的<init-param>添加到$CATALINA_HOME/conf/web.xml的“jsp”servlet中。 Is this what you tried? 这是你试过的吗?

(EDIT: $CATALINA_HOME was just a way to designate the root of Tomcat and that the modification had to be done in Tomcat, not in the WEB-ING/web.xml of your webapp. Anyhow, for JBoss which is embedding Tomcat , and depending on the version you are using, you'll find the mentioned file here: $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml . Here again, $JBOSS_HOME is the root of your JBoss installation, it may not be set as environment variable.) (编辑:$ CATALINA_HOME只是一种指定Tomcat根目录的方法,并且修改必须在Tomcat中完成,而不是在webapp的WEB-ING/web.xml中完成。无论如何,对于嵌入Tomcat的 JBoss,以及根据您使用的版本,您可以在此处找到所提到的文件: $JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml 。再次,$ JBOSS_HOME是JBoss安装的根目录,它可能不会被设置为环境变量。)

After some digging around, i found the procedure for JBoss AS 7. If anyone is interested: in your standalone.xml, find the section 经过一番挖掘,我找到了JBoss AS 7的程序。如果有人感兴趣:在你的standalone.xml中,找到该部分

<subsystem xmlns="urn:jboss:domain:web:  ... >

And add this directive: 并添加此指令:

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

Here are other attributes you may use 您可以使用以下其他属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM