代码模板缩写:快速参考

另请参见

键入代码时,可键入缩写以通过模板来生成代码,从而减少击键数。键入空格后,缩写将展开为模板。编辑 Java 文件时,如果使用代码完成,则也会显示代码模板。

IDE 提供了一组代码模板。您也可以创建自己的代码模板。

下面是 IDE 缺省提供的代码模板列表。

Java 文件

缩写 代码模板
En Enumeration
Ex Exception
Ob Object
Psf public static final
Psfb public static final boolean
Psfi public static final int
Psfs public static final String
St String
ab abstract
bo boolean
br break
ca catch (
cl class
cn continue
df default:
dowhile
do {
        
} while (condition);
eq equals
ex extends
fa false
fi final
fl float
forc
for (Iterator it = collection.iterator(); it.hasNext();) {
    Object elem = (Object) it.next();
        
}
fore
for (Object elem : iterable) {

}
fori
for (int i = 0; i < SCRAMBLED_WORD_LIST.length; i++) {

}
fy finally
ie interface
ifelse
if (condition) {

} else {

}
im implements
iof instanceof
ir import
le length
newo
Object name = new Object(args);
pe protected
pr private
psf private static final
psfb private static final boolean
psfi private static final int
psfs private static final String
pst printStackTrace();
psvm
public static void main(String[] args) {

}
pu public
re return
serr System.err.println("|");
sout System.out.println("|")
st static
sw switch (
sy synchronized
tds Thread.dumpStack();
th throws
trycatch
try {

} catch(Exception e) {

}
tw throw
twn throw new
wh While (
whilei
    while (it.hasNext()) {
        Object elem = (Object) it.next();
        
    }

JSP 文件

缩写 代码模板
ag application.getAttribute("|")
ap application.putAttribute("|",)
ar application.removeAttribute("|")
cfgi config.getInitParameter("|")
jspf <jsp:forward page="|"/>
jspg <jsp:getProperty name="|" property="|"/>
jspi <jsp:include page="|"/>
jspp
<jsp:plugin type="|" code="" codebase="">
</jsp:plugin>
jsps <jsp:setProperty name="|" property=""/>
jspu <jsp:useBean id="|" type=""/>
oup out.print("|")
oupl out.println("|")
pcg pageContext.getAttribute("|")
pcgn pageContext.getAttributeNamesInScope("|")
pcgs pageContext.getAttributesScope("|")
pcr pageContext.removeAttribute("|")
pcs pageContext.setAttribute("|",)
pg <%@page |%>
pga <%@ page autoFlush="false"%>
pgb <%@ page buffer="|kb"%>
pgc <%@page contentType="|"%>
pgerr <%@page errorPage="|"%>
pgex <%@page extends="|"%>
pgie <%@page isErrorPage="true"%>
pgim <%@page import="|"%>
pgin <%@page info="|"%>
pgit <%@page isThreadSafe="false"%>
pgl <%@page language="java"%>
pgs <%@page session="false"%>
rg request.getParameter("|")
sg session.getAttribute("|")
sp session.setAttribute("|", )
sr session.removeAttribute("|")
tglb <%@taglib uri="|"%>

XML 文件

缩写 代码模板
!at <!ATTLIST |>
cd <![CDATA[|]]>
do <!DOCTYPE
!el <!ELEMENT |>
!en <!ENTITY |>
?xm <?xml version="1.0" encoding="UTF-8"?>
pu PUBLIC "|"
sy SYSTEM "|"

DTD 文件

缩写 代码模板
!el <!ELEMENT |>
!en <!ENTITY |>
!no <!NOTATION |>
cd CDATA
em EMPTY
ZH_CN ENTITY
ens ENTITIES
fi #FIXED
im #IMPLIED
nm NMTOKEN
nms NMTOKENS
nn NOTATION
pc #PCDATA
pu PUBLIC "|"
re #REQUIRED
rf IDREF
rfs IDREFS
sy SYSTEM "|"

CSS 文件

缩写 代码模板
bg background:
di display:
fs font-size:
另请参见
通过模板插入代码
快捷键

法律声明