Skip to content

Instantly share code, notes, and snippets.

💻
happy coding!

Ba Hai Phan SakaDream

💻
happy coding!
Block or report user

Report or block SakaDream

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sakadream.test</groupId> <!--Thay bằng package name của bạn-->
<artifactId>Java-In-Heroku</artifactId> <!--Thay bằng app name của bạn-->
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Java-In-Heroku Maven Webapp</name> <!--Thông tin về ứng dụng-->
<url>http://maven.apache.org</url>
View web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Java-In-Heroku Maven Webapp</display-name> <!--Thông tin về ứng dụng-->
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
View mvc-dispatcher-servlet.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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">
<context:component-scan base-package="com.sakadream.test.controller" /> <!--Địa chỉ package controller-->
View logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
View index.jsp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
View HomeController.java
package com.sakadream.test.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class HomeController {
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index() {
View deploy-log
D:\Documents\Source\Repos\Java-In-Heroku>mvn package && java -jar .\target\dependency\webapp-runner.jar .\target\*.war
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Java-In-Heroku Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Java-In-Heroku ---
[WARNING] Using platform encoding (Cp1258 actually) to copy filtered resources, i.e. build is platform dependent!
View .gitignore
# Created by https://www.gitignore.io/api/java,visualstudiocode,maven
### Java ###
# Compiled class file
*.class
# Log file
*.log
View pom.xml
<dependencies>
...
<!--JSTL-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
View web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Java-In-Heroku Maven Webapp</display-name>
<servlet>
<servlet-name>mvc-dispatcher</servlet-name>
You can’t perform that action at this time.