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 Employee.java
package com.sakadream.jsf.bean;
/**
* Created by Phan Ba Hai on 17/07/2017.
*/
public class Employee {
private int id;
private String fullName;
private String address;
private String email;
View User.java
package com.sakadream.jsf.bean;
/**
* Created by Phan Ba Hai on 17/07/2017.
*/
public class User {
private int id;
private String username;
private String password;
View Functions.java
package com.sakadream.jsf.func;
import com.sakadream.jsf.bean.Employee;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
View Create_Database.sql
CREATE TABLE USERS (
ID INT IDENTITY (1,1) PRIMARY KEY NOT NULL ,
USERNAME VARCHAR(50) NOT NULL ,
PASSWORD VARCHAR(50) NOT NULL
);
INSERT INTO USERS(USERNAME, PASSWORD)
VALUES
('haipb', 'haipb'),
('kietpp', 'kietpp')
View faces-config.xml
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.2" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
<navigation-rule>
<from-view-id>/login.xhtml</from-view-id>
<navigation-case>
View web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
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>YOUR_PROJECT_GROUP_ID</groupId>
<artifactId>YOUR_PROJECT_ARTIFACT_ID</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>jsf Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
View 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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sakadream</groupId>
<artifactId>Java-Security-Sample</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
View part-of-pom.xml
<repositories>
<repository>
<id>YOUR-PROJECT-NAME-mvn-repo</id>
<url>https://raw.github.com/YOUR-USERNAME/YOUR-PROJECT-NAME/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
View mvn-error
[ERROR] Failed to execute goal com.github.github:site-maven-plugin:0.12:site (default) on project Java-Security: Error creating commit: Invalid request.
[ERROR]
[ERROR] For 'properties/name', nil is not a string.
[ERROR] For 'properties/name', nil is not a string. (422)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
You can’t perform that action at this time.