inotgo.com


Tool version compatibility problem
Through Servlet It is possible to develop the whole website . But in Servlet Output in html code , Especially the slightly more complicated html code , It will give people a very crisp The feeling of .

If you can use it directly Html code , Then in html It says java code , Just fine ~

JSP ... You can do this .
Correct

Step 1 : hello.jsp   
Step 2 : Code interpretation   
Step 3 : <%=   

stay web Create a new file in the directory hello.jsp

Visit the web

http://127.0.0.1/hello.jsp

notes : No need to restart tomcat
hello.jsp
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="java.util.*"%> Hello JSP <br> <%=new Date().toLocaleString()%>
<%@page contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" import="java.util.*"%>

 Hello  JSP

<br>

<%=new Date().toLocaleString()%>

<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="java.util.*"%>

yes JSP of <%@page Instructions


contentType="text/html; charset=UTF-8"

amount to response.setContentType("text/html; charset=UTF-8"); Notify the browser to UTF-8 Chinese decoding

pageEncoding="UTF-8"

If jsp Chinese... Appears in the file , These Chinese use UTF-8 Code

import="java.util.*

Import other classes , If you import multiple classes , Use... With each other , Comma separated , like this import="java.util.*,java.sql.*"

<%=new Date().toLocaleString()%>

Output the current time , Equivalent to in Servlet Used in response.getWriter() Output

response.getWriter().println(new Date().toLocaleString());


The official account of programming , Follow and get the latest tutorials and promotions in real time , thank you .


Q & A area    
2020-04-24 Always appear 505 problem , Show jsp Support unconfigured
starry sky 20201001

about J2EE-JSP-Hello JSP Your questions



Always appear 505 problem , Show jsp Support unconfigured
 Loading
JSP code :
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
 The visit time is :
<%
	Date date = new Date();
	out.println(date.toString());
%>
</body>
</html>


web.xml code :
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>chapter</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>simple</display-name>
    <servlet-name>simple</servlet-name>
    <jsp-file>/simple.jsp</jsp-file>
  </servlet>
  <servlet-mapping>
    <servlet-name>simple</servlet-name>
    <url-pattern>/simple</url-pattern>
  </servlet-mapping>
</web-app>
2020-04-24 18:47:09.197:INFO:oejshC.chapter:qtp610998173-16: No JSP support.  Check that JSP jars are in lib/jsp and that the JSP option has been specified to start.jar


1 One answer

Dream hacker
Answer time :2020-07-17
Your code is wrong , The following code is <%= Beginning , If you don't write, it means , I'll report it if I delete it 500 error ,,500 Errors are server errors. Generally, the code is written incorrectly



The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see





2019-12-13 2019 Years , Who will learn jsp I hammered him
I'm little black

about J2EE-JSP-Hello JSP Your questions
jsp But it has been eliminated , I don't recommend learning




14 One answer

9631582470zyb
Answer time :2021-01-10
Many companies are still jsp of , If you have enough time, you have to learn . Combined with actual needs , Don't listen to what you don't learn online . They have learned , Don't learn until you don't use it at work .

Learn every day Java Ah
Answer time :2020-10-07
In fact, it won't take long , It's OK to look at the process

wryeswryes
Answer time :2020-09-24
Ambitious guys

xianzhe
Answer time :2020-06-30
Don't listen to them , Schools that are a few beats slower than practice are no longer taught , What else to learn , If only the old project could be repaired again , Now novice learning time is precious , Everything is aimed at finding a job , Why waste it here

is
Answer time :2020-05-21
You think I'm learning jsp Is used to develop ? No no no , I'm just learning principles , Understand web The past and present life of development

dywen
Answer time :2020-05-04
Didn't graduate , New projects don't have to , The maintenance of old projects does not need ? Some interns come in to meet , Don't aim too high

The wind from the sea i
Answer time :2020-04-01
jsp It is the fastest running template engine

Peach fairy
Answer time :2020-03-31
It can only be said that the newly developed system uses JSP Not much , But there are still a lot of maintenance

yjxjn
Answer time :2020-03-25
Upstairs, there are students , It's useless now , Does not mean that all running projects no longer use JSP, Just JDK Say ,8 It's still J2EE The mainstream of ...

Jesse Muzi
Answer time :2020-02-12
study JSP The purpose of is To better understand Servlet and Web The operation of JSP In forEach、if/choose etc. el The idea of expression is universal when fetching data from web pages , Learning it will help you learn any web template technology in the future , For example freemark、volicity etc. . To tell you the truth servlet I won't write But I still have to learn

Little yellow chicken
Answer time :2020-02-07
jsp Nobody uses it, but it doesn't mean it's not worth learning .

Small business
Answer time :2020-01-07
brother , Bi Shi wants to use

Little Laka
Answer time :2019-12-18
upstairs ,JSP Tutorials are not distributed JSP The demo is sent ASP?

WannaWin
Answer time :2019-12-16
Agree , I don't know why this tutorial is still used a lot JSP Do a demonstration , It's almost useless now JSP Doing development



The answer has been submitted successfully , Auditing . Please My answer Check the answer record at , thank you
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see




2019-09-20 about JS+HTML
2019-09-17 about web catalogue
2019-01-25 MAC os Next eclipse web Dynamic projects set the path to / instead of j2ee/


Too many questions , Page rendering is too slow , To speed up rendering , Only a few questions are displayed on this page at most . also 7 Previous questions , please Click to view

Please... Before asking questions land
The question has been submitted successfully , Auditing . Please My question Check the question record at , thank you
about J2EE-JSP-Hello JSP Your questions

Try to provide Screenshot code and Abnormal information , Help to analyze and solve problems . You can also enter this station QQ Group communication : 496725845
Ask questions and try to provide complete code , Environment description , The more conducive to the recurrence of the problem , The faster your question can be answered .
Have questions about the code in the tutorial , Please provide which step , Which line is in doubt , This makes it easy to quickly locate the problem , Improve the speed at which questions are answered
In the thousands of questions that already exist , A considerable proportion , Because of the use of and webmaster Different versions of the development environment Resulting in , For example jdk, eclpise, idea, mysql,tomcat Wait, the version of the software is inconsistent .
Please use the same version as the webmaster , You can save yourself a lot of learning time . The webmaster sorted out the software versions used in teaching , It's all here , Convenient for everyone to download : /k/helloworld/helloworld-version/1718.html

Upload screenshot