Created
November 25, 2012 06:29
-
-
Save lalthomas/4142631 to your computer and use it in GitHub Desktop.
context text editor java autotext template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[for | for block] | |
for (int i=0; i<|; i++) {} | |
[prog | Java Program Template] | |
public class |MyProg { | |
/** Code documentation here */ | |
public static void main(String[] args) { | |
/* multi-line and semi-line comments here */ | |
// one-line comments here | |
System.out.println("Hello, world"); | |
} | |
} | |
[servlet | Java Servlet Skeleton] | |
import java.io.*; | |
import javax.servlet.*; | |
import javax.servlet.http.*; | |
public class |MyServlet extends HttpServlet { | |
PrintWriter out; | |
public void doGet(HttpServletRequest req, HttpServletResponse res) { | |
try { | |
res.setContentType("text/html"); | |
out = res.getWriter(); | |
String html = "<html>Hello, world</html>"; | |
out.println(html); | |
} | |
catch (Exception e) { e.printStackTrace(); } | |
} | |
public void doPost(HttpServletRequest req, HttpServletResponse res) { | |
try { | |
res.setContentType("text/html"); | |
out = res.getWriter(); | |
String html = "<html>Hello, world</html>"; | |
out.println(html); | |
} | |
catch (Exception e) { e.printStackTrace(); } | |
} | |
} | |
[try | try-catch block] | |
try { | |
| | |
} | |
catch (Exception e) { | |
System.out.println("Unexpected exception"); | |
e.printStackTrace(); | |
} | |
finally {} | |
[while | while block] | |
int i=0; | |
while (i < |) { | |
i++; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment