Posts

Showing posts from July, 2022

Spring Boot

 pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.1</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>Practice</artifactId> <version>0.0.1-SNAPSHOT</version> <name>Practice</name> <description>Demo project for Spring Boot</description> <properties> <java.version>17</java.version> </properties> <dependencies>

JSP

 JSP INSERT JAVA PAGE package com.gd.controller; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;   import java.sql.*; @WebServlet("/Insert") public class Insert extends HttpServlet{ @Override     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {                  try {         Class.forName("com.mysql.cj.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/emp?characterEncoding=latin1";             String username = "root";             String password = "1234";             Connection con = DriverManager.getConnection(url, username, password);             if (con != null) {                 System.out.printl