The sample page you'll be creating just adds 2 + 2. Resin's web server stores its pages in a directory named doc. On this machine it's Create the text file (C:\resin-2.0.2\doc\java_tut\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://www.jfrn.gov.br:83/test/add.jsp If everything works, you should see the following page:
An explanationThe 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 directive <%@ page language=java %> told Resin that the scripting language should be Java. 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.
|