Skip to content

Commit 495fdbb

Browse files
committed
Updated JSF version, refactoring
1 parent d0324f2 commit 495fdbb

File tree

38 files changed

+264
-247
lines changed

38 files changed

+264
-247
lines changed
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<faces-config
3-
xmlns="http://java.sun.com/xml/ns/javaee"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
6-
version="2.1">
7-
8-
</faces-config>
2+
<faces-config version="2.2"
3+
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
6+
</faces-config>
Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xmlns="http://java.sun.com/xml/ns/javaee"
4-
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
5-
id="Ch04_OutputEscapingJSF" version="2.5">
6-
<display-name>Ch04_OutputEscapingJSF</display-name>
7-
<context-param>
8-
<param-name>javax.faces.PROJECT_STAGE</param-name>
9-
<param-value>Development</param-value>
10-
</context-param>
11-
<welcome-file-list>
12-
<welcome-file>index.xhtml</welcome-file>
13-
</welcome-file-list>
14-
<servlet>
15-
<servlet-name>Faces Servlet</servlet-name>
16-
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
17-
<load-on-startup>1</load-on-startup>
18-
</servlet>
19-
<servlet-mapping>
20-
<servlet-name>Faces Servlet</servlet-name>
21-
<url-pattern>*.xhtml</url-pattern>
22-
</servlet-mapping>
2+
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
5+
version="3.1">
6+
<display-name>Ch04_OutputEscapingJSF</display-name>
7+
8+
<context-param>
9+
<param-name>javax.faces.PROJECT_STAGE</param-name>
10+
<param-value>Development</param-value>
11+
</context-param>
12+
13+
<servlet>
14+
<servlet-name>Faces Servlet</servlet-name>
15+
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
16+
<load-on-startup>1</load-on-startup>
17+
</servlet>
18+
19+
<servlet-mapping>
20+
<servlet-name>Faces Servlet</servlet-name>
21+
<url-pattern>*.xhtml</url-pattern>
22+
</servlet-mapping>
23+
24+
<welcome-file-list>
25+
<welcome-file>index.xhtml</welcome-file>
26+
</welcome-file-list>
2327
</web-app>

Ch04_OutputEscapingJSF/src/main/webapp/contact.xhtml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html">
5+
<h:head>
6+
<h:outputStylesheet library="css" value="styles.css" name="styles.css" />
7+
<title>Ch04_OutputEscapingJSF</title>
8+
</h:head>
59
<h:body>
6-
<link rel="stylesheet" type="text/css" href="styles.css" />
7-
8-
<h1>Ch04_OutputEscapingJSF: New Contact</h1>
10+
<h1>Ch04_OutputEscapingJSF</h1>
911

1012
<h:form>
11-
<h2>Input with direct value expression</h2>
13+
<h2>Input displayed with direct value expression</h2>
1214
<p>#{contact.firstname} #{contact.lastname}</p>
1315

14-
<h2>Input with outputText element</h2>
16+
<h2>Input displayed with &lt;h:outputText /&gt; element</h2>
1517
<p><h:outputText value="#{contact.firstname}" /><h:outputText value=" " /><h:outputText value="#{contact.lastname}" /></p>
1618
</h:form>
1719
</h:body>

Ch04_OutputEscapingJSF/src/main/webapp/index.xhtml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4-
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html">
2+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html">
5+
<h:head>
6+
<h:outputStylesheet library="css" value="styles.css" name="styles.css" />
7+
<title>Ch04_OutputEscapingJSF</title>
8+
</h:head>
59
<h:body>
6-
<link rel="stylesheet" type="text/css" href="styles.css" />
7-
810
<h1>Ch04_OutputEscapingJSF</h1>
911

1012
<h:form id="addContact">

Ch04_OutputEscapingJSF/src/main/webapp/styles.css renamed to Ch04_OutputEscapingJSF/src/main/webapp/resources/css/styles.css

File renamed without changes.

