The sample page you'll be creating adds 2 + 2 and displays the result in the browser.
JSP pages are created by putting afile in the document directory. The JSP page is a mixture of HTML and Java code. Resin's JSP engine compiles the .jsp file into a Java servlet and then runs the servlet to produce the output.
Resin's web server stores its pages in a directory named doc. On this machine it's
Create the text file(D:\Data\Server\resin-2.1.12\doc\test\add.jsp) with your favorite text editor: notepad, emacs, vi, or whatever. It should contain the following text:
To see Resin in action, you need to look at the page in the browser. The URL is http://ebncit.com:80/test/add.jsp
If everything works, you should see the following page:
The web server uses the '.jsp' extension to make 'add.jsp' an active page. For HTML pages and GIF files, the web server just copies the file from your computer to the browser. That's why looking at the file index.html in your browser looks the same as looking at http://localhost:8080/index.html.
By default, Resin copies text to the browser. For example, Resin copied the '2 + 2 = ' to the browser. In fact, if you wrote a JSP file with no special tags, Resin would copy it entirely to the browser; it would be equivalent to an '.html' file. Resin is smart enough to see that the page is static, so it can avoid working hard.
The special tags '<%' and '%>' tell Resin to do something active, something script related. You will only need to learn a few of these special tags:
In the add.jsp example, the expression tags, e.g. <%= 2 + 2 %>, tell Resin to evaluate the text as a Java expression and print the result to the browser. In this case, 4.