I am learning Java servlets technology. In a bookt that I am reading, they have asked me to work in a notepad for time being.
When i Create a servlet in ec开发者_Python百科lipse, it just auto fills some content to that servlet class which I want to write on my own to learn stuff. For example, the doGet and doPost methods and their signatures.
I want to disable that auto filling in my files i create. How can i do it in Eclipse ?
Please help thanks
You can change the templates in the preferences (menu "Window/Preferences", then "Java/Code Style/Code Templates".
Don't create a Servlet with a new Servlet Wizard. Instead, create a class via the new Class wizard with the "Servlet" interface added, but do not check the "inherited abstract methods" checkbox (and if you don't want comments generated, unclick that as well). This will make your new class implement Servlet, but have errors until the appropriate method stubs are added.
But your book is ill-advised if it wants you to use Notepad. Your code won't compile without the stubs, and Eclipse knows that - Notepad is typo prone. Eclipse can and should do the hard work for you.
精彩评论