aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes java code templates [Eclipse] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "java code templates [Eclipse]" Watch "java code templates [Eclipse]" New topic
Author

java code templates [Eclipse]

asirob civokviz
Greenhorn

Joined: Jun 12, 2004
Posts: 24
Hi,
I am pretty new to Eclipse and I'm trying to find plugin or a feature
of that IDE that can automatically generate templates for java classes.
For example when I create new servlet it would be nice if Eclipse
create common code for all servlets:

public class ServletName extends HttpServlet{

doPost(request,response){}

doGet(...){}

...

}

Anyone knows how to find this plugin or configure Eclipse to do this???

Thanks
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29233
    
138

Asirob,
I can think of ways to do it in two steps.

Approach 1:
a) New class --> extends HttpServlet
b) Overwrite/implements methods --> pick those two

Approach 2:
a) New class --> extends HttpServlet
b) Create a template called "servlet" to expand to the two methods. Templates are defined in the Eclipse preferences under the java section.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java code templates [Eclipse]
 
Similar Threads
Lomboz not creating XDoclet code
Eclipse: can I override ${user}?
Lomboz not creating XDoclet code
New file template in eclipse
Eclipse plugin to creat a custom javaclass