Tuesday, February 15, 2011

Writing your first JSP

JSP is used to simply put Java code inside the HTML pages.  This means that you can actually take any of the existing HTML pages that you have and change their extensions to ".jsp" which are now ".html" or “.htm”. 
So open notepad in windows. Write this

<HTML>
<BODY>
Hello, world
</BODY>
</HTML>

Save it with the extension of “.jsp".  Now open this file in your browser.
The page will take a bit of time when it is loaded for the first time. After first time execution it will load normally.
So what basically happens when you try to load your page for the fist time?
JSP is turned into a Java file, which is then compiled and loaded.  As you know well compilation for java only happens once, so loading it again and again does not take much time now. Remember, every time you’ll change or edit the JSP file, the same process will repeat itself i.e. first time compilation.
Next tutorial ill show what makes JSP useful.

No comments:

Post a Comment

Please comment, if you like the post, you find any mistake or if you have any query.