Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions SimpleBlog/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="SimpleBlog" default="default" basedir=".">
<description>Builds, tests, and runs the project SimpleBlog.</description>
<import file="nbproject/build-impl.xml"/>
<!--

There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:

-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying

Example of pluging an obfuscator after the compilation could look like

<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>

For list of available properties check the imported
nbproject/build-impl.xml file.


Other way how to customize the build is by overriding existing main targets.
The target of interest are:

init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation

Example of overriding the target for project execution could look like

<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>

Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.

-->
</project>
2 changes: 2 additions & 0 deletions SimpleBlog/build/web/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

Empty file.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

javax.faces.component.UIInput.REQUIRED=Please enter a value for this field.
102 changes: 102 additions & 0 deletions SimpleBlog/build/web/WEB-INF/faces-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<faces-config version="2.0"
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-facesconfig_2_0.xsd"
>
<managed-bean>
<managed-bean-name>login_bean</managed-bean-name>
<managed-bean-class>beans.login_bean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>post_bean</managed-bean-name>
<managed-bean-class>beans.post_bean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Post</managed-bean-name>
<managed-bean-class>beans.Post</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Komentar</managed-bean-name>
<managed-bean-class>beans.Komentar</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<description>Login Page</description>
<from-view-id>/login.jsp</from-view-id>
<navigation-case>
<from-action>#{login_bean.checkValidUser}</from-action>
<from-outcome>valid</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{login_bean.checkValidUser}</from-action>
<from-outcome>invalid</from-outcome>
<to-view-id>/login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>Relogin Page</description>
<from-view-id>/login_fail.jsp</from-view-id>
<navigation-case>
<from-action>#{login_bean.checkValidUser}</from-action>
<from-outcome>valid</from-outcome>
<to-view-id>/login_success.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{login_bean.checkValidUser}</from-action>
<from-outcome>invalid</from-outcome>
<to-view-id>/login_fail.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<navigation-case>
<from-action>#{Post.setDBP(item.id_post)}</from-action>
<from-outcome>post</from-outcome>
<to-view-id>/post.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-action>#{Post.setDBE(item.id_post)}</from-action>
<from-outcome>edit</from-outcome>
<to-view-id>/edit_post.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>Edit Page</description>
<from-view-id>/edit_post.xhtml</from-view-id>
<navigation-case>
<from-action>#{Post.editPost()}</from-action>
<from-outcome>edit</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>Insert Page</description>
<from-view-id>/new_post.xhtml</from-view-id>
<navigation-case>
<from-action>#{Post.insertPost()}</from-action>
<from-outcome>insert</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<description>Publish Page</description>
<from-view-id>/publish_post.xhtml</from-view-id>
<navigation-case>
<from-action>#{publish_bean.changeStatus(item.id_post)}</from-action>
<to-view-id>/index.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<application>
<message-bundle>messages.message</message-bundle>
</application>
</faces-config>
10 changes: 10 additions & 0 deletions SimpleBlog/build/web/WEB-INF/glassfish-web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</glassfish-web-app>
Binary file not shown.
11 changes: 11 additions & 0 deletions SimpleBlog/build/web/WEB-INF/sun-web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>

24 changes: 24 additions & 0 deletions SimpleBlog/build/web/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" 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-app_3_1.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
35 changes: 35 additions & 0 deletions SimpleBlog/build/web/admin crud.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<%--
Document : admin crud
Created on : Nov 30, 2014, 12:04:14 PM
Author : Ryuxaki
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@ page import="java.io.*,java.util.*,java.sql.*"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<sql:setDataSource var="connection" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/simple_blog_java"
user="root" password=""/>

<sql:update dataSource="${connection}" var="result">
DELETE FROM user WHERE username = '<%= request.getParameter("username") %>'
</sql:update>

<sql:query dataSource="${connection}" var="result">
SELECT * from user;
</sql:query>

<c:forEach var="row" items="${result.rows}">
<tr>
<td><c:out value="${row.username}"/></td>
<td><c:out value="${row.password}"/></td>
<td><c:out value="${row.email}"/></td>
<td><c:out value="${row.role}"/></td>
<td>
<a href="edit_user.xhtml?username=${row.username}" class="edit" id="edit"> edit </a> | <a class="delete" id="delete"> delete </a>
</td>
</tr>
</c:forEach>
61 changes: 61 additions & 0 deletions SimpleBlog/build/web/admin crud.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">
<h:head>
<title>Edit User</title>
<h:outputStylesheet library="css" name="assets/css/bootstrap.css"/>
<h:outputScript library="js" name="validator.js"/>
</h:head>
<h:body>
#{addUser.autoFill}
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<a class="navbar-brand" href="index.xhtml">Holy Grail</a>
</div>
</nav>
<h:form class="login container-fluid" id="form-register">
<div class="row first-row">
<div class="col-md-3"/>
<div class="col-md-3"><label for="username">username</label></div>
<div class="col-md-3"><h:inputText a:placeholder="username" requiredMessage="username is empty" required="true" id="register_username" value="#{addUser.username}"/></div>
</div>
<div class="row">
<div class="col-md-3"/>
<div class="col-md-3"><label for="password">password</label></div>
<div class="col-md-3"><h:inputSecret a:placeholder="password" requiredMessage="password is empty" required="true" id="register_password" value="#{addUser.password}"/></div>
</div>
<div class="row">
<div class="col-md-3"/>
<div class="col-md-3"><label for="email">email</label></div>
<div class="col-md-3"><h:inputText a:placeholder="email" requiredMessage="email is empty" required="true" id="register_email" value="#{addUser.email}"/></div>
</div>
<div class="row">
<div class="col-md-3"/>
<div class="col-md-3"><label for="role">role</label></div>
<div class="col-md-3">
<h:selectOneMenu value="#{addUser.role}">
<f:selectItem itemValue="admin" itemLabel="admin"/>
<f:selectItem itemValue="owner" itemLabel="owner"/>
<f:selectItem itemValue="editor" itemLabel="editor"/>
</h:selectOneMenu>
</div>
</div>
<div class="row">
<div class="col-md-3"/>
<div class="col-md-3">
<h:commandButton onclick="return emailValidator()" type="submit" class="login-button btn-success" id="adduser" value="Update User"/>
</div>
</div>
</h:form>
<c:if test="#{addUser.username.length() != 0 and addUser.password.length() != 0 and addUser.role.length() != 0 and addUser.email.length() != 0}">
<h:outputText escape="false" value="#{addUser.checkAvail}"/>
</c:if>
<div id="ganti-error-message" class="error-message">
</div>
</h:body>
</html>

Loading