<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?
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. 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.
检查您的项目库设置,并且您的Java库位于PATH类中。
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.