How to use a .JSP file

1

I am extremely new to the JSP language, I wanted to know how to use a jsp file that I created and exported for example in the browser, the same way I do with html files, ie how to use a jsp file created ??? obs : In the attached image is the result when I open the .jsp file with the browser (which is not the output I want).

<%! int i %>
<html>
  <head>
         <title> Pagina JSP Ola Mundo</title>
  </head>
  <body>
    <% for(i = 0; i = 3; i++){ %>
        <div>
          <%out.println("numero:"+i);%>
        </div>
    <%
       }
    %>
  </body>

</hmtl>

    
asked by anonymous 11.04.2018 / 15:58

2 answers

2

You can not open a JSP file directly in the browser because it is a language "above" HTML. This means you need a web container to identify the JSP components of the file and allow them to be viewed as an HTML file. The browser does not have native support for identifying these components and that is why you need your project containing the JSP to include the jsp-api and jstl libraries, which are used by the web container to render the page. p>

A minimal example of a web application using JSP can be seen in this link .

    
11.04.2018 / 16:59
0

Install Tomcat:

link

With Tomcat installed you can start JSP development. To start the development you should create an easyjava directory in C: \ Program Files (x86) \ Apache Software Foundation \ Tomcat 7.0 \ webapps (on Windows) and /usr/java/apache-tomcat-7.0 (on Linux) ".

Save the file and open the browser of your choice and type: link , as shown in Figure 1.

    
01.07.2018 / 01:33