eclipse Eclipse中JSP的格式规则

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3283245/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:54:27  来源:igfitidea点击:

Formatting rules of JSP in Eclipse

eclipsejspformatting

提问by Emerson

Eclipse has a huge number of formatting rules for Java and Javascripting, which can be reached via "code-style" option under java and javascript. I couldn't find any JSP settings for formatting rules. Is there any?

Eclipse 有大量的 Java 和 Javascripting 格式规则,可以通过 java 和 javascript 下的“代码样式”选项来实现。我找不到格式化规则的任何 JSP 设置。有没有?

I could find a few basic setting in Web->JSP Files->Editor which redirects to Web->Html->Editor and Web->XML->Editor. This options include splitting attributes, clean blank lines, whitespace padding and indentation style (tabs/spaces). I can confirm that the XML settings are used when formatting JSP pages. HTML editor is used only for the length of line.

我可以在 Web->JSP Files->Editor 中找到一些基本设置,它们重定向到 Web->Html->Editor 和 Web->XML->Editor。此选项包括拆分属性、干净的空白行、空白填充和缩进样式(制表符/空格)。我可以确认在格式化 JSP 页面时使用了 XML 设置。HTML 编辑器仅用于行的长度。

Also, how do I export these settings? Are they exported via File->Export->General-Preferences?

另外,如何导出这些设置?它们是通过 File->Export->General-Preferences 导出的吗?

采纳答案by Emerson

The xml formatting configuration ISexported through File->Export->General-Preferences. Just made a test comparing the exported file before and after changing the indentation size an char, and the following settings were changed in the exported file:

xml 格式配置通过 File->Export->General-Preferences 导出的。刚刚做了一个测试,比较了将缩进大小更改为字符前后的导出文件,导出文件中更改了以下设置:

/instance/org.eclipse.wst.xml.core/indentationSize=2 /instance/org.eclipse.wst.xml.core/indentationChar=space

/instance/org.eclipse.wst.xml.core/indentationSize=2 /instance/org.eclipse.wst.xml.core/indentationChar=space

Also the html formatting is exported, here is the setting changed when I modified the line width for html:

还导出了 html 格式,这是我修改 html 的线宽时更改的设置:

/instance/org.eclipse.wst.html.core/lineWidth=132

/instance/org.eclipse.wst.html.core/lineWidth=132