Skip to content

Instantly share code, notes, and snippets.

View darbyluv2code's full-sized avatar

Chad Darby darbyluv2code

View GitHub Profile
@darbyluv2code
darbyluv2code / list-students-with-scriptlets.jsp
Created August 13, 2019 00:37
list students with scriptlets
<%@ page import="java.util.*, com.luv2code.web.jdbc.*" %>
<!DOCTYPE html>
<html>
<head>
<title>Student Tracker App</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
</head>
@darbyluv2code
darbyluv2code / DeleteDemo.java
Created July 23, 2019 15:01
DeleteDemo - Get id on the fly
package com.luv2code.hibernate.demo;
import java.util.Scanner;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.luv2code.hibernate.demo.entity.Instructor;
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Define your beans here -->
@darbyluv2code
darbyluv2code / DemoAppConfig.java
Last active July 18, 2019 21:00
How to set hbm2ddl No XML CONFIG
package com.luv2code.springdemo.config;
import java.beans.PropertyVetoException;
import java.util.Properties;
import java.util.logging.Logger;
import javax.sql.DataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
@darbyluv2code
darbyluv2code / persistence-mysql.properties
Created May 28, 2019 09:35
spring security - user registration
#
# JDBC connection properties
#
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/spring_security_custom_user_demo?useSSL=false&serverTimezone=UTC
jdbc.user=hbstudent
jdbc.password=hbstudent
#
# Connection pool properties
@darbyluv2code
darbyluv2code / pom.xml
Created May 27, 2019 16:34
Spring MVC - pom file
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.luv2code</groupId>
<artifactId>spring-mvc-validation-demo</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>spring-mvc-validation-demo</name>
@darbyluv2code
darbyluv2code / StudentController.java
Created May 5, 2019 10:45
duplicate form field names
package com.luv2code.springdemo.mvc;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
@darbyluv2code
darbyluv2code / spring-mvc-crud-demo-servlet.xml
Created May 3, 2019 04:29
spring-mvc-crud-demo-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
@darbyluv2code
darbyluv2code / pom.xml
Last active February 28, 2019 20:38
pom
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.priyak.webapp</groupId>
<artifactId>spring-mvc-demo-updated</artifactId>
<version>1.0-SNAPSHOT</version>
<name>spring-mvc-demo</name>
@darbyluv2code
darbyluv2code / gist:41f67fb8c0fc3f6b04faad83c52eb196
Created February 26, 2019 02:25
TestJdbc (read configs from props file)
package com.luv2code.jdbc;
import java.io.FileInputStream;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;
public class TestJdbc {