Idea is powered by Tomcat using JSTL to connect to Oracle database

Source: Internet
Author: User

1. In idea, the JSTL library is imported into web-inf/lib and can be directly on the JSP page via the

<%@ taglib uri= "http://java.sun.com/jsp/jstl/core" prefix= "c"% >
<%@ taglib uri= "http://java.sun.com/jsp/jstl/sql" prefix= "sql"% >

Import, you do not need to set parameters in Web. Xml. In the idea Web. XML, it seems that the path to the file in the jar package cannot be added to the Lib directory because it cannot be identified.

The 2.JSTL SQL tags are also available for MySQL and Oracle, most of which are MySQL-based, and W3cschool also have jstl to write a tutorial that links to MySQL pages.

MySQL can refer to https://www.w3cschool.cn/jsp/jsp-database-access.html, the inside of the datasource is written like this:

<sql:setdatasource var= "snapshot" driver= "Com.mysql.jdbc.Driver "

Url= "Jdbc:mysql://localhost/test"

user= "root" password= "pass123"/>

Oracle simply changes the driver and URLs in the datasource tag to Oracle, and of course idea needs to import the Oracle14.jar Drive Jar package (which can be found online) using the following:

<sql:setdatasource var= "Ora" driver= "Oracle.jdbc.driver.OracleDriver"
Url= "Jdbc:oracle:thin: @localhost: 1521:orcl"
User= "Scott" password= "123456"/>

3. Using Jstl's sql:query tag, var= "Result", rows is the property of result in query result, ${result.rows} is equivalent to Result.getrows ();

Idea is powered by Tomcat using JSTL to connect to Oracle database

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.