Java JSP (for beginners) and javajsp
I. Differences between jsp and asp.net in the same Programming Method
The app needs to make a simple website and promote the link with several users, so it involves web development. I originally wanted to directly use asp.net yesterday, but then I gave up this idea, because the data access interface uses java servlet, I first wanted to directly use the static html page + servlet + ajax method. Although this method is common for various languages in website development, but there is a drawback: Binding data is very complicated, so I tried to find two jsp cases. If it is more complicated than the previous method, I will directly use the previous method, in the following case, we can see that the jsp programming method has been used in asp.net before. The difference is that if asp.net is used in this way, the data bound to the front-end is from inside the page, after the database operation is performed internally, the return value is bound to the front end. However, jsp is different. jsp Data Access and html are on the same page layer. In fact, jsp is more advanced than asp.net, however, there is not much time for asp.net to use this method for programming. It can only be considered as a function attached to it. I will focus on the technology.
Ii. jsp
To use jstl for database operations, you need to add two libraries, jstl and standard. Download these two libraries from the Internet and copy them directly to the tomcat lib folder, jstl is responsible for database operations. standard is the library required to use the labels in jstl. standard is equivalent to jstl, and pay attention to it here, I am working on development in mac OS. An error will be reported when I directly download the combined packages of these two libraries, and the tag auxiliary class required by jstl cannot be found, if an error is reported when you directly download the jar package from the official website, you can download jstl and standard on the Internet and put them into tomcat lib.
1 <% @ page language = "java" import = "java. util. * "contentType =" text/html; charset = UTF-8 "2 pageEncoding =" UTF-8 "%> 3 <% @ page import =" java. io. *, java. util. *, java. SQL. * "%> 4 <% @ page import =" javax. servlet. http. *, javax. servlet. * "%> 5 6 <! -- Introduce database operation library --> 7 <% @ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %> 8 <% @ taglib uri = "http://java.sun.com/jsp/jstl/ SQL" prefix = "SQL" %> 9 10 <! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" http://www.w3.org/TR/html4/loose.dtd "> 11 12 13