Reputation: 17268
<HTML>
<BODY>
Hello! The time is now <%= new java.util.Date() %>
</BODY>
</HTML>
I tried to open this trivial jsp file with firefox, but the expression wouldn't evaluate. I have Java installed.
I'm new to JSP. Should I put the jsp in some specific directory? Or do I forget to include anything in the jsp file?
Upvotes: 0
Views: 86
Reputation: 1109432
It sounds like that you aren't using a JSP/Servlet container at all but instead just opened the file straight from local disk file system by a file://
URL. This is indeed not going to work. You need to install a JSP/Servlet container. This is basically a HTTP web server which has the JSP compiler builtin and supports serving JSP/Servlets. A well known example is Apache Tomcat. Just download the zip under "Core" section (no, not the "Windows zip", really just "zip") and extract it on your disk. Then perform the following steps:
/webapps
folder of Tomcat./bin/startup.bat
(Windows) or /bin/startup.sh
(Unix) script. Upvotes: 2
Reputation: 691
Each jsp page must be compiled to a servlet by a JSP engine. Firefox is not a JSP engine. Have a look at JavaServer Pages Technology which might be helpful to you.
Upvotes: 0
Reputation: 692121
A JSP is evaluated by a web container like Tomcat or Jetty, and the HTML that it generates is then sent to the browser. The browser can't run a JSP on its own.
Upvotes: 1
Reputation: 53545
Check your project library settings and that your java lib is in the class PATH.
Upvotes: 0