Ch05_AccessReferenceMaps/src/main/java/de/dominikschadow/webappsecurity/AccountBean.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import javax.annotation.PostConstruct;
2222
import javax.faces.bean.ManagedBean;
2323
import javax.faces.bean.SessionScoped;
24+
import java.io.Serializable;
2425
import java.util.ArrayList;
2526
import java.util.List;
2627

@@ -31,7 +32,7 @@
3132
*/
3233
@ManagedBean
3334
@SessionScoped
34-
public class AccountBean {
35+
public class AccountBean implements Serializable {
3536
private Account account;
3637
private int userId = 42;
3738
private int accountId = 1;

Ch05_AccessReferenceMaps/src/main/java/de/dominikschadow/webappsecurity/AccountBeanInteger.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import javax.annotation.PostConstruct;
2222
import javax.faces.bean.ManagedBean;
2323
import javax.faces.bean.SessionScoped;
24+
import java.io.Serializable;
2425
import java.util.ArrayList;
2526
import java.util.List;
2627

@@ -31,26 +32,26 @@
3132
*/
3233
@ManagedBean
3334
@SessionScoped
34-
public class AccountBeanInteger {
35+
public class AccountBeanInteger implements Serializable {
3536
private List<String> accountReferences = new ArrayList<>();
36-
private int accountId = 1;
37+
private int iaAccountId = 1;
3738
private int userId = 42;
3839
private AccountsIntegerDAO dao;
3940

40-
public int getAccountId() {
41-
return accountId;
41+
public int getIaAccountId() {
42+
return iaAccountId;
4243
}
4344

44-
public void setAccountId(int accountId) {
45-
this.accountId = accountId;
45+
public void setIaAccountId(int iaAccountId) {
46+
this.iaAccountId = iaAccountId;
4647
}
4748

4849
public int getUserId() {
4950
return userId;
5051
}
5152

5253
public Account getAccount() {
53-
return dao.retrieveAccount(accountId);
54+
return dao.retrieveAccount(iaAccountId);
5455
}
5556

5657
public List<String> getAccountReferences() {

Ch05_AccessReferenceMaps/src/main/java/de/dominikschadow/webappsecurity/AccountBeanRandom.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import javax.annotation.PostConstruct;
2222
import javax.faces.bean.ManagedBean;
2323
import javax.faces.bean.SessionScoped;
24+
import java.io.Serializable;
2425
import java.util.ArrayList;
2526
import java.util.List;
2627

@@ -31,26 +32,26 @@
3132
*/
3233
@ManagedBean
3334
@SessionScoped
34-
public class AccountBeanRandom {
35+
public class AccountBeanRandom implements Serializable {
3536
private List<String> accountReferences = new ArrayList<>();
36-
private String accountId = "";
37+
private String raAccountId = "";
3738
private int userId = 42;
3839
private AccountsRandomDAO dao;
3940

40-
public String getAccountId() {
41-
return accountId;
41+
public String getRaAccountId() {
42+
return raAccountId;
4243
}
4344

44-
public void setAccountId(String accountId) {
45-
this.accountId = accountId;
45+
public void setRaAccountId(String raAccountId) {
46+
this.raAccountId = raAccountId;
4647
}
4748

4849
public int getUserId() {
4950
return userId;
5051
}
5152

5253
public Account getAccount() {
53-
return dao.retrieveAccount(accountId);
54+
return dao.retrieveAccount(raAccountId);
5455
}
5556

5657
public List<String> getAccountReferences() {

Ch05_AccessReferenceMaps/src/main/java/de/dominikschadow/webappsecurity/User.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@
1818
*/
1919
package de.dominikschadow.webappsecurity;
2020

21+
import java.io.Serializable;
22+
2123
/**
2224
* Represents a simple user.
2325
*
2426
* @author Dominik Schadow
2527
*/
26-
public class User {
28+
public class User implements Serializable {
2729
private int userId;
2830
private String name;
2931

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#HSQL Database Engine 2.3.0
2-
#Sat Jan 18 18:57:47 CET 2014
3-
version=2.3.0
1+
#HSQL Database Engine 2.3.2
2+
#Sun Feb 23 10:48:16 CET 2014
3+
version=2.3.2
44
modified=no

0 commit comments

Comments
 (0)