Skip to content

Instantly share code, notes, and snippets.

View darbyluv2code's full-sized avatar

Chad Darby darbyluv2code

View GitHub Profile
@darbyluv2code
darbyluv2code / list-customers.jsp
Created June 28, 2017 18:21
Sort by Clicking Table Header/Column
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix= "fmt" %>
<!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=ISO-8859-1">
<title>List Customers</title>
@darbyluv2code
darbyluv2code / CustomerDAOImpl.java
Created June 29, 2017 14:53
Milos - Updates for new Criteria API
package com.juratech.springdemo.dao;
import java.util.List;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.hibernate.Session;
@darbyluv2code
darbyluv2code / CourseCode.java
Created June 29, 2017 21:44
Spring MVC Validation - FAQ: Is it possible to integrate multiple validation string in one annotation?
package com.luv2code.springdemo.mvc.validation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
You can use the troubleshooting tips below.
Troubleshooting Tip #1
1. Exit Eclipse
2. Open a web web browser and visit, http://localhost:8080
3. If you see a "Tomcat" web page then that means Tomcat is running as a Windows service. To stop Tomcat running as a Windows services, open your Windows Control Panel. Find the service "Apache Tomcat" and stop it.
package com.training.springdemo;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class HelloSpring {
public static void main(String args[]){
//load the spring configuration file
<html>
<body>
<h3>Hello World of Java!</h3>
The time on the server is <%= new java.util.Date() %>
</body>
package com.nguyen92.web.jdbc;
import java.io.IOException;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
@darbyluv2code
darbyluv2code / dispatcher-servlet.xml
Created July 18, 2017 14:04
Spring MVC Validation with Maven question from Udemy
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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
http://www.springframework.org/schema/context/spring-context.xsd
@darbyluv2code
darbyluv2code / StudentController.java
Created August 3, 2017 17:35
Spring MVC - Drop Down Lists
/**
*
*/
package com.luv2code.springdemo.mvc;
import java.util.SortedMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
@darbyluv2code
darbyluv2code / pom.xml
Created August 6, 2017 20:00
pom.xml - WebCustomerUdemy
<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>WebCustomerUdemy</groupId>
<artifactId>WebCustomerUdemy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<spring.version>4.3.9.RELEASE</spring.version>