From cbfe218b61ebc489ed53a5d6cb6965b085bf0b11 Mon Sep 17 00:00:00 2001 From: Ragrok Lee Date: Tue, 18 Oct 2016 16:47:06 +0800 Subject: [PATCH 1/5] Create README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e47a35 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# JavaServerFaces +- 这是fork别人的项目,用来学习jsf的生命周期。 +- 现在项目使用的就是jsf框架,想深入的了解jsf的内部原理,让自己对J2EE的知识理解更深入。 +- 使用IDEA来打开,eclipse要装插件才行,不然无法识别。 From e886746082fd9be0539a81d5667226702122f6f2 Mon Sep 17 00:00:00 2001 From: ragrok Date: Tue, 18 Oct 2016 16:54:40 +0800 Subject: [PATCH 2/5] fix bug for managedBeans pom.xml --- JavaServerFaces_03ManagedBeans/pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/JavaServerFaces_03ManagedBeans/pom.xml b/JavaServerFaces_03ManagedBeans/pom.xml index 4f6497f..b47f7d2 100644 --- a/JavaServerFaces_03ManagedBeans/pom.xml +++ b/JavaServerFaces_03ManagedBeans/pom.xml @@ -3,14 +3,13 @@ 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"> - JavaServerFaces-parent JavaServerFaces + JavaServerFaces-parent 1.0-SNAPSHOT - ../JavaServerFaces/pom.xml 4.0.0 JavaServerFaces_03ManagedBeans - + war \ No newline at end of file From a4b332e9984987aaeff1d16fd36296b6db5ef55f Mon Sep 17 00:00:00 2001 From: ragrok Date: Fri, 28 Oct 2016 09:11:52 +0800 Subject: [PATCH 3/5] learn jsf and refine code --- .gitignore | 42 +-- JavaServerFaces_01HelloWorld/pom.xml | 28 +- .../main/java/com/xxy/common/HelloBean.java | 49 +-- .../common/HelloBeanForApplicationScoped.java | 70 ++--- .../xxy/common/HelloBeanForNoneScoped.java | 68 ++--- .../xxy/common/HelloBeanForRequestScoped.java | 66 ++--- .../xxy/common/HelloBeanForSessionScoped.java | 68 ++--- .../xxy/common/HelloBeanForViewScoped.java | 86 +++--- .../src/main/webapp/WEB-INF/web.xml | 74 ++--- .../src/main/webapp/hello.xhtml | 34 +-- .../webapp/helloForApplicationScope.xhtml | 34 +-- .../src/main/webapp/helloForNoneScoped.xhtml | 34 +-- .../main/webapp/helloForRequestScoped.xhtml | 34 +-- .../main/webapp/helloForSessionScoped.xhtml | 34 +-- .../src/main/webapp/helloForViewScoped.xhtml | 48 +-- .../src/main/webapp/helloScopesIndex.xhtml | 58 ++-- .../src/main/webapp/welcome.xhtml | 28 +- .../webapp/welcomeForApplicationScoped.xhtml | 30 +- .../main/webapp/welcomeForNoneScoped.xhtml | 28 +- .../main/webapp/welcomeForRequestScoped.xhtml | 28 +- .../main/webapp/welcomeForSessionScoped.xhtml | 28 +- .../main/webapp/welcomeForViewScoped.xhtml | 28 +- JavaServerFaces_02HelloWorldAjax/pom.xml | 30 +- .../main/java/com/xxy/common/HelloBean.java | 72 +++-- .../src/main/webapp/WEB-INF/web.xml | 66 ++--- .../src/main/webapp/helloAjax.xhtml | 39 +-- JavaServerFaces_03ManagedBeans/pom.xml | 28 +- .../main/java/com/xxy/common/HelloBean.java | 76 +++-- .../src/main/webapp/WEB-INF/faces-config.xml | 30 +- .../src/main/webapp/WEB-INF/manage-beans.xml | 26 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/helloAjax.xhtml | 42 +-- JavaServerFaces_04InjectManagedBeans/pom.xml | 27 +- .../main/java/com/xxy/common/FailBean.java | 28 ++ .../main/java/com/xxy/common/HelloBean.java | 90 +++--- .../main/java/com/xxy/common/MessageBean.java | 46 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/helloAjax.xhtml | 40 +-- JavaServerFaces_05ImplicitNavigation/pom.xml | 28 +- .../com/xxy/controller/PageController.java | 42 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/page1.xhtml | 32 +- .../src/main/webapp/page2.xhtml | 32 +- .../main/webapp/WEB-INF/faces-config.pageflow | 10 + .../pom.xml | 28 +- .../com/xxy/controller/PaymentController.java | 64 ++-- .../src/main/webapp/WEB-INF/faces-config.xml | 54 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/ordermore.xhtml | 18 +- .../src/main/webapp/payment.xhtml | 18 +- .../src/main/webapp/register.xhtml | 18 +- .../src/main/webapp/start.xhtml | 28 +- .../main/webapp/WEB-INF/faces-config.pageflow | 10 + .../pom.xml | 28 +- .../com/xxy/controller/PageController.java | 45 +-- .../src/main/webapp/WEB-INF/faces-config.xml | 51 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/page1.xhtml | 18 +- .../src/main/webapp/page2.xhtml | 18 +- .../src/main/webapp/page3.xhtml | 10 + .../src/main/webapp/start.xhtml | 31 +- JavaServerFaces_08PageRedirection/pom.xml | 28 +- .../src/main/webapp/WEB-INF/faces-config.xml | 38 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/page1.xhtml | 18 +- .../src/main/webapp/start.xhtml | 30 +- JavaServerFaces_09ResourceBundles/pom.xml | 28 +- .../resources/com.xxy/messages.properties | 10 +- .../src/main/webapp/WEB-INF/faces-config.xml | 28 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/hello.xhtml | 76 ++--- JavaServerFaces_10Internationlization/pom.xml | 28 +- .../src/main/java/com/xxy/LanguageBean.java | 118 ++++---- .../src/main/webapp/WEB-INF/faces-config.xml | 32 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 68 ++--- JavaServerFaces_11TextBox/pom.xml | 27 +- .../src/main/java/com/xxy/form/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 30 +- .../src/main/webapp/user.xhtml | 24 +- JavaServerFaces_12Password/pom.xml | 28 +- .../src/main/java/com/xxy/form/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 30 +- .../src/main/webapp/user.xhtml | 24 +- JavaServerFaces_13TextArea/pom.xml | 28 +- .../src/main/java/com/xxy/form/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 40 +-- .../src/main/webapp/user.xhtml | 24 +- JavaServerFaces_14HiddenValue/pom.xml | 28 +- .../src/main/java/com/xxy/form/UserBean.java | 42 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 52 ++-- JavaServerFaces_15Checkboxes/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 278 +++++++++--------- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 114 +++---- .../src/main/webapp/result.xhtml | 44 +-- JavaServerFaces_16RadioButtons/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 170 +++++------ .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 86 +++--- .../src/main/webapp/result.xhtml | 40 +-- JavaServerFaces_17Listbox/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 170 +++++------ .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 86 +++--- .../src/main/webapp/result.xhtml | 40 +-- JavaServerFaces_18MultiSelectListbox/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 196 ++++++------ .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 86 +++--- .../src/main/webapp/result.xhtml | 40 +-- JavaServerFaces_19DropdownBox/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 172 +++++------ .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 86 +++--- .../src/main/webapp/result.xhtml | 40 +-- .../pom.xml | 28 +- JavaServerFaces_21OutputText/pom.xml | 28 +- .../src/main/java/com/xxy/form/UserBean.java | 50 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 40 +-- JavaServerFaces_22OutputFormat/pom.xml | 28 +- .../src/main/java/com/xxy/form/UserBean.java | 50 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 96 +++--- JavaServerFaces_23GraphicImage/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 20 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 36 +-- JavaServerFaces_24OutputStyleSheet/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 20 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 34 +-- .../src/main/webapp/resources/css/style.css | 4 +- JavaServerFaces_25OutputScript/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 20 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 30 +- JavaServerFaces_26ButtonCommanButton/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 28 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 78 ++--- .../src/main/webapp/login.xhtml | 26 +- .../pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 28 +- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/demo.xhtml | 138 ++++----- .../src/main/webapp/login.xhtml | 26 +- JavaServerFaces_28PanelGrid/pom.xml | 28 +- .../src/main/java/com/xxy/DummyBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 66 ++--- .../src/main/webapp/result.xhtml | 32 +- JavaServerFaces_29Message/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 56 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 94 +++--- .../src/main/webapp/result.xhtml | 36 +-- JavaServerFaces_30Param/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 94 +++--- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 58 ++-- .../src/main/webapp/result.xhtml | 42 +-- JavaServerFaces_31Attribute/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 64 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 50 ++-- .../src/main/webapp/result.xhtml | 30 +- .../pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 46 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 46 +-- .../src/main/webapp/result.xhtml | 30 +- JavaServerFaces_33DataTable/pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 146 ++++----- .../resources/com/mkyong/order.properties | 8 +- .../src/main/webapp/WEB-INF/web.xml | 106 +++---- .../src/main/webapp/default.xhtml | 94 +++--- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_34DataTableAdd/pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 260 ++++++++-------- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 168 +++++------ .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_35DataTableUpdate/pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 202 ++++++------- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 152 +++++----- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_36DataTableDelete/pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 166 +++++------ .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 124 ++++---- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_37DataTableRowNumbers/pom.xml | 28 +- .../src/main/java/com/xxy/PersonBean.java | 144 ++++----- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 104 +++---- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_38RepeatTag/pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 184 ++++++------ .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 88 +++--- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_39DataTableSorting/pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 268 ++++++++--------- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 102 +++---- .../main/webapp/resources/css/table-style.css | 42 +-- .../pom.xml | 28 +- .../src/main/java/com/xxy/OrderBean.java | 260 ++++++++-------- .../main/java/com/xxy/SortableDataModel.java | 184 ++++++------ .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 102 +++---- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_41FaceletsTemplate/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 24 +- .../src/main/webapp/WEB-INF/web.xml | 92 +++--- .../src/main/webapp/default.xhtml | 32 +- .../src/main/webapp/page1.xhtml | 46 +-- .../webapp/resources/css/common-style.css | 48 +-- .../template/common/commonContent.xhtml | 32 +- .../webapp/template/common/commonFooter.xhtml | 26 +- .../webapp/template/common/commonHeader.xhtml | 32 +- .../webapp/template/common/commonLayout.xhtml | 76 ++--- JavaServerFaces_42ParameterInTemplate/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 24 +- .../src/main/webapp/WEB-INF/web.xml | 92 +++--- .../src/main/webapp/default.xhtml | 34 +-- .../src/main/webapp/page1.xhtml | 40 +-- .../webapp/resources/css/common-style.css | 48 +-- .../template/common/commonContent.xhtml | 32 +- .../webapp/template/common/commonFooter.xhtml | 26 +- .../webapp/template/common/commonHeader.xhtml | 34 +-- .../webapp/template/common/commonLayout.xhtml | 82 +++--- JavaServerFaces_43CustomTag/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 24 +- .../src/main/webapp/WEB-INF/mkyong.taglib.xml | 20 +- .../WEB-INF/tags/com/mkyong/button.xhtml | 30 +- .../src/main/webapp/WEB-INF/web.xml | 104 +++---- .../src/main/webapp/default.xhtml | 34 +-- .../webapp/resources/css/common-style.css | 48 +-- JavaServerFaces_44RemoveTag/pom.xml | 28 +- .../src/main/java/com/xxy/MessageBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 106 +++---- .../src/main/webapp/default.xhtml | 34 +-- JavaServerFaces_45ConverNumber/pom.xml | 28 +- .../src/main/java/com/xxy/ReceiptBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 66 ++--- .../src/main/webapp/receipt.xhtml | 92 +++--- JavaServerFaces_46ConverDateTime/pom.xml | 28 +- .../src/main/java/com/xxy/ReceiptBean.java | 48 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 66 ++--- .../src/main/webapp/receipt.xhtml | 36 +-- JavaServerFaces_47ValidateLength/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 66 ++--- .../src/main/webapp/result.xhtml | 32 +- JavaServerFaces_48ValidateLongRange/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 66 ++--- .../src/main/webapp/result.xhtml | 32 +- JavaServerFaces_49ValidateDoubleRange/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 68 ++--- .../src/main/webapp/result.xhtml | 32 +- JavaServerFaces_50ValidateRequired/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 52 ++-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 80 ++--- .../src/main/webapp/result.xhtml | 46 +-- JavaServerFaces_51ValidateRegex/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 64 ++-- .../src/main/webapp/result.xhtml | 40 +-- .../main/webapp/WEB-INF/faces-config.pageflow | 2 + JavaServerFaces_52CustomValidation/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 56 ++-- .../resources/com/mkyong/MyMessage.properties | 6 +- .../src/main/webapp/WEB-INF/faces-config.xml | 24 +- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 82 +++--- .../src/main/webapp/result.xhtml | 46 +-- JavaServerFaces_53CustomConverter/pom.xml | 52 ++-- .../src/main/java/com/xxy/URLBookmark.java | 44 +-- .../src/main/java/com/xxy/URLConverter.java | 108 +++---- .../src/main/java/com/xxy/UserBean.java | 40 +-- .../src/main/webapp/WEB-INF/web.xml | 86 +++--- .../src/main/webapp/default.xhtml | 62 ++-- .../src/main/webapp/result.xhtml | 40 +-- JavaServerFaces_54CustomValidator/pom.xml | 28 +- .../src/main/java/com/xxy/EmailValidator.java | 86 +++--- .../src/main/java/com/xxy/UserBean.java | 44 +-- .../src/main/webapp/WEB-INF/web.xml | 94 +++--- .../src/main/webapp/default.xhtml | 62 ++-- .../src/main/webapp/result.xhtml | 36 +-- .../pom.xml | 28 +- .../main/java/com/xxy/PasswordValidator.java | 76 ++--- .../src/main/java/com/xxy/UserBean.java | 140 ++++----- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 80 ++--- .../src/main/webapp/default1.xhtml | 84 +++--- .../src/main/webapp/thanks.xhtml | 18 +- JavaServerFaces_56CompositeComponents/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 56 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 48 +-- .../webapp/resources/mkyong/register.xhtml | 92 +++--- .../src/main/webapp/result.xhtml | 38 +-- JavaServerFaces_57ValueChangeListener/pom.xml | 28 +- .../src/main/java/com/xxy/CountryBean.java | 90 +++--- .../java/com/xxy/CountryValueListener.java | 48 +-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 78 ++--- JavaServerFaces_58ActionListener/pom.xml | 28 +- .../java/com/xxy/NormalActionListener.java | 32 +- .../src/main/java/com/xxy/NormalBean.java | 60 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/default.xhtml | 60 ++-- .../src/main/webapp/result.xhtml | 28 +- .../pom.xml | 28 +- .../main/java/com/xxy/FacesAppListener.java | 62 ++-- .../src/main/webapp/WEB-INF/faces-config.xml | 58 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- JavaServerFaces_60PreRenderViewEvent/pom.xml | 28 +- .../src/main/java/com/xxy/UserBean.java | 52 ++-- .../src/main/webapp/WEB-INF/web.xml | 62 ++-- .../src/main/webapp/access-denied.xhtml | 26 +- .../src/main/webapp/default.xhtml | 32 +- .../pom.xml | 28 +- .../main/java/com/xxy/PasswordValidator.java | 76 ++--- .../src/main/java/com/xxy/UserBean.java | 140 ++++----- .../src/main/webapp/WEB-INF/web.xml | 38 +-- .../src/main/webapp/default.xhtml | 80 ++--- .../src/main/webapp/default1.xhtml | 84 +++--- .../src/main/webapp/thanks.xhtml | 18 +- JavaServerFaces_62JDBCIntegration/pom.xml | 28 +- .../src/main/java/com/xxy/CustomerBean.java | 150 +++++----- .../java/com/xxy/customer/model/Customer.java | 70 ++--- .../src/main/webapp/META-INF/context.xml | 16 +- .../src/main/webapp/WEB-INF/web.xml | 74 ++--- .../src/main/webapp/default.xhtml | 106 +++---- .../main/webapp/resources/css/table-style.css | 42 +-- JavaServerFaces_63Spring/pom.xml | 94 +++--- .../src/main/java/com/xxy/UserBean.java | 44 +-- .../src/main/java/com/xxy/user/bo/UserBo.java | 12 +- .../java/com/xxy/user/bo/impl/UserBoImpl.java | 30 +- .../webapp/WEB-INF/applicationContext.xml | 42 +-- .../src/main/webapp/WEB-INF/faces-config.xml | 44 +-- .../src/main/webapp/WEB-INF/web.xml | 66 ++--- .../src/main/webapp/default.xhtml | 30 +- .../pom.xml | 148 +++++----- .../src/main/java/com/xxy/CustomerBean.java | 124 ++++---- .../java/com/xxy/customer/bo/CustomerBo.java | 24 +- .../xxy/customer/bo/impl/CustomerBoImpl.java | 52 ++-- .../com/xxy/customer/dao/CustomerDao.java | 24 +- .../customer/dao/impl/CustomerDaoImpl.java | 48 +-- .../java/com/xxy/customer/model/Customer.java | 72 ++--- .../webapp/WEB-INF/applicationContext.xml | 26 +- .../src/main/webapp/WEB-INF/faces-config.xml | 48 +-- .../src/main/webapp/WEB-INF/web.xml | 116 ++++---- .../src/main/webapp/default.xhtml | 160 +++++----- .../xxy/customer/hibernate/Customer.hbm.xml | 44 +-- .../com/xxy/customer/spring/CustomerBean.xml | 32 +- .../resources/config/database/db.properties | 6 +- .../config/spring/beans/DataSource.xml | 38 +-- .../spring/beans/HibernateSessionFactory.xml | 56 ++-- .../main/webapp/resources/css/table-style.css | 42 +-- README.md | 8 +- pom.xml | 269 +++++++++-------- 380 files changed, 10819 insertions(+), 10721 deletions(-) create mode 100644 JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/FailBean.java create mode 100644 JavaServerFaces_06ConditionalNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow create mode 100644 JavaServerFaces_07FormActionNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow create mode 100644 JavaServerFaces_07FormActionNavigation/src/main/webapp/page3.xhtml create mode 100644 JavaServerFaces_52CustomValidation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow diff --git a/.gitignore b/.gitignore index 8acdf48..f163055 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,21 @@ -koss-root.ids -*.iml -*.ipr -*.ids -*.iws -.idea -*/*.log -buildNumber.properties -*/target/ -/sh/ -/esb/* -/document -*/null -*.DS_Store -*.settings -*.project -*.classpath -*.db -*.tmp -beans.xml - +koss-root.ids +*.iml +*.ipr +*.ids +*.iws +.idea +*/*.log +buildNumber.properties +*/target/ +/sh/ +/esb/* +/document +*/null +*.DS_Store +*.settings +*.project +*.classpath +*.db +*.tmp +beans.xml + diff --git a/JavaServerFaces_01HelloWorld/pom.xml b/JavaServerFaces_01HelloWorld/pom.xml index 4c10278..edfc0c3 100644 --- a/JavaServerFaces_01HelloWorld/pom.xml +++ b/JavaServerFaces_01HelloWorld/pom.xml @@ -1,15 +1,15 @@ - - - 4.0.0 - - JavaServerFaces - JavaServerFaces-parent - 1.0-SNAPSHOT - - - JavaServerFaces_01HelloWorld - war - + + + 4.0.0 + + JavaServerFaces + JavaServerFaces-parent + 1.0-SNAPSHOT + + + JavaServerFaces_01HelloWorld + war + \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBean.java b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBean.java index 7180a0d..e7557db 100644 --- a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBean.java +++ b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBean.java @@ -1,24 +1,27 @@ -package com.xxy.common; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class HelloBean implements Serializable { - - private static final long serialVersionUID = 1L; - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - +package com.xxy.common; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +@ManagedBean +@SessionScoped +public class HelloBean implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForApplicationScoped.java b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForApplicationScoped.java index f10885e..6807a0e 100644 --- a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForApplicationScoped.java +++ b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForApplicationScoped.java @@ -1,36 +1,36 @@ -package com.xxy.common; - -import javax.faces.bean.ApplicationScoped; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ViewScoped; -import java.io.Serializable; - -@ManagedBean -@ApplicationScoped -public class HelloBeanForApplicationScoped implements Serializable { - - public int commitTimes =0; - private String name; - - public String doSomething(){ - commitTimes++; - return "welcomeForApplicationScoped"; - } - - public int getCommitTimes() { - return commitTimes; - } - - public void setCommitTimes(int commitTimes) { - this.commitTimes = commitTimes; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - +package com.xxy.common; + +import javax.faces.bean.ApplicationScoped; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import java.io.Serializable; + +@ManagedBean +@ApplicationScoped +public class HelloBeanForApplicationScoped implements Serializable { + + public int commitTimes =0; + private String name; + + public String doSomething(){ + commitTimes++; + return "welcomeForApplicationScoped"; + } + + public int getCommitTimes() { + return commitTimes; + } + + public void setCommitTimes(int commitTimes) { + this.commitTimes = commitTimes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForNoneScoped.java b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForNoneScoped.java index 4cce352..34d2c83 100644 --- a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForNoneScoped.java +++ b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForNoneScoped.java @@ -1,35 +1,35 @@ -package com.xxy.common; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.NoneScoped; -import javax.faces.bean.SessionScoped; -import java.io.Serializable; - -@ManagedBean -@NoneScoped -public class HelloBeanForNoneScoped implements Serializable { - - public int commitTimes =0; - private String name; - - public String doSomething(){ - commitTimes++; - return "welcomeForNoneScoped"; - } - - public int getCommitTimes() { - return commitTimes; - } - - public void setCommitTimes(int commitTimes) { - this.commitTimes = commitTimes; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } +package com.xxy.common; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.NoneScoped; +import javax.faces.bean.SessionScoped; +import java.io.Serializable; + +@ManagedBean +@NoneScoped +public class HelloBeanForNoneScoped implements Serializable { + + public int commitTimes =0; + private String name; + + public String doSomething(){ + commitTimes++; + return "welcomeForNoneScoped"; + } + + public int getCommitTimes() { + return commitTimes; + } + + public void setCommitTimes(int commitTimes) { + this.commitTimes = commitTimes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForRequestScoped.java b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForRequestScoped.java index bb55dce..23e3a19 100644 --- a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForRequestScoped.java +++ b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForRequestScoped.java @@ -1,34 +1,34 @@ -package com.xxy.common; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.RequestScoped; -import java.io.Serializable; - -@ManagedBean -@RequestScoped -public class HelloBeanForRequestScoped implements Serializable { - - public int commitTimes =0; - private String name; - - public String doSomething(){ - commitTimes++; - return "welcomeForRequestScoped"; - } - - public int getCommitTimes() { - return commitTimes; - } - - public void setCommitTimes(int commitTimes) { - this.commitTimes = commitTimes; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } +package com.xxy.common; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +import java.io.Serializable; + +@ManagedBean +@RequestScoped +public class HelloBeanForRequestScoped implements Serializable { + + public int commitTimes =0; + private String name; + + public String doSomething(){ + commitTimes++; + return "welcomeForRequestScoped"; + } + + public int getCommitTimes() { + return commitTimes; + } + + public void setCommitTimes(int commitTimes) { + this.commitTimes = commitTimes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForSessionScoped.java b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForSessionScoped.java index 485aea7..fa316c4 100644 --- a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForSessionScoped.java +++ b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForSessionScoped.java @@ -1,35 +1,35 @@ -package com.xxy.common; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.bean.ViewScoped; -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class HelloBeanForSessionScoped implements Serializable { - - public int commitTimes =0; - private String name; - - public String doSomething(){ - commitTimes++; - return "welcomeForSessionScoped"; - } - - public int getCommitTimes() { - return commitTimes; - } - - public void setCommitTimes(int commitTimes) { - this.commitTimes = commitTimes; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } +package com.xxy.common; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.bean.ViewScoped; +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class HelloBeanForSessionScoped implements Serializable { + + public int commitTimes =0; + private String name; + + public String doSomething(){ + commitTimes++; + return "welcomeForSessionScoped"; + } + + public int getCommitTimes() { + return commitTimes; + } + + public void setCommitTimes(int commitTimes) { + this.commitTimes = commitTimes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForViewScoped.java b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForViewScoped.java index 8d143fc..1229d2f 100644 --- a/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForViewScoped.java +++ b/JavaServerFaces_01HelloWorld/src/main/java/com/xxy/common/HelloBeanForViewScoped.java @@ -1,44 +1,44 @@ -package com.xxy.common; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ViewScoped; -import java.io.Serializable; - -@ManagedBean -@ViewScoped -public class HelloBeanForViewScoped implements Serializable { - - public int commitTimes =0; - private String name; - - public String toAnotherView(){ - commitTimes++; - return "welcomeForViewScoped"; - } - - public void stayInThisView(){ - commitTimes++; - } - - public String toThisView(){ - commitTimes++; - return "helloForViewScoped"; - } - - public int getCommitTimes() { - return commitTimes; - } - - public void setCommitTimes(int commitTimes) { - this.commitTimes = commitTimes; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - +package com.xxy.common; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; +import java.io.Serializable; + +@ManagedBean +@ViewScoped +public class HelloBeanForViewScoped implements Serializable { + + public int commitTimes =0; + private String name; + + public String toAnotherView(){ + commitTimes++; + return "welcomeForViewScoped"; + } + + public void stayInThisView(){ + commitTimes++; + } + + public String toThisView(){ + commitTimes++; + return "helloForViewScoped"; + } + + public int getCommitTimes() { + return commitTimes; + } + + public void setCommitTimes(int commitTimes) { + this.commitTimes = commitTimes; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_01HelloWorld/src/main/webapp/WEB-INF/web.xml index a4e0b02..3e00bf0 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/WEB-INF/web.xml @@ -1,38 +1,38 @@ - - - JavaServerFaces_01HelloWorld - - javax.faces.PROJECT_STAGE - Development - - - faces/hello.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - 1 - + + + JavaServerFaces_01HelloWorld + + javax.faces.PROJECT_STAGE + Development + + + faces/hello.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + 1 + \ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/hello.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/hello.xhtml index 02a37ee..cdaa177 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/hello.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/hello.xhtml @@ -1,18 +1,18 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - hello.xhtml

- - - - -
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - hello.xhtml

+ + + + +
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForApplicationScope.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForApplicationScope.xhtml index 70c3817..91e645c 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForApplicationScope.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForApplicationScope.xhtml @@ -1,18 +1,18 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - helloForApplicationScoped.xhtml

- - - - -
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - helloForApplicationScoped.xhtml

+ + + + +
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForNoneScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForNoneScoped.xhtml index 06a0aa6..11065fb 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForNoneScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForNoneScoped.xhtml @@ -1,18 +1,18 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - helloForNoneScoped.xhtml

- - - - -
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - helloForNoneScoped.xhtml

+ + + + +
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForRequestScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForRequestScoped.xhtml index 469a90a..9cdf648 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForRequestScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForRequestScoped.xhtml @@ -1,18 +1,18 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - helloForRequestScoped.xhtml

- - - - -
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - helloForRequestScoped.xhtml

+ + + + +
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForSessionScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForSessionScoped.xhtml index 1c545a6..b943172 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForSessionScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForSessionScoped.xhtml @@ -1,18 +1,18 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - helloForSessionScoped.xhtml

- - - - -
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - helloForSessionScoped.xhtml

+ + + + +
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForViewScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForViewScoped.xhtml index 6183542..1272ae7 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/helloForViewScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/helloForViewScoped.xhtml @@ -1,25 +1,25 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - helloForViewScoped.xhtml

- - -

- -

- -

- -

- -
-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - helloForViewScoped.xhtml

+ + +

+ +

+ +

+ +

+ +
+
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/helloScopesIndex.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/helloScopesIndex.xhtml index a313845..e9d8396 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/helloScopesIndex.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/helloScopesIndex.xhtml @@ -1,30 +1,30 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - helloScopesIndex.xhtml

- - - -

-

- -

-

- -

-

- -

-

- -
-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - helloScopesIndex.xhtml

+ + + +

+

+ +

+

+ +

+

+ +

+

+ +
+
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/welcome.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/welcome.xhtml index fa6ac14..58e73c9 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/welcome.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/welcome.xhtml @@ -1,15 +1,15 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - welcome.xhtml

-

Welcome #{helloBean.name}

-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - welcome.xhtml

+

Welcome #{helloBean.name}

+
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForApplicationScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForApplicationScoped.xhtml index 835ce80..556b76c 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForApplicationScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForApplicationScoped.xhtml @@ -1,15 +1,15 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - welcomeForApplicationScoped.xhtml

-

Welcome #{helloBeanForApplicationScoped.name}, Commit #{helloBeanForApplicationScoped.commitTimes} times.

-
- + + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - welcomeForApplicationScoped.xhtml

+

Welcome #{helloBeanForApplicationScoped.name}, Commit #{helloBeanForApplicationScoped.commitTimes} times.

+
+ diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForNoneScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForNoneScoped.xhtml index b4e9dab..be2916b 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForNoneScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForNoneScoped.xhtml @@ -1,15 +1,15 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - welcomeForNoneScoped.xhtml

-

Welcome #{helloBeanForNoneScoped.name}, Commit #{helloBeanForNoneScoped.commitTimes} times.

-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - welcomeForNoneScoped.xhtml

+

Welcome #{helloBeanForNoneScoped.name}, Commit #{helloBeanForNoneScoped.commitTimes} times.

+
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForRequestScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForRequestScoped.xhtml index 1928e37..d24a6d1 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForRequestScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForRequestScoped.xhtml @@ -1,15 +1,15 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - welcomeForRequestScoped.xhtml

-

Welcome #{helloBeanForRequestScoped.name}, Commit #{helloBeanForRequestScoped.commitTimes} times.

-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - welcomeForRequestScoped.xhtml

+

Welcome #{helloBeanForRequestScoped.name}, Commit #{helloBeanForRequestScoped.commitTimes} times.

+
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForSessionScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForSessionScoped.xhtml index d6aabc6..b7438b7 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForSessionScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForSessionScoped.xhtml @@ -1,15 +1,15 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - welcomeForSessionScoped.xhtml

-

Welcome #{helloBeanForSessionScoped.name}, Commit #{helloBeanForSessionScoped.commitTimes} times.

-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - welcomeForSessionScoped.xhtml

+

Welcome #{helloBeanForSessionScoped.name}, Commit #{helloBeanForSessionScoped.commitTimes} times.

+
\ No newline at end of file diff --git a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForViewScoped.xhtml b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForViewScoped.xhtml index d751da4..d6732c5 100644 --- a/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForViewScoped.xhtml +++ b/JavaServerFaces_01HelloWorld/src/main/webapp/welcomeForViewScoped.xhtml @@ -1,15 +1,15 @@ - - - - - - JSF 2.0 Hello World - - -

JSF 2.0 Hello World Example - welcomeForViewScoped.xhtml

-

Welcome #{helloBeanForViewScoped.name}, Commit #{helloBeanForViewScoped.commitTimes} times.

-
+ + + + + + JSF 2.0 Hello World + + +

JSF 2.0 Hello World Example - welcomeForViewScoped.xhtml

+

Welcome #{helloBeanForViewScoped.name}, Commit #{helloBeanForViewScoped.commitTimes} times.

+
\ No newline at end of file diff --git a/JavaServerFaces_02HelloWorldAjax/pom.xml b/JavaServerFaces_02HelloWorldAjax/pom.xml index fb625ad..8fe5c2e 100644 --- a/JavaServerFaces_02HelloWorldAjax/pom.xml +++ b/JavaServerFaces_02HelloWorldAjax/pom.xml @@ -1,16 +1,16 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - - 4.0.0 - war - JavaServerFaces_02HelloWorldAjax - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + + 4.0.0 + war + JavaServerFaces_02HelloWorldAjax + + \ No newline at end of file diff --git a/JavaServerFaces_02HelloWorldAjax/src/main/java/com/xxy/common/HelloBean.java b/JavaServerFaces_02HelloWorldAjax/src/main/java/com/xxy/common/HelloBean.java index 2169a26..d10a170 100644 --- a/JavaServerFaces_02HelloWorldAjax/src/main/java/com/xxy/common/HelloBean.java +++ b/JavaServerFaces_02HelloWorldAjax/src/main/java/com/xxy/common/HelloBean.java @@ -1,32 +1,42 @@ -package com.xxy.common; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class HelloBean implements Serializable { - - private static final long serialVersionUID = 1L; - - private String name; - private String name2; - - public String getName2() { - return name2; - } - - public void setName2(String name2) { - this.name2 = name2; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - +package com.xxy.common; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class HelloBean implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + private String name2; + private String passwrod; + + public String getPasswrod() { + return passwrod; + } + + public void setPasswrod(String passwrod) { + this.passwrod = passwrod; + } + + public String getName2() { + return name2; + } + + public void setName2(String name2) { + this.name2 = name2; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + } \ No newline at end of file diff --git a/JavaServerFaces_02HelloWorldAjax/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_02HelloWorldAjax/src/main/webapp/WEB-INF/web.xml index c4c9a79..cd6a09d 100644 --- a/JavaServerFaces_02HelloWorldAjax/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_02HelloWorldAjax/src/main/webapp/WEB-INF/web.xml @@ -1,34 +1,34 @@ - - - JavaServerFaces_02HelloWorldAjax - - javax.faces.PROJECT_STAGE - Development - - - faces/helloAjax.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_02HelloWorldAjax + + javax.faces.PROJECT_STAGE + Development + + + faces/helloAjax.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_02HelloWorldAjax/src/main/webapp/helloAjax.xhtml b/JavaServerFaces_02HelloWorldAjax/src/main/webapp/helloAjax.xhtml index de7d3d6..40386b1 100644 --- a/JavaServerFaces_02HelloWorldAjax/src/main/webapp/helloAjax.xhtml +++ b/JavaServerFaces_02HelloWorldAjax/src/main/webapp/helloAjax.xhtml @@ -1,20 +1,21 @@ - - - -

JSF 2.0 + Ajax Hello World Example

- - - - - - - - -

The first input value:

-

The second input value:

-
-
+ + + +

JSF 2.0 + Ajax Hello World Example

+ + + + + + + + + +

The first input value:

+

The second input value:

+
+
\ No newline at end of file diff --git a/JavaServerFaces_03ManagedBeans/pom.xml b/JavaServerFaces_03ManagedBeans/pom.xml index b47f7d2..927d7a0 100644 --- a/JavaServerFaces_03ManagedBeans/pom.xml +++ b/JavaServerFaces_03ManagedBeans/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces - JavaServerFaces-parent - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_03ManagedBeans - war - + + + + JavaServerFaces + JavaServerFaces-parent + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_03ManagedBeans + war + \ No newline at end of file diff --git a/JavaServerFaces_03ManagedBeans/src/main/java/com/xxy/common/HelloBean.java b/JavaServerFaces_03ManagedBeans/src/main/java/com/xxy/common/HelloBean.java index 75f3520..b833ba1 100644 --- a/JavaServerFaces_03ManagedBeans/src/main/java/com/xxy/common/HelloBean.java +++ b/JavaServerFaces_03ManagedBeans/src/main/java/com/xxy/common/HelloBean.java @@ -1,33 +1,45 @@ -package com.xxy.common; - -import java.io.Serializable; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean -@SessionScoped -public class HelloBean implements Serializable { - - private static final long serialVersionUID = 1L; - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSayWelcome(){ - //check if null? - if("".equals(name) || name ==null){ - return ""; - }else{ - return "Ajax message : Welcome " + name; - } - } - +package com.xxy.common; + +import java.io.Serializable; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +import javax.faces.bean.SessionScoped; + +@ManagedBean +@RequestScoped +public class HelloBean implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + private String passwrod; + + public String getPasswrod() { + return passwrod; + } + + public void setPasswrod(String passwrod) { + this.passwrod = passwrod; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSayWelcome(){ + //check if null? + if("".equals(name) || name ==null){ + return ""; + }else if ("ragrok".equals(getName()) && "1234".equals(getPasswrod())) { + return "Ajax message : name: ragrok,password:1234."; + }else{ + return "Ajax message : Welcome " + name; + } + } + } \ No newline at end of file diff --git a/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/faces-config.xml index 7e0016b..b31cb5c 100644 --- a/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/faces-config.xml @@ -1,15 +1,15 @@ - - - - + + + + diff --git a/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/manage-beans.xml b/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/manage-beans.xml index 0ce5963..b1da66a 100644 --- a/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/manage-beans.xml +++ b/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/manage-beans.xml @@ -1,13 +1,13 @@ - - - - helloBean - com.xxy.common.HelloBean - session - - + + + + helloBean + com.xxy.common.HelloBean + session + + diff --git a/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/web.xml index 4b2cea9..ac8ed0f 100644 --- a/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_03ManagedBeans/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_03ManagedBeans - - javax.faces.PROJECT_STAGE - Development - - - faces/helloAjax.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_03ManagedBeans + + javax.faces.PROJECT_STAGE + Development + + + faces/helloAjax.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_03ManagedBeans/src/main/webapp/helloAjax.xhtml b/JavaServerFaces_03ManagedBeans/src/main/webapp/helloAjax.xhtml index d5fa4cc..3dce9fd 100644 --- a/JavaServerFaces_03ManagedBeans/src/main/webapp/helloAjax.xhtml +++ b/JavaServerFaces_03ManagedBeans/src/main/webapp/helloAjax.xhtml @@ -1,21 +1,23 @@ - - - - - -

JSF 2.0 + Ajax Hello World Example

- - - - - - - -

-
- -
+ + + + + +

JSF 2.0 + Ajax Hello World Example

+ + + + + + + + + +

+
+ +
\ No newline at end of file diff --git a/JavaServerFaces_04InjectManagedBeans/pom.xml b/JavaServerFaces_04InjectManagedBeans/pom.xml index c7f1bf2..022ba4f 100644 --- a/JavaServerFaces_04InjectManagedBeans/pom.xml +++ b/JavaServerFaces_04InjectManagedBeans/pom.xml @@ -1,15 +1,14 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_04InjectManagedBeans - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_04InjectManagedBeans + war + \ No newline at end of file diff --git a/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/FailBean.java b/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/FailBean.java new file mode 100644 index 0000000..997f215 --- /dev/null +++ b/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/FailBean.java @@ -0,0 +1,28 @@ +package com.xxy.common; + +import java.io.Serializable; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="fail") +@SessionScoped +public class FailBean implements Serializable{ + /** + * + */ + private static final long serialVersionUID = 1L; + private String name = "ragrok"; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSayHello(){ + return "my name is ragrok"; + } +} diff --git a/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/HelloBean.java b/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/HelloBean.java index 1c94586..ca6bb3a 100644 --- a/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/HelloBean.java +++ b/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/HelloBean.java @@ -1,41 +1,51 @@ -package com.xxy.common; - -import java.io.Serializable; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.ManagedProperty; -import javax.faces.bean.SessionScoped; - -@ManagedBean -@SessionScoped -public class HelloBean implements Serializable { - - private static final long serialVersionUID = 1L; - - @ManagedProperty(value="#{message}") - private MessageBean messageBean; - - public void setMessageBean(MessageBean messageBean) { - this.messageBean = messageBean; - } - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSayWelcome(){ - //check if null? - if("".equals(name) || name ==null){ - return ""; - }else{ - return messageBean.getSayWelcome() + name; - } - } - +package com.xxy.common; + +import java.io.Serializable; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ManagedProperty; +import javax.faces.bean.SessionScoped; + +@ManagedBean +@SessionScoped +public class HelloBean implements Serializable { + + private static final long serialVersionUID = 1L; + + @ManagedProperty(value="#{message}") + private MessageBean messageBean; + @ManagedProperty(value="#{fail}") + private FailBean failBean; + + private String name; + + //注入只需要set方法就可以了 + public void setMessageBean(MessageBean messageBean) { + this.messageBean = messageBean; + } + + + public void setFailBean(FailBean failBean) { + this.failBean = failBean; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSayWelcome(){ + //check if null? + if("".equals(name) || name ==null){ + return ""; + }else if (name.equals(failBean.getName())) { + return failBean.getSayHello(); + }{ + return messageBean.getSayWelcome() + name; + } + } + } \ No newline at end of file diff --git a/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/MessageBean.java b/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/MessageBean.java index bd2bf8d..7dfc38e 100644 --- a/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/MessageBean.java +++ b/JavaServerFaces_04InjectManagedBeans/src/main/java/com/xxy/common/MessageBean.java @@ -1,24 +1,24 @@ -package com.xxy.common; - -import java.io.Serializable; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="message") -@SessionScoped -public class MessageBean implements Serializable { - - private static final long serialVersionUID = 1L; - - private String sayWelcome = "Welcome to JSF 2.0"; - - public String getSayWelcome() { - return sayWelcome; - } - - public void setSayWelcome(String sayWelcome) { - this.sayWelcome = sayWelcome; - } - +package com.xxy.common; + +import java.io.Serializable; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="message") +@SessionScoped +public class MessageBean implements Serializable { + + private static final long serialVersionUID = 1L; + + private String sayWelcome = "Welcome to JSF 2.0"; + + public String getSayWelcome() { + return sayWelcome; + } + + public void setSayWelcome(String sayWelcome) { + this.sayWelcome = sayWelcome; + } + } \ No newline at end of file diff --git a/JavaServerFaces_04InjectManagedBeans/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_04InjectManagedBeans/src/main/webapp/WEB-INF/web.xml index 6297b7a..4d986e8 100644 --- a/JavaServerFaces_04InjectManagedBeans/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_04InjectManagedBeans/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_04InjectManagedBeans - - javax.faces.PROJECT_STAGE - Development - - - faces/helloAjax.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_04InjectManagedBeans + + javax.faces.PROJECT_STAGE + Development + + + faces/helloAjax.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_04InjectManagedBeans/src/main/webapp/helloAjax.xhtml b/JavaServerFaces_04InjectManagedBeans/src/main/webapp/helloAjax.xhtml index d5fa4cc..86f07df 100644 --- a/JavaServerFaces_04InjectManagedBeans/src/main/webapp/helloAjax.xhtml +++ b/JavaServerFaces_04InjectManagedBeans/src/main/webapp/helloAjax.xhtml @@ -1,21 +1,21 @@ - - - - - -

JSF 2.0 + Ajax Hello World Example

- - - - - - - -

-
- -
+ + + + + +

JSF 2.0 + Ajax Hello World Example

+ + + + + + + +

+
+ +
\ No newline at end of file diff --git a/JavaServerFaces_05ImplicitNavigation/pom.xml b/JavaServerFaces_05ImplicitNavigation/pom.xml index 4d891ea..3663ce4 100644 --- a/JavaServerFaces_05ImplicitNavigation/pom.xml +++ b/JavaServerFaces_05ImplicitNavigation/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_05ImplicitNavigation - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_05ImplicitNavigation + war + \ No newline at end of file diff --git a/JavaServerFaces_05ImplicitNavigation/src/main/java/com/xxy/controller/PageController.java b/JavaServerFaces_05ImplicitNavigation/src/main/java/com/xxy/controller/PageController.java index 9514d9b..a36897e 100644 --- a/JavaServerFaces_05ImplicitNavigation/src/main/java/com/xxy/controller/PageController.java +++ b/JavaServerFaces_05ImplicitNavigation/src/main/java/com/xxy/controller/PageController.java @@ -1,22 +1,22 @@ -package com.xxy.controller; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class PageController implements Serializable { - - private static final long serialVersionUID = 1L; - - public String moveToPage1(){ - return "page1"; - } - - public String moveToPage2(){ - return "page2"; - } - +package com.xxy.controller; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class PageController implements Serializable { + + private static final long serialVersionUID = 1L; + + public String moveToPage1(){ + return "page1"; + } + + public String moveToPage2(){ + return "page2"; + } + } \ No newline at end of file diff --git a/JavaServerFaces_05ImplicitNavigation/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_05ImplicitNavigation/src/main/webapp/WEB-INF/web.xml index 758ac4d..fb40213 100644 --- a/JavaServerFaces_05ImplicitNavigation/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_05ImplicitNavigation/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_05ImplicitNavigation - - javax.faces.PROJECT_STAGE - Development - - - faces/page1.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_05ImplicitNavigation + + javax.faces.PROJECT_STAGE + Development + + + faces/page1.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page1.xhtml b/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page1.xhtml index c236430..c3a3542 100644 --- a/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page1.xhtml +++ b/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page1.xhtml @@ -1,17 +1,17 @@ - - - - - -

This is page1.xhtml

- - - - - - -
+ + + + + +

This is page1.xhtml

+ + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page2.xhtml b/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page2.xhtml index 65a2d0e..83bb9fc 100644 --- a/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page2.xhtml +++ b/JavaServerFaces_05ImplicitNavigation/src/main/webapp/page2.xhtml @@ -1,17 +1,17 @@ - - - - - -

This is page2.xhtml

- - - - - - -
+ + + + + +

This is page2.xhtml

+ + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/JavaServerFaces_06ConditionalNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..31a68a8 --- /dev/null +++ b/JavaServerFaces_06ConditionalNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/JavaServerFaces_06ConditionalNavigation/pom.xml b/JavaServerFaces_06ConditionalNavigation/pom.xml index d3a1796..1110150 100644 --- a/JavaServerFaces_06ConditionalNavigation/pom.xml +++ b/JavaServerFaces_06ConditionalNavigation/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_06ConditionalNavigation - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_06ConditionalNavigation + war + \ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/java/com/xxy/controller/PaymentController.java b/JavaServerFaces_06ConditionalNavigation/src/main/java/com/xxy/controller/PaymentController.java index f63ae71..148ef8c 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/java/com/xxy/controller/PaymentController.java +++ b/JavaServerFaces_06ConditionalNavigation/src/main/java/com/xxy/controller/PaymentController.java @@ -1,33 +1,33 @@ -package com.xxy.controller; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class PaymentController implements Serializable { - - private static final long serialVersionUID = 1L; - - public boolean registerCompleted = true; - public int orderQty = 99; - - public int getOrderQty() { - return orderQty; - } - - public void setOrderQty(int orderQty) { - this.orderQty = orderQty; - } - - public boolean isRegisterCompleted() { - return registerCompleted; - } - - public void setRegisterCompleted(boolean registerCompleted) { - this.registerCompleted = registerCompleted; - } - +package com.xxy.controller; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class PaymentController implements Serializable { + + private static final long serialVersionUID = 1L; + + public boolean registerCompleted = false; + public int orderQty = 99; + + public int getOrderQty() { + return orderQty; + } + + public void setOrderQty(int orderQty) { + this.orderQty = orderQty; + } + + public boolean isRegisterCompleted() { + return registerCompleted; + } + + public void setRegisterCompleted(boolean registerCompleted) { + this.registerCompleted = registerCompleted; + } + } \ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/faces-config.xml index 686fe8c..41d0851 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/faces-config.xml @@ -1,27 +1,27 @@ - - - - - start.xhtml - - payment - #{paymentController.orderQty < 100} - ordermore.xhtml - - - payment - #{paymentController.registerCompleted} - payment.xhtml - - - payment - register.xhtml - - - - + + + + + start.xhtml + + payment + #{paymentController.orderQty > 100} + ordermore.xhtml + + + payment + #{paymentController.registerCompleted} + payment.xhtml + + + payment + register.xhtml + + + + diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/web.xml index 5b70513..24729cf 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_06ConditionalNavigation - - javax.faces.PROJECT_STAGE - Development - - - faces/start.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_06ConditionalNavigation + + javax.faces.PROJECT_STAGE + Development + + + faces/start.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/ordermore.xhtml b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/ordermore.xhtml index 23add82..cf33916 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/ordermore.xhtml +++ b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/ordermore.xhtml @@ -1,10 +1,10 @@ - - - - - -

This is ordermore.xhtml

-
+ + + + + +

This is ordermore.xhtml

+
\ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/payment.xhtml b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/payment.xhtml index 4da1b70..a23a3f2 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/payment.xhtml +++ b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/payment.xhtml @@ -1,10 +1,10 @@ - - - - - -

This is payment.xhtml

-
+ + + + + +

This is payment.xhtml

+
\ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/register.xhtml b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/register.xhtml index 7dae853..5ff2e3a 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/register.xhtml +++ b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/register.xhtml @@ -1,10 +1,10 @@ - - - - - -

This is resgister.xhtml

-
+ + + + + +

This is resgister.xhtml

+
\ No newline at end of file diff --git a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/start.xhtml b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/start.xhtml index d4b3fd2..0961846 100644 --- a/JavaServerFaces_06ConditionalNavigation/src/main/webapp/start.xhtml +++ b/JavaServerFaces_06ConditionalNavigation/src/main/webapp/start.xhtml @@ -1,15 +1,15 @@ - - - - - -

This is start.xhtml

- - - - - -
+ + + + + +

This is start.xhtml

+ + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/JavaServerFaces_07FormActionNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..cdaeb1d --- /dev/null +++ b/JavaServerFaces_07FormActionNavigation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/JavaServerFaces_07FormActionNavigation/pom.xml b/JavaServerFaces_07FormActionNavigation/pom.xml index e0d1d5d..d2ca375 100644 --- a/JavaServerFaces_07FormActionNavigation/pom.xml +++ b/JavaServerFaces_07FormActionNavigation/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_07FormActionNavigation - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_07FormActionNavigation + war + \ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/src/main/java/com/xxy/controller/PageController.java b/JavaServerFaces_07FormActionNavigation/src/main/java/com/xxy/controller/PageController.java index b3d1880..f644065 100644 --- a/JavaServerFaces_07FormActionNavigation/src/main/java/com/xxy/controller/PageController.java +++ b/JavaServerFaces_07FormActionNavigation/src/main/java/com/xxy/controller/PageController.java @@ -1,22 +1,25 @@ -package com.xxy.controller; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class PageController implements Serializable { - - private static final long serialVersionUID = 1L; - - public String processPage1(){ - return "success"; - } - - public String processPage2(){ - return "success"; - } - +package com.xxy.controller; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class PageController implements Serializable { + + private static final long serialVersionUID = 1L; + + public String processPage1(){ + return "success"; + } + + public String processPage2(){ + return "success"; + } + + public String processPage3(){ + return "success"; + } } \ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/faces-config.xml index 54aea26..41faea4 100644 --- a/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/faces-config.xml @@ -1,23 +1,28 @@ - - - - - start.xhtml - - #{pageController.processPage1} - success - page1.xhtml - - - #{pageController.processPage2} - success - page2.xhtml - - - - + + + + + start.xhtml + + #{pageController.processPage1} + success + page1.xhtml + + + #{pageController.processPage2} + success + page2.xhtml + + + #{pageController.processPage3} + success + page3.xhtml + + + + diff --git a/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/web.xml index 7467315..ee5b287 100644 --- a/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_07FormActionNavigation/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_07FormActionNavigation - - javax.faces.PROJECT_STAGE - Development - - - faces/start.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_07FormActionNavigation + + javax.faces.PROJECT_STAGE + Development + + + faces/start.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/src/main/webapp/page1.xhtml b/JavaServerFaces_07FormActionNavigation/src/main/webapp/page1.xhtml index defc5aa..e0735a7 100644 --- a/JavaServerFaces_07FormActionNavigation/src/main/webapp/page1.xhtml +++ b/JavaServerFaces_07FormActionNavigation/src/main/webapp/page1.xhtml @@ -1,10 +1,10 @@ - - - - - -

This is page1.xhtml

-
+ + + + + +

This is page1.xhtml

+
\ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/src/main/webapp/page2.xhtml b/JavaServerFaces_07FormActionNavigation/src/main/webapp/page2.xhtml index a239f6b..71c5b49 100644 --- a/JavaServerFaces_07FormActionNavigation/src/main/webapp/page2.xhtml +++ b/JavaServerFaces_07FormActionNavigation/src/main/webapp/page2.xhtml @@ -1,10 +1,10 @@ - - - - - -

This is page2.xhtml

-
+ + + + + +

This is page2.xhtml

+
\ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/src/main/webapp/page3.xhtml b/JavaServerFaces_07FormActionNavigation/src/main/webapp/page3.xhtml new file mode 100644 index 0000000..24dbe66 --- /dev/null +++ b/JavaServerFaces_07FormActionNavigation/src/main/webapp/page3.xhtml @@ -0,0 +1,10 @@ + + + + + +

This is page3.xhtml

+
+ \ No newline at end of file diff --git a/JavaServerFaces_07FormActionNavigation/src/main/webapp/start.xhtml b/JavaServerFaces_07FormActionNavigation/src/main/webapp/start.xhtml index f79ea65..ffe933c 100644 --- a/JavaServerFaces_07FormActionNavigation/src/main/webapp/start.xhtml +++ b/JavaServerFaces_07FormActionNavigation/src/main/webapp/start.xhtml @@ -1,16 +1,17 @@ - - - - - -

This is start.xhtml

- - - - - - -
+ + + + + +

This is start.xhtml

+ + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_08PageRedirection/pom.xml b/JavaServerFaces_08PageRedirection/pom.xml index ca91e2a..e31e635 100644 --- a/JavaServerFaces_08PageRedirection/pom.xml +++ b/JavaServerFaces_08PageRedirection/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_08PageRedirection - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_08PageRedirection + war + \ No newline at end of file diff --git a/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/faces-config.xml index 4250fbf..5e9c3ce 100644 --- a/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/faces-config.xml @@ -1,19 +1,19 @@ - - - - - + + + + + diff --git a/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/web.xml index 71fc7c6..f61821f 100644 --- a/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_08PageRedirection/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_08PageRedirection - - javax.faces.PROJECT_STAGE - Development - - - faces/start.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_08PageRedirection + + javax.faces.PROJECT_STAGE + Development + + + faces/start.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_08PageRedirection/src/main/webapp/page1.xhtml b/JavaServerFaces_08PageRedirection/src/main/webapp/page1.xhtml index defc5aa..e0735a7 100644 --- a/JavaServerFaces_08PageRedirection/src/main/webapp/page1.xhtml +++ b/JavaServerFaces_08PageRedirection/src/main/webapp/page1.xhtml @@ -1,10 +1,10 @@ - - - - - -

This is page1.xhtml

-
+ + + + + +

This is page1.xhtml

+
\ No newline at end of file diff --git a/JavaServerFaces_08PageRedirection/src/main/webapp/start.xhtml b/JavaServerFaces_08PageRedirection/src/main/webapp/start.xhtml index e5f0e78..e52f35d 100644 --- a/JavaServerFaces_08PageRedirection/src/main/webapp/start.xhtml +++ b/JavaServerFaces_08PageRedirection/src/main/webapp/start.xhtml @@ -1,16 +1,16 @@ - - - - - -

This is start.xhtml

- - - - - - -
+ + + + + +

This is start.xhtml

+ + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_09ResourceBundles/pom.xml b/JavaServerFaces_09ResourceBundles/pom.xml index da7c591..fceb597 100644 --- a/JavaServerFaces_09ResourceBundles/pom.xml +++ b/JavaServerFaces_09ResourceBundles/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_09ResourceBundles - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_09ResourceBundles +war + \ No newline at end of file diff --git a/JavaServerFaces_09ResourceBundles/src/main/resources/com.xxy/messages.properties b/JavaServerFaces_09ResourceBundles/src/main/resources/com.xxy/messages.properties index aa2ef38..2f5ead5 100644 --- a/JavaServerFaces_09ResourceBundles/src/main/resources/com.xxy/messages.properties +++ b/JavaServerFaces_09ResourceBundles/src/main/resources/com.xxy/messages.properties @@ -1,6 +1,6 @@ -message = This is "message" -message.test1 = This is "message.test1" -message.test2 = This is "

message.test3

" -message.test3 = This is "<h2>message.test4</h2>" -message.param1 = This is "message.param1" - {0} +message = This is "message" +message.test1 = This is "message.test1" +message.test2 = This is "

message.test3

" +message.test3 = This is "<h2>message.test4</h2>" +message.param1 = This is "message.param1" - {0} message.param2 = This is "message.param2" - {0} and {1} \ No newline at end of file diff --git a/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml index 20fc2eb..1cb880f 100644 --- a/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml @@ -1,14 +1,14 @@ - - - - - com.xxy.messages - msg - - - + + + + + com.xxy.messages + msg + + + diff --git a/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/web.xml index 0fea051..b87ee55 100644 --- a/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_09ResourceBundles - - javax.faces.PROJECT_STAGE - Development - - - faces/hello.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_09ResourceBundles + + javax.faces.PROJECT_STAGE + Development + + + faces/hello.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_09ResourceBundles/src/main/webapp/hello.xhtml b/JavaServerFaces_09ResourceBundles/src/main/webapp/hello.xhtml index 9c6dcec..138a13d 100644 --- a/JavaServerFaces_09ResourceBundles/src/main/webapp/hello.xhtml +++ b/JavaServerFaces_09ResourceBundles/src/main/webapp/hello.xhtml @@ -1,39 +1,39 @@ - - - - - - - -

JSF 2.0 and Resource Bundles Examples

-
    - -
  1. - -
  2. - -
  3. -
  4. - -
  5. -
  6. - -
  7. - - - -
  8. -
  9. - - - - -
  10. -
-
+ + + + + + + +

JSF 2.0 and Resource Bundles Examples

+
    + +
  1. + +
  2. + +
  3. +
  4. + +
  5. +
  6. + +
  7. + + + +
  8. +
  9. + + + + +
  10. +
+
\ No newline at end of file diff --git a/JavaServerFaces_10Internationlization/pom.xml b/JavaServerFaces_10Internationlization/pom.xml index 5101282..986270d 100644 --- a/JavaServerFaces_10Internationlization/pom.xml +++ b/JavaServerFaces_10Internationlization/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_10Internationlization - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_10Internationlization +war + \ No newline at end of file diff --git a/JavaServerFaces_10Internationlization/src/main/java/com/xxy/LanguageBean.java b/JavaServerFaces_10Internationlization/src/main/java/com/xxy/LanguageBean.java index 9c76572..0ad1d60 100644 --- a/JavaServerFaces_10Internationlization/src/main/java/com/xxy/LanguageBean.java +++ b/JavaServerFaces_10Internationlization/src/main/java/com/xxy/LanguageBean.java @@ -1,60 +1,60 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Locale; -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; -import javax.faces.event.ValueChangeEvent; - -@ManagedBean(name="language") -@SessionScoped -public class LanguageBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private String localeCode; - - private static Map countries; - static{ - countries = new LinkedHashMap(); - countries.put("English", Locale.ENGLISH); //label, value - countries.put("Chinese", Locale.SIMPLIFIED_CHINESE); - } - - public Map getCountriesInMap() { - return countries; - } - - - public String getLocaleCode() { - return localeCode; - } - - - public void setLocaleCode(String localeCode) { - this.localeCode = localeCode; - } - - - public void countryLocaleCodeChanged(ValueChangeEvent e){ - - String newLocaleValue = e.getNewValue().toString(); - - //loop a map to compare the locale code - for (Map.Entry entry : countries.entrySet()) { - - if(entry.getValue().toString().equals(newLocaleValue)){ - - FacesContext.getCurrentInstance() - .getViewRoot().setLocale((Locale)entry.getValue()); - - } - } - - } - +package com.xxy; + +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Locale; +import java.util.Map; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.ValueChangeEvent; + +@ManagedBean(name="language") +@SessionScoped +public class LanguageBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private String localeCode; + + private static Map countries; + static{ + countries = new LinkedHashMap(); + countries.put("English", Locale.ENGLISH); //label, value + countries.put("Chinese", Locale.SIMPLIFIED_CHINESE); + } + + public Map getCountriesInMap() { + return countries; + } + + + public String getLocaleCode() { + return localeCode; + } + + + public void setLocaleCode(String localeCode) { + this.localeCode = localeCode; + } + + + public void countryLocaleCodeChanged(ValueChangeEvent e){ + + String newLocaleValue = e.getNewValue().toString(); + + //loop a map to compare the locale code + for (Map.Entry entry : countries.entrySet()) { + + if(entry.getValue().toString().equals(newLocaleValue)){ + + FacesContext.getCurrentInstance() + .getViewRoot().setLocale((Locale)entry.getValue()); + + } + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml index 67633fe..c24f584 100644 --- a/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml @@ -1,17 +1,17 @@ - - - - - en - - - com.xxy.welcome - msg - - + + + + + en + + + com.xxy.welcome + msg + + \ No newline at end of file diff --git a/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/web.xml index fb02177..45d0df7 100644 --- a/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_10Internationlization - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_10Internationlization + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml b/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml index 9b7acaf..3e8db6a 100644 --- a/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml +++ b/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml @@ -1,35 +1,35 @@ - - - - - - -

JSF 2 internationalization example

- - - -

- -

- - - - Language : - - - - - - - - -
- -
+ + + + + + +

JSF 2 internationalization example

+ + + +

+ +

+ + + + Language : + + + + + + + + +
+ +
\ No newline at end of file diff --git a/JavaServerFaces_11TextBox/pom.xml b/JavaServerFaces_11TextBox/pom.xml index f17af17..bae86cb 100644 --- a/JavaServerFaces_11TextBox/pom.xml +++ b/JavaServerFaces_11TextBox/pom.xml @@ -1,15 +1,14 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_11TextBox - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_11TextBox + war + \ No newline at end of file diff --git a/JavaServerFaces_11TextBox/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_11TextBox/src/main/java/com/xxy/form/UserBean.java index 5351a1f..e8fcf59 100644 --- a/JavaServerFaces_11TextBox/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_11TextBox/src/main/java/com/xxy/form/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy.form; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class UserBean implements Serializable { - - private String userName; - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - +package com.xxy.form; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class UserBean implements Serializable { + + private String userName; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + } \ No newline at end of file diff --git a/JavaServerFaces_11TextBox/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_11TextBox/src/main/webapp/WEB-INF/web.xml index 82737de..f1ccc5b 100644 --- a/JavaServerFaces_11TextBox/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_11TextBox/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_11TextBox - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_11TextBox + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_11TextBox/src/main/webapp/demo.xhtml b/JavaServerFaces_11TextBox/src/main/webapp/demo.xhtml index 1f9aac5..6a5e002 100644 --- a/JavaServerFaces_11TextBox/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_11TextBox/src/main/webapp/demo.xhtml @@ -1,16 +1,16 @@ - - - - - -

JSF 2 textbox example

- - - - - - -
+ + + + + +

JSF 2 textbox example

+ + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_11TextBox/src/main/webapp/user.xhtml b/JavaServerFaces_11TextBox/src/main/webapp/user.xhtml index 47370bf..8d90ed4 100644 --- a/JavaServerFaces_11TextBox/src/main/webapp/user.xhtml +++ b/JavaServerFaces_11TextBox/src/main/webapp/user.xhtml @@ -1,13 +1,13 @@ - - - - - -

JSF 2 textbox example

- - Submitted value : - -
+ + + + + +

JSF 2 textbox example

+ + Submitted value : + +
\ No newline at end of file diff --git a/JavaServerFaces_12Password/pom.xml b/JavaServerFaces_12Password/pom.xml index 20183d0..51f1776 100644 --- a/JavaServerFaces_12Password/pom.xml +++ b/JavaServerFaces_12Password/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_12Password - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_12Password +war + \ No newline at end of file diff --git a/JavaServerFaces_12Password/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_12Password/src/main/java/com/xxy/form/UserBean.java index 3fc1c30..3ea5aa2 100644 --- a/JavaServerFaces_12Password/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_12Password/src/main/java/com/xxy/form/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy.form; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import java.io.Serializable; - -@ManagedBean -@SessionScoped -public class UserBean implements Serializable { - - private String password; - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - +package com.xxy.form; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import java.io.Serializable; + +@ManagedBean +@SessionScoped +public class UserBean implements Serializable { + + private String password; + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + } \ No newline at end of file diff --git a/JavaServerFaces_12Password/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_12Password/src/main/webapp/WEB-INF/web.xml index d8107b3..925e940 100644 --- a/JavaServerFaces_12Password/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_12Password/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_12Password - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_12Password + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_12Password/src/main/webapp/demo.xhtml b/JavaServerFaces_12Password/src/main/webapp/demo.xhtml index 18b35a2..102adf0 100644 --- a/JavaServerFaces_12Password/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_12Password/src/main/webapp/demo.xhtml @@ -1,16 +1,16 @@ - - - - - -

JSF 2 password example

- - - Password : - - - -
+ + + + + +

JSF 2 password example

+ + + Password : + + + +
\ No newline at end of file diff --git a/JavaServerFaces_12Password/src/main/webapp/user.xhtml b/JavaServerFaces_12Password/src/main/webapp/user.xhtml index 2e6e991..eef1666 100644 --- a/JavaServerFaces_12Password/src/main/webapp/user.xhtml +++ b/JavaServerFaces_12Password/src/main/webapp/user.xhtml @@ -1,13 +1,13 @@ - - - - - -

JSF 2 password example

- - Password : - -
+ + + + + +

JSF 2 password example

+ + Password : + +
\ No newline at end of file diff --git a/JavaServerFaces_13TextArea/pom.xml b/JavaServerFaces_13TextArea/pom.xml index ab15de2..75444cd 100644 --- a/JavaServerFaces_13TextArea/pom.xml +++ b/JavaServerFaces_13TextArea/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_13TextArea - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_13TextArea +war + \ No newline at end of file diff --git a/JavaServerFaces_13TextArea/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_13TextArea/src/main/java/com/xxy/form/UserBean.java index 649f295..a544e5a 100644 --- a/JavaServerFaces_13TextArea/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_13TextArea/src/main/java/com/xxy/form/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy.form; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import java.io.Serializable; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable { - - private String address; - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - +package com.xxy.form; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import java.io.Serializable; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable { + + private String address; + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + } \ No newline at end of file diff --git a/JavaServerFaces_13TextArea/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_13TextArea/src/main/webapp/WEB-INF/web.xml index a438622..bf52e0a 100644 --- a/JavaServerFaces_13TextArea/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_13TextArea/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_13TextArea - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_13TextArea + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_13TextArea/src/main/webapp/demo.xhtml b/JavaServerFaces_13TextArea/src/main/webapp/demo.xhtml index e29ec9f..68df770 100644 --- a/JavaServerFaces_13TextArea/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_13TextArea/src/main/webapp/demo.xhtml @@ -1,21 +1,21 @@ - - - - - -

JSF 2 textarea example

- - - - - - - -
Address :
- -
- -
+ + + + + +

JSF 2 textarea example

+ + + + + + + +
Address :
+ +
+ +
\ No newline at end of file diff --git a/JavaServerFaces_13TextArea/src/main/webapp/user.xhtml b/JavaServerFaces_13TextArea/src/main/webapp/user.xhtml index b4b3353..70bd8cf 100644 --- a/JavaServerFaces_13TextArea/src/main/webapp/user.xhtml +++ b/JavaServerFaces_13TextArea/src/main/webapp/user.xhtml @@ -1,13 +1,13 @@ - - - - - -

JSF 2 textarea example

- - Address : - -
+ + + + + +

JSF 2 textarea example

+ + Address : + +
\ No newline at end of file diff --git a/JavaServerFaces_14HiddenValue/pom.xml b/JavaServerFaces_14HiddenValue/pom.xml index 48f9d2b..5947e8d 100644 --- a/JavaServerFaces_14HiddenValue/pom.xml +++ b/JavaServerFaces_14HiddenValue/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_14HiddenValue - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_14HiddenValue +war + \ No newline at end of file diff --git a/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java index e23b16b..a4130a0 100644 --- a/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java @@ -1,22 +1,22 @@ -package com.xxy.form; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import java.io.Serializable; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable { - - String answer = "I'm Hidden value!"; - - public String getAnswer() { - return answer; - } - - public void setAnswer(String answer) { - this.answer = answer; - } - - +package com.xxy.form; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import java.io.Serializable; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable { + + String answer = "I'm Hidden value!"; + + public String getAnswer() { + return answer; + } + + public void setAnswer(String answer) { + this.answer = answer; + } + + } \ No newline at end of file diff --git a/JavaServerFaces_14HiddenValue/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_14HiddenValue/src/main/webapp/WEB-INF/web.xml index 86b2a43..991905d 100644 --- a/JavaServerFaces_14HiddenValue/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_14HiddenValue/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_14HiddenValue - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_14HiddenValue + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml b/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml index f302cca..507727a 100644 --- a/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml @@ -1,27 +1,27 @@ - - - - - - - - -

JSF 2 hidden value example

- - - - - - -
+ + + + + + + + +

JSF 2 hidden value example

+ + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_15Checkboxes/pom.xml b/JavaServerFaces_15Checkboxes/pom.xml index 79a36a9..d14833b 100644 --- a/JavaServerFaces_15Checkboxes/pom.xml +++ b/JavaServerFaces_15Checkboxes/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_15Checkboxes - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_15Checkboxes +war + \ No newline at end of file diff --git a/JavaServerFaces_15Checkboxes/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_15Checkboxes/src/main/java/com/xxy/UserBean.java index 3d9e920..687741e 100644 --- a/JavaServerFaces_15Checkboxes/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_15Checkboxes/src/main/java/com/xxy/UserBean.java @@ -1,140 +1,140 @@ -package com.xxy; - -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public boolean rememberMe; - - public boolean isRememberMe() { - return rememberMe; - } - - public void setRememberMe(boolean rememberMe) { - this.rememberMe = rememberMe; - } - - public String[] favNumber1; - public String[] favNumber2; - public String[] favNumber3; - public String[] favNumber4; - - public String[] getFavNumber1() { - return favNumber1; - } - - public void setFavNumber1(String[] favNumber1) { - this.favNumber1 = favNumber1; - } - - public String[] getFavNumber2() { - return favNumber2; - } - - public void setFavNumber2(String[] favNumber2) { - this.favNumber2 = favNumber2; - } - - public String[] getFavNumber3() { - return favNumber3; - } - - public void setFavNumber3(String[] favNumber3) { - this.favNumber3 = favNumber3; - } - - public String[] getFavNumber4() { - return favNumber4; - } - - public void setFavNumber4(String[] favNumber4) { - this.favNumber4 = favNumber4; - } - - public String getFavNumber1InString() { - return Arrays.toString(favNumber1); - } - - //Generated by Array - public String[] getFavNumber2Value() { - - favNumber2 = new String[5]; - favNumber2[0] = "Number2 - 1"; - favNumber2[1] = "Number2 - 2"; - favNumber2[2] = "Number2 - 3"; - favNumber2[3] = "Number2 - 4"; - favNumber2[4] = "Number2 - 5"; - - return favNumber2; - } - - public String getFavNumber2InString() { - return Arrays.toString(favNumber2); - } - - - //Generated by Map - private static Map number3Value; - static{ - number3Value = new LinkedHashMap(); - number3Value.put("Number3 - 1", "1"); //label, value - number3Value.put("Number3 - 2", "2"); - number3Value.put("Number3 - 3", "3"); - number3Value.put("Number3 - 4", "4"); - number3Value.put("Number3 - 5", "5"); - } - - public Map getFavNumber3Value() { - return number3Value; - } - - public String getFavNumber3InString() { - return Arrays.toString(favNumber3); - } - - //Generated by Object array - public static class Number{ - public String numberLabel; - public String numberValue; - - public Number(String numberLabel, String numberValue){ - this.numberLabel = numberLabel; - this.numberValue = numberValue; - } - - public String getNumberLabel(){ - return numberLabel; - } - - public String getNumberValue(){ - return numberValue; - } - - } - - public Number[] number4List; - - public Number[] getFavNumber4Value() { - - number4List = new Number[5]; - number4List[0] = new Number("Number4 - 1", "1"); - number4List[1] = new Number("Number4 - 2", "2"); - number4List[2] = new Number("Number4 - 3", "3"); - number4List[3] = new Number("Number4 - 4", "4"); - number4List[4] = new Number("Number4 - 5", "5"); - - return number4List; - } - - public String getFavNumber4InString() { - return Arrays.toString(favNumber4); - } - +package com.xxy; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public boolean rememberMe; + + public boolean isRememberMe() { + return rememberMe; + } + + public void setRememberMe(boolean rememberMe) { + this.rememberMe = rememberMe; + } + + public String[] favNumber1; + public String[] favNumber2; + public String[] favNumber3; + public String[] favNumber4; + + public String[] getFavNumber1() { + return favNumber1; + } + + public void setFavNumber1(String[] favNumber1) { + this.favNumber1 = favNumber1; + } + + public String[] getFavNumber2() { + return favNumber2; + } + + public void setFavNumber2(String[] favNumber2) { + this.favNumber2 = favNumber2; + } + + public String[] getFavNumber3() { + return favNumber3; + } + + public void setFavNumber3(String[] favNumber3) { + this.favNumber3 = favNumber3; + } + + public String[] getFavNumber4() { + return favNumber4; + } + + public void setFavNumber4(String[] favNumber4) { + this.favNumber4 = favNumber4; + } + + public String getFavNumber1InString() { + return Arrays.toString(favNumber1); + } + + //Generated by Array + public String[] getFavNumber2Value() { + + favNumber2 = new String[5]; + favNumber2[0] = "Number2 - 1"; + favNumber2[1] = "Number2 - 2"; + favNumber2[2] = "Number2 - 3"; + favNumber2[3] = "Number2 - 4"; + favNumber2[4] = "Number2 - 5"; + + return favNumber2; + } + + public String getFavNumber2InString() { + return Arrays.toString(favNumber2); + } + + + //Generated by Map + private static Map number3Value; + static{ + number3Value = new LinkedHashMap(); + number3Value.put("Number3 - 1", "1"); //label, value + number3Value.put("Number3 - 2", "2"); + number3Value.put("Number3 - 3", "3"); + number3Value.put("Number3 - 4", "4"); + number3Value.put("Number3 - 5", "5"); + } + + public Map getFavNumber3Value() { + return number3Value; + } + + public String getFavNumber3InString() { + return Arrays.toString(favNumber3); + } + + //Generated by Object array + public static class Number{ + public String numberLabel; + public String numberValue; + + public Number(String numberLabel, String numberValue){ + this.numberLabel = numberLabel; + this.numberValue = numberValue; + } + + public String getNumberLabel(){ + return numberLabel; + } + + public String getNumberValue(){ + return numberValue; + } + + } + + public Number[] number4List; + + public Number[] getFavNumber4Value() { + + number4List = new Number[5]; + number4List[0] = new Number("Number4 - 1", "1"); + number4List[1] = new Number("Number4 - 2", "2"); + number4List[2] = new Number("Number4 - 3", "3"); + number4List[3] = new Number("Number4 - 4", "4"); + number4List[4] = new Number("Number4 - 5", "5"); + + return number4List; + } + + public String getFavNumber4InString() { + return Arrays.toString(favNumber4); + } + } \ No newline at end of file diff --git a/JavaServerFaces_15Checkboxes/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_15Checkboxes/src/main/webapp/WEB-INF/web.xml index ea521fc..5f4c598 100644 --- a/JavaServerFaces_15Checkboxes/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_15Checkboxes/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_15Checkboxes - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_15Checkboxes + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_15Checkboxes/src/main/webapp/demo.xhtml b/JavaServerFaces_15Checkboxes/src/main/webapp/demo.xhtml index 4e10d52..f386668 100644 --- a/JavaServerFaces_15Checkboxes/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_15Checkboxes/src/main/webapp/demo.xhtml @@ -1,58 +1,58 @@ - - - - - -

JSF 2 checkboxes example

- - -

1. Single checkbox

- Remember Me - -

2. Mutiple checkboxes

- - 1. Hard-coded with "f:selectItem" : - - - - - - - - -
- - 2. Generated by Array : - - - - -
- - 3. Generated by Map : - - - - -
- - 4. Generated by Object with var : - - - - -
- - - - -
- -
- + + + + + +

JSF 2 checkboxes example

+ + +

1. Single checkbox

+ Remember Me + +

2. Mutiple checkboxes

+ + 1. Hard-coded with "f:selectItem" : + + + + + + + + +
+ + 2. Generated by Array : + + + + +
+ + 3. Generated by Map : + + + + +
+ + 4. Generated by Object with var : + + + + +
+ + + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_15Checkboxes/src/main/webapp/result.xhtml b/JavaServerFaces_15Checkboxes/src/main/webapp/result.xhtml index 826a67c..b509b80 100644 --- a/JavaServerFaces_15Checkboxes/src/main/webapp/result.xhtml +++ b/JavaServerFaces_15Checkboxes/src/main/webapp/result.xhtml @@ -1,23 +1,23 @@ - - - - - - -

JSF 2 checkboxes example

- -

result.xhtml

- -
    -
  1. user.rememberMe : #{user.rememberMe}
  2. -
  3. user.favNumber1 : #{user.favNumber1InString}
  4. -
  5. user.favNumber2 : #{user.favNumber2InString}
  6. -
  7. user.favNumber3 : #{user.favNumber3InString}
  8. -
  9. user.favNumber4 : #{user.favNumber4InString}
  10. -
-
- + + + + + + +

JSF 2 checkboxes example

+ +

result.xhtml

+ +
    +
  1. user.rememberMe : #{user.rememberMe}
  2. +
  3. user.favNumber1 : #{user.favNumber1InString}
  4. +
  5. user.favNumber2 : #{user.favNumber2InString}
  6. +
  7. user.favNumber3 : #{user.favNumber3InString}
  8. +
  9. user.favNumber4 : #{user.favNumber4InString}
  10. +
+
+ \ No newline at end of file diff --git a/JavaServerFaces_16RadioButtons/pom.xml b/JavaServerFaces_16RadioButtons/pom.xml index 2c216a5..e1d7f92 100644 --- a/JavaServerFaces_16RadioButtons/pom.xml +++ b/JavaServerFaces_16RadioButtons/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_16RadioButtons - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_16RadioButtons + + \ No newline at end of file diff --git a/JavaServerFaces_16RadioButtons/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_16RadioButtons/src/main/java/com/xxy/UserBean.java index ee65c87..3edadd8 100644 --- a/JavaServerFaces_16RadioButtons/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_16RadioButtons/src/main/java/com/xxy/UserBean.java @@ -1,86 +1,86 @@ -package com.xxy; - -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String favColor1; - public String favColor2; - public String favColor3; - - public String getFavColor1() { - return favColor1; - } - - public void setFavColor1(String favColor1) { - this.favColor1 = favColor1; - } - - public String getFavColor2() { - return favColor2; - } - - public void setFavColor2(String favColor2) { - this.favColor2 = favColor2; - } - - public String getFavColor3() { - return favColor3; - } - - public void setFavColor3(String favColor3) { - this.favColor3 = favColor3; - } - - //Generated by Map - private static Map color2Value; - static{ - color2Value = new LinkedHashMap(); - color2Value.put("Color2 - Red", "Red"); //label, value - color2Value.put("Color2 - Green", "Green"); - color2Value.put("Color3 - Blue", "Blue"); - } - - public Map getFavColor2Value() { - return color2Value; - } - - //Generated by Object array - public static class Color{ - public String colorLabel; - public String colorValue; - - public Color(String colorLabel, String colorValue){ - this.colorLabel = colorLabel; - this.colorValue = colorValue; - } - - public String getColorLabel(){ - return colorLabel; - } - - public String getColorValue(){ - return colorValue; - } - - } - - public Color[] color3List; - - public Color[] getFavColor3Value() { - - color3List = new Color[3]; - color3List[0] = new Color("Color3 - Red", "Red"); - color3List[1] = new Color("Color3 - Green", "Green"); - color3List[2] = new Color("Color3 - Blue", "Blue"); - - return color3List; - } - +package com.xxy; + +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String favColor1; + public String favColor2; + public String favColor3; + + public String getFavColor1() { + return favColor1; + } + + public void setFavColor1(String favColor1) { + this.favColor1 = favColor1; + } + + public String getFavColor2() { + return favColor2; + } + + public void setFavColor2(String favColor2) { + this.favColor2 = favColor2; + } + + public String getFavColor3() { + return favColor3; + } + + public void setFavColor3(String favColor3) { + this.favColor3 = favColor3; + } + + //Generated by Map + private static Map color2Value; + static{ + color2Value = new LinkedHashMap(); + color2Value.put("Color2 - Red", "Red"); //label, value + color2Value.put("Color2 - Green", "Green"); + color2Value.put("Color3 - Blue", "Blue"); + } + + public Map getFavColor2Value() { + return color2Value; + } + + //Generated by Object array + public static class Color{ + public String colorLabel; + public String colorValue; + + public Color(String colorLabel, String colorValue){ + this.colorLabel = colorLabel; + this.colorValue = colorValue; + } + + public String getColorLabel(){ + return colorLabel; + } + + public String getColorValue(){ + return colorValue; + } + + } + + public Color[] color3List; + + public Color[] getFavColor3Value() { + + color3List = new Color[3]; + color3List[0] = new Color("Color3 - Red", "Red"); + color3List[1] = new Color("Color3 - Green", "Green"); + color3List[2] = new Color("Color3 - Blue", "Blue"); + + return color3List; + } + } \ No newline at end of file diff --git a/JavaServerFaces_16RadioButtons/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_16RadioButtons/src/main/webapp/WEB-INF/web.xml index 5e42826..6126df3 100644 --- a/JavaServerFaces_16RadioButtons/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_16RadioButtons/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_16RadioButtons - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_16RadioButtons + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_16RadioButtons/src/main/webapp/demo.xhtml b/JavaServerFaces_16RadioButtons/src/main/webapp/demo.xhtml index 190c211..30c0784 100644 --- a/JavaServerFaces_16RadioButtons/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_16RadioButtons/src/main/webapp/demo.xhtml @@ -1,44 +1,44 @@ - - - - - -

JSF 2 radio button example

- - - 1. Hard-coded with "f:selectItem" : - - - - - - -
- - 2. Generated by Map : - - - - -
- - 3. Generated by Object array and iterate with var : - - - - -
- - - - -
- -
- + + + + + +

JSF 2 radio button example

+ + + 1. Hard-coded with "f:selectItem" : + + + + + + +
+ + 2. Generated by Map : + + + + +
+ + 3. Generated by Object array and iterate with var : + + + + +
+ + + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_16RadioButtons/src/main/webapp/result.xhtml b/JavaServerFaces_16RadioButtons/src/main/webapp/result.xhtml index 41c6121..104c32a 100644 --- a/JavaServerFaces_16RadioButtons/src/main/webapp/result.xhtml +++ b/JavaServerFaces_16RadioButtons/src/main/webapp/result.xhtml @@ -1,21 +1,21 @@ - - - - - - -

JSF 2 radio button example

- -

result.xhtml

- -
    -
  1. user.favColor1 : #{user.favColor1}
  2. -
  3. user.favColor2 : #{user.favColor2}
  4. -
  5. user.favColor3 : #{user.favColor3}
  6. -
-
- + + + + + + +

JSF 2 radio button example

+ +

result.xhtml

+ +
    +
  1. user.favColor1 : #{user.favColor1}
  2. +
  3. user.favColor2 : #{user.favColor2}
  4. +
  5. user.favColor3 : #{user.favColor3}
  6. +
+
+ \ No newline at end of file diff --git a/JavaServerFaces_17Listbox/pom.xml b/JavaServerFaces_17Listbox/pom.xml index 5f5feb0..90a15fa 100644 --- a/JavaServerFaces_17Listbox/pom.xml +++ b/JavaServerFaces_17Listbox/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_17Listbox - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_17Listbox + + \ No newline at end of file diff --git a/JavaServerFaces_17Listbox/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_17Listbox/src/main/java/com/xxy/UserBean.java index e2a3426..ad4442e 100644 --- a/JavaServerFaces_17Listbox/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_17Listbox/src/main/java/com/xxy/UserBean.java @@ -1,86 +1,86 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - public String favYear1; - public String favYear2; - public String favYear3; - - public String getFavYear1() { - return favYear1; - } - - public void setFavYear1(String favYear1) { - this.favYear1 = favYear1; - } - - public String getFavYear2() { - return favYear2; - } - - public void setFavYear2(String favYear2) { - this.favYear2 = favYear2; - } - - public String getFavYear3() { - return favYear3; - } - - public void setFavYear3(String favYear3) { - this.favYear3 = favYear3; - } - - //Generated by Map - private static Map year2Value; - static{ - year2Value = new LinkedHashMap(); - year2Value.put("Year2 - 2000", "2000"); //label, value - year2Value.put("Year2 - 2010", "2010"); - year2Value.put("Year2 - 2020", "2020"); - } - - public Map getFavYear2Value() { - return year2Value; - } - - //Generated by Object array - public static class Year{ - public String yearLabel; - public String yearValue; - - public Year(String yearLabel, String yearValue){ - this.yearLabel = yearLabel; - this.yearValue = yearValue; - } - - public String getYearLabel(){ - return yearLabel; - } - - public String getYearValue(){ - return yearValue; - } - - } - - public Year[] year3List; - - public Year[] getFavYear3Value() { - - year3List = new Year[3]; - year3List[0] = new Year("Year3 - 2000", "2000"); - year3List[1] = new Year("Year3 - 2010", "2010"); - year3List[2] = new Year("Year3 - 2020", "2020"); - - return year3List; - } - +package com.xxy; + +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + public String favYear1; + public String favYear2; + public String favYear3; + + public String getFavYear1() { + return favYear1; + } + + public void setFavYear1(String favYear1) { + this.favYear1 = favYear1; + } + + public String getFavYear2() { + return favYear2; + } + + public void setFavYear2(String favYear2) { + this.favYear2 = favYear2; + } + + public String getFavYear3() { + return favYear3; + } + + public void setFavYear3(String favYear3) { + this.favYear3 = favYear3; + } + + //Generated by Map + private static Map year2Value; + static{ + year2Value = new LinkedHashMap(); + year2Value.put("Year2 - 2000", "2000"); //label, value + year2Value.put("Year2 - 2010", "2010"); + year2Value.put("Year2 - 2020", "2020"); + } + + public Map getFavYear2Value() { + return year2Value; + } + + //Generated by Object array + public static class Year{ + public String yearLabel; + public String yearValue; + + public Year(String yearLabel, String yearValue){ + this.yearLabel = yearLabel; + this.yearValue = yearValue; + } + + public String getYearLabel(){ + return yearLabel; + } + + public String getYearValue(){ + return yearValue; + } + + } + + public Year[] year3List; + + public Year[] getFavYear3Value() { + + year3List = new Year[3]; + year3List[0] = new Year("Year3 - 2000", "2000"); + year3List[1] = new Year("Year3 - 2010", "2010"); + year3List[2] = new Year("Year3 - 2020", "2020"); + + return year3List; + } + } \ No newline at end of file diff --git a/JavaServerFaces_17Listbox/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_17Listbox/src/main/webapp/WEB-INF/web.xml index a0599b9..2fddac3 100644 --- a/JavaServerFaces_17Listbox/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_17Listbox/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_17Listbox - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_17Listbox + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_17Listbox/src/main/webapp/demo.xhtml b/JavaServerFaces_17Listbox/src/main/webapp/demo.xhtml index 9cf2231..649c901 100644 --- a/JavaServerFaces_17Listbox/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_17Listbox/src/main/webapp/demo.xhtml @@ -1,44 +1,44 @@ - - - - - -

JSF 2 listbox example

- - - 1. Hard-coded with "f:selectItem" : - - - - - - -
- - 2. Generated by Map : - - - - -
- - 3. Generated by Object array and iterate with var : - - - - -
- - - - -
- -
- + + + + + +

JSF 2 listbox example

+ + + 1. Hard-coded with "f:selectItem" : + + + + + + +
+ + 2. Generated by Map : + + + + +
+ + 3. Generated by Object array and iterate with var : + + + + +
+ + + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_17Listbox/src/main/webapp/result.xhtml b/JavaServerFaces_17Listbox/src/main/webapp/result.xhtml index 438cad7..02273ea 100644 --- a/JavaServerFaces_17Listbox/src/main/webapp/result.xhtml +++ b/JavaServerFaces_17Listbox/src/main/webapp/result.xhtml @@ -1,21 +1,21 @@ - - - - - - -

JSF 2 listbox example

- -

result.xhtml

- -
    -
  1. user.favYear1 : #{user.favYear1}
  2. -
  3. user.favYear2 : #{user.favYear2}
  4. -
  5. user.favYear3 : #{user.favYear3}
  6. -
-
- + + + + + + +

JSF 2 listbox example

+ +

result.xhtml

+ +
    +
  1. user.favYear1 : #{user.favYear1}
  2. +
  3. user.favYear2 : #{user.favYear2}
  4. +
  5. user.favYear3 : #{user.favYear3}
  6. +
+
+ \ No newline at end of file diff --git a/JavaServerFaces_18MultiSelectListbox/pom.xml b/JavaServerFaces_18MultiSelectListbox/pom.xml index e2d4544..8396b85 100644 --- a/JavaServerFaces_18MultiSelectListbox/pom.xml +++ b/JavaServerFaces_18MultiSelectListbox/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_18MultiSelectListbox - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_18MultiSelectListbox + + \ No newline at end of file diff --git a/JavaServerFaces_18MultiSelectListbox/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_18MultiSelectListbox/src/main/java/com/xxy/UserBean.java index c154c43..c4e9421 100644 --- a/JavaServerFaces_18MultiSelectListbox/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_18MultiSelectListbox/src/main/java/com/xxy/UserBean.java @@ -1,99 +1,99 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - public String[] favFood1 = {"Fry Checken", "Tomyam Soup"}; - public String[] favFood2; - public String[] favFood3; - - public String[] getFavFood1() { - return favFood1; - } - - public void setFavFood1(String[] favFood1) { - this.favFood1 = favFood1; - } - - public String[] getFavFood2() { - return favFood2; - } - - public void setFavFood2(String[] favFood2) { - this.favFood2 = favFood2; - } - - public String[] getFavFood3() { - return favFood3; - } - - public void setFavFood3(String[] favFood3) { - this.favFood3 = favFood3; - } - - public String getFavFood1InString() { - return Arrays.toString(favFood1); - } - - public String getFavFood2InString() { - return Arrays.toString(favFood2); - } - - public String getFavFood3InString() { - return Arrays.toString(favFood3); - } - - //Generated by Map - private static Map food2Value; - static{ - food2Value = new LinkedHashMap(); - food2Value.put("Food2 - Fry Checken", "Fry Checken"); //label, value - food2Value.put("Food2 - Tomyam Soup", "Tomyam Soup"); - food2Value.put("Food2 - Mixed Rice", "Mixed Rice"); - } - - public Map getFavFood2Value() { - return food2Value; - } - - //Generated by Object array - public static class Food{ - public String foodLabel; - public String foodValue; - - public Food(String foodLabel, String foodValue){ - this.foodLabel = foodLabel; - this.foodValue = foodValue; - } - - public String getFoodLabel(){ - return foodLabel; - } - - public String getFoodValue(){ - return foodValue; - } - - } - - public Food[] food3List; - - public Food[] getFavFood3Value() { - - food3List = new Food[3]; - food3List[0] = new Food("Food3 - Fry Checken", "Fry Checken"); - food3List[1] = new Food("Food3 - Tomyam Soup", "Tomyam Soup"); - food3List[2] = new Food("Food3 - Mixed Rice", "Mixed Rice"); - - return food3List; - } - +package com.xxy; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + public String[] favFood1 = {"Fry Checken", "Tomyam Soup"}; + public String[] favFood2; + public String[] favFood3; + + public String[] getFavFood1() { + return favFood1; + } + + public void setFavFood1(String[] favFood1) { + this.favFood1 = favFood1; + } + + public String[] getFavFood2() { + return favFood2; + } + + public void setFavFood2(String[] favFood2) { + this.favFood2 = favFood2; + } + + public String[] getFavFood3() { + return favFood3; + } + + public void setFavFood3(String[] favFood3) { + this.favFood3 = favFood3; + } + + public String getFavFood1InString() { + return Arrays.toString(favFood1); + } + + public String getFavFood2InString() { + return Arrays.toString(favFood2); + } + + public String getFavFood3InString() { + return Arrays.toString(favFood3); + } + + //Generated by Map + private static Map food2Value; + static{ + food2Value = new LinkedHashMap(); + food2Value.put("Food2 - Fry Checken", "Fry Checken"); //label, value + food2Value.put("Food2 - Tomyam Soup", "Tomyam Soup"); + food2Value.put("Food2 - Mixed Rice", "Mixed Rice"); + } + + public Map getFavFood2Value() { + return food2Value; + } + + //Generated by Object array + public static class Food{ + public String foodLabel; + public String foodValue; + + public Food(String foodLabel, String foodValue){ + this.foodLabel = foodLabel; + this.foodValue = foodValue; + } + + public String getFoodLabel(){ + return foodLabel; + } + + public String getFoodValue(){ + return foodValue; + } + + } + + public Food[] food3List; + + public Food[] getFavFood3Value() { + + food3List = new Food[3]; + food3List[0] = new Food("Food3 - Fry Checken", "Fry Checken"); + food3List[1] = new Food("Food3 - Tomyam Soup", "Tomyam Soup"); + food3List[2] = new Food("Food3 - Mixed Rice", "Mixed Rice"); + + return food3List; + } + } \ No newline at end of file diff --git a/JavaServerFaces_18MultiSelectListbox/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_18MultiSelectListbox/src/main/webapp/WEB-INF/web.xml index 2fa7f33..9ccb40b 100644 --- a/JavaServerFaces_18MultiSelectListbox/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_18MultiSelectListbox/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_18MultiSelectListbox - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_18MultiSelectListbox + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_18MultiSelectListbox/src/main/webapp/demo.xhtml b/JavaServerFaces_18MultiSelectListbox/src/main/webapp/demo.xhtml index aaa5008..1501a72 100644 --- a/JavaServerFaces_18MultiSelectListbox/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_18MultiSelectListbox/src/main/webapp/demo.xhtml @@ -1,44 +1,44 @@ - - - - - -

JSF 2 multi-select listbox example

- - - 1. Hard-coded with "f:selectItem" : - - - - - - -

- - 2. Generated by Map : - - - - -

- - 3. Generated by Object array and iterate with var : - - - - -

- - - - -
- -
- + + + + + +

JSF 2 multi-select listbox example

+ + + 1. Hard-coded with "f:selectItem" : + + + + + + +

+ + 2. Generated by Map : + + + + +

+ + 3. Generated by Object array and iterate with var : + + + + +

+ + + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_18MultiSelectListbox/src/main/webapp/result.xhtml b/JavaServerFaces_18MultiSelectListbox/src/main/webapp/result.xhtml index f56eafa..ac421c8 100644 --- a/JavaServerFaces_18MultiSelectListbox/src/main/webapp/result.xhtml +++ b/JavaServerFaces_18MultiSelectListbox/src/main/webapp/result.xhtml @@ -1,21 +1,21 @@ - - - - - - -

JSF 2 multi-select listbox example

- -

result.xhtml

- -
    -
  1. user.favFood1 : #{user.favFood1InString}
  2. -
  3. user.favFood2 : #{user.favFood2InString}
  4. -
  5. user.favFood3 : #{user.favFood3InString}
  6. -
-
- + + + + + + +

JSF 2 multi-select listbox example

+ +

result.xhtml

+ +
    +
  1. user.favFood1 : #{user.favFood1InString}
  2. +
  3. user.favFood2 : #{user.favFood2InString}
  4. +
  5. user.favFood3 : #{user.favFood3InString}
  6. +
+
+ \ No newline at end of file diff --git a/JavaServerFaces_19DropdownBox/pom.xml b/JavaServerFaces_19DropdownBox/pom.xml index 3686b0e..932e371 100644 --- a/JavaServerFaces_19DropdownBox/pom.xml +++ b/JavaServerFaces_19DropdownBox/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_19DropdownBox - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_19DropdownBox + + \ No newline at end of file diff --git a/JavaServerFaces_19DropdownBox/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_19DropdownBox/src/main/java/com/xxy/UserBean.java index 8ab8a6f..ac000ca 100644 --- a/JavaServerFaces_19DropdownBox/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_19DropdownBox/src/main/java/com/xxy/UserBean.java @@ -1,87 +1,87 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - public String favCoffee1 = "Extreme Mocha"; - public String favCoffee2; - public String favCoffee3; - - public String getFavCoffee1() { - return favCoffee1; - } - - public void setFavCoffee1(String favCoffee1) { - this.favCoffee1 = favCoffee1; - } - - public String getFavCoffee2() { - return favCoffee2; - } - - public void setFavCoffee2(String favCoffee2) { - this.favCoffee2 = favCoffee2; - } - - public String getFavCoffee3() { - return favCoffee3; - } - - public void setFavCoffee3(String favCoffee3) { - this.favCoffee3 = favCoffee3; - } - - //Generated by Map - private static Map coffee2Value; - static{ - coffee2Value = new LinkedHashMap(); - coffee2Value.put("Coffee2 - Cream Latte", "Cream Latte"); //label, value - coffee2Value.put("Coffee2 - Extreme Mocha", "Extreme Mocha"); - coffee2Value.put("Coffee2 - Buena Vista", "Buena Vista"); - } - - public Map getFavCoffee2Value() { - return coffee2Value; - } - - //Generated by Object array - public static class Coffee{ - public String coffeeLabel; - public String coffeeValue; - - public Coffee(String coffeeLabel, String coffeeValue){ - this.coffeeLabel = coffeeLabel; - this.coffeeValue = coffeeValue; - } - - public String getCoffeeLabel(){ - return coffeeLabel; - } - - public String getCoffeeValue(){ - return coffeeValue; - } - - } - - public Coffee[] coffee3List; - - public Coffee[] getFavCoffee3Value() { - - coffee3List = new Coffee[3]; - coffee3List[0] = new Coffee("Coffee3 - Cream Latte", "Cream Latte"); - coffee3List[1] = new Coffee("Coffee3 - Extreme Mocha", "Extreme Mocha"); - coffee3List[2] = new Coffee("Coffee3 - Buena Vista", "Buena Vista"); - - return coffee3List; - - } - +package com.xxy; + +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + public String favCoffee1 = "Extreme Mocha"; + public String favCoffee2; + public String favCoffee3; + + public String getFavCoffee1() { + return favCoffee1; + } + + public void setFavCoffee1(String favCoffee1) { + this.favCoffee1 = favCoffee1; + } + + public String getFavCoffee2() { + return favCoffee2; + } + + public void setFavCoffee2(String favCoffee2) { + this.favCoffee2 = favCoffee2; + } + + public String getFavCoffee3() { + return favCoffee3; + } + + public void setFavCoffee3(String favCoffee3) { + this.favCoffee3 = favCoffee3; + } + + //Generated by Map + private static Map coffee2Value; + static{ + coffee2Value = new LinkedHashMap(); + coffee2Value.put("Coffee2 - Cream Latte", "Cream Latte"); //label, value + coffee2Value.put("Coffee2 - Extreme Mocha", "Extreme Mocha"); + coffee2Value.put("Coffee2 - Buena Vista", "Buena Vista"); + } + + public Map getFavCoffee2Value() { + return coffee2Value; + } + + //Generated by Object array + public static class Coffee{ + public String coffeeLabel; + public String coffeeValue; + + public Coffee(String coffeeLabel, String coffeeValue){ + this.coffeeLabel = coffeeLabel; + this.coffeeValue = coffeeValue; + } + + public String getCoffeeLabel(){ + return coffeeLabel; + } + + public String getCoffeeValue(){ + return coffeeValue; + } + + } + + public Coffee[] coffee3List; + + public Coffee[] getFavCoffee3Value() { + + coffee3List = new Coffee[3]; + coffee3List[0] = new Coffee("Coffee3 - Cream Latte", "Cream Latte"); + coffee3List[1] = new Coffee("Coffee3 - Extreme Mocha", "Extreme Mocha"); + coffee3List[2] = new Coffee("Coffee3 - Buena Vista", "Buena Vista"); + + return coffee3List; + + } + } \ No newline at end of file diff --git a/JavaServerFaces_19DropdownBox/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_19DropdownBox/src/main/webapp/WEB-INF/web.xml index e7cee61..85a112e 100644 --- a/JavaServerFaces_19DropdownBox/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_19DropdownBox/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_19DropdownBox - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_19DropdownBox + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_19DropdownBox/src/main/webapp/demo.xhtml b/JavaServerFaces_19DropdownBox/src/main/webapp/demo.xhtml index 6508b63..7d95744 100644 --- a/JavaServerFaces_19DropdownBox/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_19DropdownBox/src/main/webapp/demo.xhtml @@ -1,44 +1,44 @@ - - - - - -

JSF 2 dropdown box example

- - - 1. Hard-coded with "f:selectItem" : - - - - - - -

- - 2. Generated by Map : - - - - -

- - 3. Generated by Object array and iterate with var : - - - - -

- - - - -
- -
- + + + + + +

JSF 2 dropdown box example

+ + + 1. Hard-coded with "f:selectItem" : + + + + + + +

+ + 2. Generated by Map : + + + + +

+ + 3. Generated by Object array and iterate with var : + + + + +

+ + + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_19DropdownBox/src/main/webapp/result.xhtml b/JavaServerFaces_19DropdownBox/src/main/webapp/result.xhtml index e549e7d..fa86019 100644 --- a/JavaServerFaces_19DropdownBox/src/main/webapp/result.xhtml +++ b/JavaServerFaces_19DropdownBox/src/main/webapp/result.xhtml @@ -1,21 +1,21 @@ - - - - - - -

JSF 2 dropdown box example

- -

result.xhtml

- -
    -
  1. user.favCoffee1 : #{user.favCoffee1}
  2. -
  3. user.favCoffee2 : #{user.favCoffee2}
  4. -
  5. user.favCoffee3 : #{user.favCoffee3}
  6. -
-
- + + + + + + +

JSF 2 dropdown box example

+ +

result.xhtml

+ +
    +
  1. user.favCoffee1 : #{user.favCoffee1}
  2. +
  3. user.favCoffee2 : #{user.favCoffee2}
  4. +
  5. user.favCoffee3 : #{user.favCoffee3}
  6. +
+
+ \ No newline at end of file diff --git a/JavaServerFaces_20MultipleSelectDropdownBox/pom.xml b/JavaServerFaces_20MultipleSelectDropdownBox/pom.xml index 632363a..8677f5e 100644 --- a/JavaServerFaces_20MultipleSelectDropdownBox/pom.xml +++ b/JavaServerFaces_20MultipleSelectDropdownBox/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_20MultipleSelectDropdownBox - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_20MultipleSelectDropdownBox + + \ No newline at end of file diff --git a/JavaServerFaces_21OutputText/pom.xml b/JavaServerFaces_21OutputText/pom.xml index fff654b..a653103 100644 --- a/JavaServerFaces_21OutputText/pom.xml +++ b/JavaServerFaces_21OutputText/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_21OutputText - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_21OutputText + + \ No newline at end of file diff --git a/JavaServerFaces_21OutputText/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_21OutputText/src/main/java/com/xxy/form/UserBean.java index d459464..9e4531a 100644 --- a/JavaServerFaces_21OutputText/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_21OutputText/src/main/java/com/xxy/form/UserBean.java @@ -1,26 +1,26 @@ -package com.xxy.form; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String text = "This is Text!"; - public String htmlInput = ""; - - public String getText() { - return text; - } - public void setText(String text) { - this.text = text; - } - public String getHtmlInput() { - return htmlInput; - } - public void setHtmlInput(String htmlInput) { - this.htmlInput = htmlInput; - } - +package com.xxy.form; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String text = "This is Text!"; + public String htmlInput = ""; + + public String getText() { + return text; + } + public void setText(String text) { + this.text = text; + } + public String getHtmlInput() { + return htmlInput; + } + public void setHtmlInput(String htmlInput) { + this.htmlInput = htmlInput; + } + } \ No newline at end of file diff --git a/JavaServerFaces_21OutputText/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_21OutputText/src/main/webapp/WEB-INF/web.xml index 759993b..4c4574a 100644 --- a/JavaServerFaces_21OutputText/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_21OutputText/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_21OutputText - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_21OutputText + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_21OutputText/src/main/webapp/demo.xhtml b/JavaServerFaces_21OutputText/src/main/webapp/demo.xhtml index bbbd57e..8daf864 100644 --- a/JavaServerFaces_21OutputText/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_21OutputText/src/main/webapp/demo.xhtml @@ -1,21 +1,21 @@ - - - - - -

JSF 2.0 h:outputText Example

-
    -
  1. #{user.text}
  2. - -
  3. - -
  4. - -
  5. - -
  6. -
-
+ + + + + +

JSF 2.0 h:outputText Example

+
    +
  1. #{user.text}
  2. + +
  3. + +
  4. + +
  5. + +
  6. +
+
\ No newline at end of file diff --git a/JavaServerFaces_22OutputFormat/pom.xml b/JavaServerFaces_22OutputFormat/pom.xml index e268040..f1fa4d7 100644 --- a/JavaServerFaces_22OutputFormat/pom.xml +++ b/JavaServerFaces_22OutputFormat/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_22OutputFormat - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_22OutputFormat + + \ No newline at end of file diff --git a/JavaServerFaces_22OutputFormat/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_22OutputFormat/src/main/java/com/xxy/form/UserBean.java index 6a11526..596b9ed 100644 --- a/JavaServerFaces_22OutputFormat/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_22OutputFormat/src/main/java/com/xxy/form/UserBean.java @@ -1,26 +1,26 @@ -package com.xxy.form; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String text = "Hello {0}"; - public String htmlInput = ""; - - public String getText() { - return text; - } - public void setText(String text) { - this.text = text; - } - public String getHtmlInput() { - return htmlInput; - } - public void setHtmlInput(String htmlInput) { - this.htmlInput = htmlInput; - } - +package com.xxy.form; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String text = "Hello {0}"; + public String htmlInput = ""; + + public String getText() { + return text; + } + public void setText(String text) { + this.text = text; + } + public String getHtmlInput() { + return htmlInput; + } + public void setHtmlInput(String htmlInput) { + this.htmlInput = htmlInput; + } + } \ No newline at end of file diff --git a/JavaServerFaces_22OutputFormat/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_22OutputFormat/src/main/webapp/WEB-INF/web.xml index c430002..3168a83 100644 --- a/JavaServerFaces_22OutputFormat/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_22OutputFormat/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_22OutputFormat - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_22OutputFormat + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_22OutputFormat/src/main/webapp/demo.xhtml b/JavaServerFaces_22OutputFormat/src/main/webapp/demo.xhtml index d615dde..e568faa 100644 --- a/JavaServerFaces_22OutputFormat/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_22OutputFormat/src/main/webapp/demo.xhtml @@ -1,49 +1,49 @@ - - - - - -

JSF 2.0 h:outputFormat Example

-
    -
  1. - - - - -
  2. -
  3. - - - -
  4. - -
  5. - - - - -
  6. - - -
  7. - - - - -
  8. - -
  9. - - - - -
  10. - - -
-
+ + + + + +

JSF 2.0 h:outputFormat Example

+
    +
  1. + + + + +
  2. +
  3. + + + +
  4. + +
  5. + + + + +
  6. + + +
  7. + + + + +
  8. + +
  9. + + + + +
  10. + + +
+
\ No newline at end of file diff --git a/JavaServerFaces_23GraphicImage/pom.xml b/JavaServerFaces_23GraphicImage/pom.xml index 5944ba9..a60857c 100644 --- a/JavaServerFaces_23GraphicImage/pom.xml +++ b/JavaServerFaces_23GraphicImage/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_23GraphicImage - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_23GraphicImage + + \ No newline at end of file diff --git a/JavaServerFaces_23GraphicImage/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_23GraphicImage/src/main/java/com/xxy/UserBean.java index f9d25b8..74be7d2 100644 --- a/JavaServerFaces_23GraphicImage/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_23GraphicImage/src/main/java/com/xxy/UserBean.java @@ -1,11 +1,11 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + } \ No newline at end of file diff --git a/JavaServerFaces_23GraphicImage/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_23GraphicImage/src/main/webapp/WEB-INF/web.xml index 4b949d9..c270521 100644 --- a/JavaServerFaces_23GraphicImage/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_23GraphicImage/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_23GraphicImage - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_23GraphicImage + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_23GraphicImage/src/main/webapp/demo.xhtml b/JavaServerFaces_23GraphicImage/src/main/webapp/demo.xhtml index 528c4ff..a000318 100644 --- a/JavaServerFaces_23GraphicImage/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_23GraphicImage/src/main/webapp/demo.xhtml @@ -1,19 +1,19 @@ - - - - - - -

JSF 2 graphicImage example

- -
    -
  1. Normal way -
  2. -
  3. Library way -
  4. -
- -
- + + + + + + +

JSF 2 graphicImage example

+ +
    +
  1. Normal way -
  2. +
  3. Library way -
  4. +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_24OutputStyleSheet/pom.xml b/JavaServerFaces_24OutputStyleSheet/pom.xml index 07ba7b8..e2333de 100644 --- a/JavaServerFaces_24OutputStyleSheet/pom.xml +++ b/JavaServerFaces_24OutputStyleSheet/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_24OutputStyleSheet - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_24OutputStyleSheet + + \ No newline at end of file diff --git a/JavaServerFaces_24OutputStyleSheet/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_24OutputStyleSheet/src/main/java/com/xxy/UserBean.java index f9d25b8..74be7d2 100644 --- a/JavaServerFaces_24OutputStyleSheet/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_24OutputStyleSheet/src/main/java/com/xxy/UserBean.java @@ -1,11 +1,11 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + } \ No newline at end of file diff --git a/JavaServerFaces_24OutputStyleSheet/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_24OutputStyleSheet/src/main/webapp/WEB-INF/web.xml index 1cf6b3d..30427ec 100644 --- a/JavaServerFaces_24OutputStyleSheet/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_24OutputStyleSheet/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_24OutputStyleSheet - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_24OutputStyleSheet + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_24OutputStyleSheet/src/main/webapp/demo.xhtml b/JavaServerFaces_24OutputStyleSheet/src/main/webapp/demo.xhtml index 31b9449..dae948b 100644 --- a/JavaServerFaces_24OutputStyleSheet/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_24OutputStyleSheet/src/main/webapp/demo.xhtml @@ -1,18 +1,18 @@ - - - - - - -

JSF 2 outputStylesheet example

- - - -
This is red color
- -
- + + + + + + +

JSF 2 outputStylesheet example

+ + + +
This is red color
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_24OutputStyleSheet/src/main/webapp/resources/css/style.css b/JavaServerFaces_24OutputStyleSheet/src/main/webapp/resources/css/style.css index c21b0f8..18c49df 100644 --- a/JavaServerFaces_24OutputStyleSheet/src/main/webapp/resources/css/style.css +++ b/JavaServerFaces_24OutputStyleSheet/src/main/webapp/resources/css/style.css @@ -1,3 +1,3 @@ -.red{ - color:red; +.red{ + color:red; } \ No newline at end of file diff --git a/JavaServerFaces_25OutputScript/pom.xml b/JavaServerFaces_25OutputScript/pom.xml index e8258c1..c81ce8d 100644 --- a/JavaServerFaces_25OutputScript/pom.xml +++ b/JavaServerFaces_25OutputScript/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_25OutputScript - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_25OutputScript + + \ No newline at end of file diff --git a/JavaServerFaces_25OutputScript/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_25OutputScript/src/main/java/com/xxy/UserBean.java index f9d25b8..74be7d2 100644 --- a/JavaServerFaces_25OutputScript/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_25OutputScript/src/main/java/com/xxy/UserBean.java @@ -1,11 +1,11 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + } \ No newline at end of file diff --git a/JavaServerFaces_25OutputScript/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_25OutputScript/src/main/webapp/WEB-INF/web.xml index 7578461..a85f08a 100644 --- a/JavaServerFaces_25OutputScript/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_25OutputScript/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_25OutputScript - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_25OutputScript + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_25OutputScript/src/main/webapp/demo.xhtml b/JavaServerFaces_25OutputScript/src/main/webapp/demo.xhtml index 8e5fd3e..344d43e 100644 --- a/JavaServerFaces_25OutputScript/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_25OutputScript/src/main/webapp/demo.xhtml @@ -1,16 +1,16 @@ - - - - - - -

JSF 2 outputScript example

- - - -
- + + + + + + +

JSF 2 outputScript example

+ + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_26ButtonCommanButton/pom.xml b/JavaServerFaces_26ButtonCommanButton/pom.xml index 57e2445..303eadb 100644 --- a/JavaServerFaces_26ButtonCommanButton/pom.xml +++ b/JavaServerFaces_26ButtonCommanButton/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_26ButtonCommanButton - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_26ButtonCommanButton + + \ No newline at end of file diff --git a/JavaServerFaces_26ButtonCommanButton/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_26ButtonCommanButton/src/main/java/com/xxy/UserBean.java index 95c043c..8ec5a96 100644 --- a/JavaServerFaces_26ButtonCommanButton/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_26ButtonCommanButton/src/main/java/com/xxy/UserBean.java @@ -1,15 +1,15 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String goLoginPage(){ - - return "login"; - - } +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String goLoginPage(){ + + return "login"; + + } } \ No newline at end of file diff --git a/JavaServerFaces_26ButtonCommanButton/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_26ButtonCommanButton/src/main/webapp/WEB-INF/web.xml index 6ff316e..e955e01 100644 --- a/JavaServerFaces_26ButtonCommanButton/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_26ButtonCommanButton/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_26ButtonCommanButton - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_26ButtonCommanButton + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_26ButtonCommanButton/src/main/webapp/demo.xhtml b/JavaServerFaces_26ButtonCommanButton/src/main/webapp/demo.xhtml index bb00f4a..376ea32 100644 --- a/JavaServerFaces_26ButtonCommanButton/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_26ButtonCommanButton/src/main/webapp/demo.xhtml @@ -1,40 +1,40 @@ - - - - - - -

JSF 2 button and commandButton example

- - -
    -
  1. - -
  2. -
  3. - -
  4. -
  5. - -
  6. -
  7. - -
  8. -
  9. - -
  10. -
  11. - -
  12. -
  13. - -
  14. -
-
- -
- + + + + + + +

JSF 2 button and commandButton example

+ + +
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
  9. + +
  10. +
  11. + +
  12. +
  13. + +
  14. +
+
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_26ButtonCommanButton/src/main/webapp/login.xhtml b/JavaServerFaces_26ButtonCommanButton/src/main/webapp/login.xhtml index 20c53f1..eda4e46 100644 --- a/JavaServerFaces_26ButtonCommanButton/src/main/webapp/login.xhtml +++ b/JavaServerFaces_26ButtonCommanButton/src/main/webapp/login.xhtml @@ -1,14 +1,14 @@ - - - - - - -

login.xhtml

- -
- + + + + + + +

login.xhtml

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_27LinkCommandLinkOutputlink/pom.xml b/JavaServerFaces_27LinkCommandLinkOutputlink/pom.xml index 2fd91b7..0442176 100644 --- a/JavaServerFaces_27LinkCommandLinkOutputlink/pom.xml +++ b/JavaServerFaces_27LinkCommandLinkOutputlink/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_27LinkCommandLinkOutputlink - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_27LinkCommandLinkOutputlink + + \ No newline at end of file diff --git a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/java/com/xxy/UserBean.java index 95c043c..8ec5a96 100644 --- a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/java/com/xxy/UserBean.java @@ -1,15 +1,15 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String goLoginPage(){ - - return "login"; - - } +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String goLoginPage(){ + + return "login"; + + } } \ No newline at end of file diff --git a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/WEB-INF/web.xml index 3a0f6df..b391f8a 100644 --- a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_27LinkCommandLinkOutputlink - - javax.faces.PROJECT_STAGE - Development - - - faces/demo.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_27LinkCommandLinkOutputlink + + javax.faces.PROJECT_STAGE + Development + + + faces/demo.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/demo.xhtml b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/demo.xhtml index 38e5210..9701ad7 100644 --- a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/demo.xhtml @@ -1,70 +1,70 @@ - - - - - -

JSF 2 link, commandLink and outputLink example

- - -
    -
  1. - -
  2. -
  3. - - - -
  4. -
  5. - - - -
  6. - -
  7. - -
  8. -
  9. - -
  10. -
  11. - - - -
  12. -
  13. - - - -
  14. -
  15. - - Login page - -
  16. -
  17. - - Login page - -
  18. -
  19. - - - - -
  20. -
  21. - - - -
  22. -
-
- -
- + + + + + +

JSF 2 link, commandLink and outputLink example

+ + +
    +
  1. + +
  2. +
  3. + + + +
  4. +
  5. + + + +
  6. + +
  7. + +
  8. +
  9. + +
  10. +
  11. + + + +
  12. +
  13. + + + +
  14. +
  15. + + Login page + +
  16. +
  17. + + Login page + +
  18. +
  19. + + + + +
  20. +
  21. + + + +
  22. +
+
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/login.xhtml b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/login.xhtml index 20c53f1..eda4e46 100644 --- a/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/login.xhtml +++ b/JavaServerFaces_27LinkCommandLinkOutputlink/src/main/webapp/login.xhtml @@ -1,14 +1,14 @@ - - - - - - -

login.xhtml

- -
- + + + + + + +

login.xhtml

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_28PanelGrid/pom.xml b/JavaServerFaces_28PanelGrid/pom.xml index b7f586d..ac852ef 100644 --- a/JavaServerFaces_28PanelGrid/pom.xml +++ b/JavaServerFaces_28PanelGrid/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_28PanelGrid - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_28PanelGrid + + \ No newline at end of file diff --git a/JavaServerFaces_28PanelGrid/src/main/java/com/xxy/DummyBean.java b/JavaServerFaces_28PanelGrid/src/main/java/com/xxy/DummyBean.java index 228ffb3..13d84b9 100644 --- a/JavaServerFaces_28PanelGrid/src/main/java/com/xxy/DummyBean.java +++ b/JavaServerFaces_28PanelGrid/src/main/java/com/xxy/DummyBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="dummy") -@SessionScoped -public class DummyBean implements Serializable{ - - int number; - - public int getNumber() { - return number; - } - - public void setNumber(int number) { - this.number = number; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="dummy") +@SessionScoped +public class DummyBean implements Serializable{ + + int number; + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + } \ No newline at end of file diff --git a/JavaServerFaces_28PanelGrid/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_28PanelGrid/src/main/webapp/WEB-INF/web.xml index c24b3c5..53a870f 100644 --- a/JavaServerFaces_28PanelGrid/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_28PanelGrid/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces_28PanelGrid - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces_28PanelGrid + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_28PanelGrid/src/main/webapp/default.xhtml b/JavaServerFaces_28PanelGrid/src/main/webapp/default.xhtml index 5c081e8..560d97b 100644 --- a/JavaServerFaces_28PanelGrid/src/main/webapp/default.xhtml +++ b/JavaServerFaces_28PanelGrid/src/main/webapp/default.xhtml @@ -1,34 +1,34 @@ - - - - - -

JSF 2 panelGrid example

- - - - - - Enter a number : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 panelGrid example

+ + + + + + Enter a number : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_28PanelGrid/src/main/webapp/result.xhtml b/JavaServerFaces_28PanelGrid/src/main/webapp/result.xhtml index b3a30e7..5d2d18d 100644 --- a/JavaServerFaces_28PanelGrid/src/main/webapp/result.xhtml +++ b/JavaServerFaces_28PanelGrid/src/main/webapp/result.xhtml @@ -1,17 +1,17 @@ - - - - - -

JSF 2 panelGrid example

- - Number : - - -
+ + + + + +

JSF 2 panelGrid example

+ + Number : + + +
\ No newline at end of file diff --git a/JavaServerFaces_29Message/pom.xml b/JavaServerFaces_29Message/pom.xml index d740046..227704d 100644 --- a/JavaServerFaces_29Message/pom.xml +++ b/JavaServerFaces_29Message/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_29Message - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_29Message + + \ No newline at end of file diff --git a/JavaServerFaces_29Message/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_29Message/src/main/java/com/xxy/UserBean.java index a3e27b8..6f1425a 100644 --- a/JavaServerFaces_29Message/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_29Message/src/main/java/com/xxy/UserBean.java @@ -1,29 +1,29 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - public String username; - public int age; - - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - public int getAge() { - return age; - } - public void setAge(int age) { - this.age = age; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + public String username; + public int age; + + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public int getAge() { + return age; + } + public void setAge(int age) { + this.age = age; + } + } \ No newline at end of file diff --git a/JavaServerFaces_29Message/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_29Message/src/main/webapp/WEB-INF/web.xml index b34d57c..c21d5ba 100644 --- a/JavaServerFaces_29Message/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_29Message/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_29Message - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_29Message + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_29Message/src/main/webapp/default.xhtml b/JavaServerFaces_29Message/src/main/webapp/default.xhtml index db6f20d..263bc18 100644 --- a/JavaServerFaces_29Message/src/main/webapp/default.xhtml +++ b/JavaServerFaces_29Message/src/main/webapp/default.xhtml @@ -1,48 +1,48 @@ - - - - - - -

JSF 2 message + messages example

- - - - - -
- - - - Enter your username : - - - - - - - - Enter your age : - - - - - - - - - - -
- -
+ + + + + + +

JSF 2 message + messages example

+ + + + + +
+ + + + Enter your username : + + + + + + + + Enter your age : + + + + + + + + + + +
+ +
\ No newline at end of file diff --git a/JavaServerFaces_29Message/src/main/webapp/result.xhtml b/JavaServerFaces_29Message/src/main/webapp/result.xhtml index 1965a50..54d2112 100644 --- a/JavaServerFaces_29Message/src/main/webapp/result.xhtml +++ b/JavaServerFaces_29Message/src/main/webapp/result.xhtml @@ -1,19 +1,19 @@ - - - - - - -

JSF 2 message + messages example

- - Username : #{user.username} - -
- - Age : #{user.age} - -
+ + + + + + +

JSF 2 message + messages example

+ + Username : #{user.username} + +
+ + Age : #{user.age} + +
\ No newline at end of file diff --git a/JavaServerFaces_30Param/pom.xml b/JavaServerFaces_30Param/pom.xml index 19d6a23..eb18248 100644 --- a/JavaServerFaces_30Param/pom.xml +++ b/JavaServerFaces_30Param/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_30Param - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_30Param + + \ No newline at end of file diff --git a/JavaServerFaces_30Param/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_30Param/src/main/java/com/xxy/UserBean.java index f51131c..a983912 100644 --- a/JavaServerFaces_30Param/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_30Param/src/main/java/com/xxy/UserBean.java @@ -1,48 +1,48 @@ -package com.xxy; - -import java.util.Map; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String name; - public String country; - - public String outcome(){ - - FacesContext fc = FacesContext.getCurrentInstance(); - this.country = getCountryParam(fc); - - return "result"; - } - - //get value from "f:param" - public String getCountryParam(FacesContext fc){ - - Map params = fc.getExternalContext().getRequestParameterMap(); - return params.get("country"); - - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCountry() { - return country; - } - - public void setCountry(String country) { - this.country = country; - } - +package com.xxy; + +import java.util.Map; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String name; + public String country; + + public String outcome(){ + + FacesContext fc = FacesContext.getCurrentInstance(); + this.country = getCountryParam(fc); + + return "result"; + } + + //get value from "f:param" + public String getCountryParam(FacesContext fc){ + + Map params = fc.getExternalContext().getRequestParameterMap(); + return params.get("country"); + + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + } \ No newline at end of file diff --git a/JavaServerFaces_30Param/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_30Param/src/main/webapp/WEB-INF/web.xml index f14efb6..7b9a9f7 100644 --- a/JavaServerFaces_30Param/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_30Param/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_30Param - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_30Param + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_30Param/src/main/webapp/default.xhtml b/JavaServerFaces_30Param/src/main/webapp/default.xhtml index c25a2ab..94663f2 100644 --- a/JavaServerFaces_30Param/src/main/webapp/default.xhtml +++ b/JavaServerFaces_30Param/src/main/webapp/default.xhtml @@ -1,30 +1,30 @@ - - - - - - -

JSF 2 param example

- - - - Enter your name : - - -

- - - - - - - -
- -
+ + + + + + +

JSF 2 param example

+ + + + Enter your name : + + +

+ + + + + + + +
+ +
\ No newline at end of file diff --git a/JavaServerFaces_30Param/src/main/webapp/result.xhtml b/JavaServerFaces_30Param/src/main/webapp/result.xhtml index 0d0b70f..06a6f34 100644 --- a/JavaServerFaces_30Param/src/main/webapp/result.xhtml +++ b/JavaServerFaces_30Param/src/main/webapp/result.xhtml @@ -1,22 +1,22 @@ - - - - - - -

JSF 2 param example

- -

- - - - -

- -
- + + + + + + +

JSF 2 param example

+ +

+ + + + +

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_31Attribute/pom.xml b/JavaServerFaces_31Attribute/pom.xml index 1cf14a4..b502687 100644 --- a/JavaServerFaces_31Attribute/pom.xml +++ b/JavaServerFaces_31Attribute/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_31Attribute - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_31Attribute + + \ No newline at end of file diff --git a/JavaServerFaces_31Attribute/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_31Attribute/src/main/java/com/xxy/UserBean.java index 92d5cac..2e03915 100644 --- a/JavaServerFaces_31Attribute/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_31Attribute/src/main/java/com/xxy/UserBean.java @@ -1,33 +1,33 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.event.ActionEvent; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String nickname; - - //action listener event - public void attrListener(ActionEvent event){ - - nickname = (String)event.getComponent().getAttributes().get("username"); - - } - - public String outcome(){ - return "result"; - } - - public String getNickname() { - return nickname; - } - - - public void setNickname(String nickname) { - this.nickname = nickname; - } - +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.event.ActionEvent; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String nickname; + + //action listener event + public void attrListener(ActionEvent event){ + + nickname = (String)event.getComponent().getAttributes().get("username"); + + } + + public String outcome(){ + return "result"; + } + + public String getNickname() { + return nickname; + } + + + public void setNickname(String nickname) { + this.nickname = nickname; + } + } \ No newline at end of file diff --git a/JavaServerFaces_31Attribute/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_31Attribute/src/main/webapp/WEB-INF/web.xml index 586f84d..7c29923 100644 --- a/JavaServerFaces_31Attribute/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_31Attribute/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_31Attribute - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_31Attribute + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_31Attribute/src/main/webapp/default.xhtml b/JavaServerFaces_31Attribute/src/main/webapp/default.xhtml index e182c3e..8f0099c 100644 --- a/JavaServerFaces_31Attribute/src/main/webapp/default.xhtml +++ b/JavaServerFaces_31Attribute/src/main/webapp/default.xhtml @@ -1,26 +1,26 @@ - - - - - - -

JSF 2 attribute example

- - - - - - - - - - - - -
+ + + + + + +

JSF 2 attribute example

+ + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_31Attribute/src/main/webapp/result.xhtml b/JavaServerFaces_31Attribute/src/main/webapp/result.xhtml index ac140cb..0e29e91 100644 --- a/JavaServerFaces_31Attribute/src/main/webapp/result.xhtml +++ b/JavaServerFaces_31Attribute/src/main/webapp/result.xhtml @@ -1,16 +1,16 @@ - - - - - - -

JSF 2 attribute example

- - #{user.nickname} - -
- + + + + + + +

JSF 2 attribute example

+ + #{user.nickname} + +
+ \ No newline at end of file diff --git a/JavaServerFaces_32SetpropertyActionListener/pom.xml b/JavaServerFaces_32SetpropertyActionListener/pom.xml index c85c8d4..df3bb56 100644 --- a/JavaServerFaces_32SetpropertyActionListener/pom.xml +++ b/JavaServerFaces_32SetpropertyActionListener/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_32SetpropertyActionListener - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_32SetpropertyActionListener + + \ No newline at end of file diff --git a/JavaServerFaces_32SetpropertyActionListener/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_32SetpropertyActionListener/src/main/java/com/xxy/UserBean.java index dba3f7a..eac6fc2 100644 --- a/JavaServerFaces_32SetpropertyActionListener/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_32SetpropertyActionListener/src/main/java/com/xxy/UserBean.java @@ -1,24 +1,24 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String username; - - public String outcome(){ - return "result"; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String username; + + public String outcome(){ + return "result"; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + } \ No newline at end of file diff --git a/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/WEB-INF/web.xml index a915832..64a28cd 100644 --- a/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_32SetpropertyActionListener - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_32SetpropertyActionListener + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/default.xhtml b/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/default.xhtml index 48b60c9..2a17455 100644 --- a/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/default.xhtml +++ b/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/default.xhtml @@ -1,24 +1,24 @@ - - - - - - -

JSF 2 setPropertyActionListener example

- - - - - - - - - - - -
+ + + + + + +

JSF 2 setPropertyActionListener example

+ + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/result.xhtml b/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/result.xhtml index 8071f2d..b2b49e7 100644 --- a/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/result.xhtml +++ b/JavaServerFaces_32SetpropertyActionListener/src/main/webapp/result.xhtml @@ -1,16 +1,16 @@ - - - - - - -

JSF 2 setPropertyActionListener example

- - #{user.username} - -
- + + + + + + +

JSF 2 setPropertyActionListener example

+ + #{user.username} + +
+ \ No newline at end of file diff --git a/JavaServerFaces_33DataTable/pom.xml b/JavaServerFaces_33DataTable/pom.xml index fb840f0..1e35d61 100644 --- a/JavaServerFaces_33DataTable/pom.xml +++ b/JavaServerFaces_33DataTable/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_33DataTable - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_33DataTable + + \ No newline at end of file diff --git a/JavaServerFaces_33DataTable/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_33DataTable/src/main/java/com/xxy/OrderBean.java index 7d162b7..27271d3 100644 --- a/JavaServerFaces_33DataTable/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_33DataTable/src/main/java/com/xxy/OrderBean.java @@ -1,74 +1,74 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private static final Order[] orderList = new Order[] { - - new Order("A0001", "Intel CPU", - new BigDecimal("700.00"), 1), - new Order("A0002", "Harddisk 10TB", - new BigDecimal("500.00"), 2), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 8), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 3), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("100.00"), 10) - }; - - public Order[] getOrderList() { - - return orderList; - - } - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public Order(String orderNo, String productName, BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public String getOrderNo() { - return orderNo; - } - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - public String getProductName() { - return productName; - } - public void setProductName(String productName) { - this.productName = productName; - } - public BigDecimal getPrice() { - return price; - } - public void setPrice(BigDecimal price) { - this.price = price; - } - public int getQty() { - return qty; - } - public void setQty(int qty) { - this.qty = qty; - } - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private static final Order[] orderList = new Order[] { + + new Order("A0001", "Intel CPU", + new BigDecimal("700.00"), 1), + new Order("A0002", "Harddisk 10TB", + new BigDecimal("500.00"), 2), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 8), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 3), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("100.00"), 10) + }; + + public Order[] getOrderList() { + + return orderList; + + } + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public Order(String orderNo, String productName, BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public String getOrderNo() { + return orderNo; + } + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getPrice() { + return price; + } + public void setPrice(BigDecimal price) { + this.price = price; + } + public int getQty() { + return qty; + } + public void setQty(int qty) { + this.qty = qty; + } + } } \ No newline at end of file diff --git a/JavaServerFaces_33DataTable/src/main/resources/com/mkyong/order.properties b/JavaServerFaces_33DataTable/src/main/resources/com/mkyong/order.properties index 2e08610..cb51c81 100644 --- a/JavaServerFaces_33DataTable/src/main/resources/com/mkyong/order.properties +++ b/JavaServerFaces_33DataTable/src/main/resources/com/mkyong/order.properties @@ -1,5 +1,5 @@ -order.orderNoColumn = Order No -order.productNameColumn = Product Name -order.priceColumn = Price -order.qtyColumn = Quantity +order.orderNoColumn = Order No +order.productNameColumn = Product Name +order.priceColumn = Price +order.qtyColumn = Quantity order.dateColumn = Date \ No newline at end of file diff --git a/JavaServerFaces_33DataTable/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_33DataTable/src/main/webapp/WEB-INF/web.xml index 1c7de7d..fe08533 100644 --- a/JavaServerFaces_33DataTable/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_33DataTable/src/main/webapp/WEB-INF/web.xml @@ -1,54 +1,54 @@ - - - - JavaServerFaces - - - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - + + + + JavaServerFaces + + + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + \ No newline at end of file diff --git a/JavaServerFaces_33DataTable/src/main/webapp/default.xhtml b/JavaServerFaces_33DataTable/src/main/webapp/default.xhtml index bc0d501..a450e90 100644 --- a/JavaServerFaces_33DataTable/src/main/webapp/default.xhtml +++ b/JavaServerFaces_33DataTable/src/main/webapp/default.xhtml @@ -1,48 +1,48 @@ - - - - - - - - -

JSF 2 dataTable example

- - - - - - Order No - - #{o.orderNo} - - - - Product Name - #{o.productName} - - - - Price - #{o.price} - - - - Quantity - #{o.qty} - - - - -
- + + + + + + + + +

JSF 2 dataTable example

+ + + + + + Order No + + #{o.orderNo} + + + + Product Name + #{o.productName} + + + + Price + #{o.price} + + + + Quantity + #{o.qty} + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_33DataTable/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_33DataTable/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_33DataTable/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_33DataTable/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_34DataTableAdd/pom.xml b/JavaServerFaces_34DataTableAdd/pom.xml index 03db121..f701148 100644 --- a/JavaServerFaces_34DataTableAdd/pom.xml +++ b/JavaServerFaces_34DataTableAdd/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_34DataTableAdd - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_34DataTableAdd + + \ No newline at end of file diff --git a/JavaServerFaces_34DataTableAdd/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_34DataTableAdd/src/main/java/com/xxy/OrderBean.java index f68d154..7dee49f 100644 --- a/JavaServerFaces_34DataTableAdd/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_34DataTableAdd/src/main/java/com/xxy/OrderBean.java @@ -1,131 +1,131 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public String getOrderNo() { - return orderNo; - } - - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public int getQty() { - return qty; - } - - public void setQty(int qty) { - this.qty = qty; - } - - private static final ArrayList orderList = - new ArrayList(Arrays.asList( - - new Order("A0001", "Intel CPU", - new BigDecimal("700.00"), 1), - new Order("A0002", "Harddisk 10TB", - new BigDecimal("500.00"), 2), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 8), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 3), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("100.00"), 10) - )); - - public ArrayList getOrderList() { - - return orderList; - - } - - public String addAction() { - - Order order = new Order(this.orderNo, this.productName, - this.price, this.qty); - - orderList.add(order); - - return null; - } - - public String deleteAction(Order order) { - - orderList.remove(order); - return null; - } - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public Order(String orderNo, String productName, - BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public String getOrderNo() { - return orderNo; - } - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - public String getProductName() { - return productName; - } - public void setProductName(String productName) { - this.productName = productName; - } - public BigDecimal getPrice() { - return price; - } - public void setPrice(BigDecimal price) { - this.price = price; - } - public int getQty() { - return qty; - } - public void setQty(int qty) { - this.qty = qty; - } - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public int getQty() { + return qty; + } + + public void setQty(int qty) { + this.qty = qty; + } + + private static final ArrayList orderList = + new ArrayList(Arrays.asList( + + new Order("A0001", "Intel CPU", + new BigDecimal("700.00"), 1), + new Order("A0002", "Harddisk 10TB", + new BigDecimal("500.00"), 2), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 8), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 3), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("100.00"), 10) + )); + + public ArrayList getOrderList() { + + return orderList; + + } + + public String addAction() { + + Order order = new Order(this.orderNo, this.productName, + this.price, this.qty); + + orderList.add(order); + + return null; + } + + public String deleteAction(Order order) { + + orderList.remove(order); + return null; + } + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public Order(String orderNo, String productName, + BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public String getOrderNo() { + return orderNo; + } + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getPrice() { + return price; + } + public void setPrice(BigDecimal price) { + this.price = price; + } + public int getQty() { + return qty; + } + public void setQty(int qty) { + this.qty = qty; + } + } } \ No newline at end of file diff --git a/JavaServerFaces_34DataTableAdd/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_34DataTableAdd/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_34DataTableAdd/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_34DataTableAdd/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_34DataTableAdd/src/main/webapp/default.xhtml b/JavaServerFaces_34DataTableAdd/src/main/webapp/default.xhtml index e2acc21..bdd21e3 100644 --- a/JavaServerFaces_34DataTableAdd/src/main/webapp/default.xhtml +++ b/JavaServerFaces_34DataTableAdd/src/main/webapp/default.xhtml @@ -1,85 +1,85 @@ - - - - - - - - -

JSF 2 dataTable example

- - - - - - Order No - #{o.orderNo} - - - - - - Product Name - #{o.productName} - - - - - - Price - #{o.price} - - - - - - Quantity - #{o.qty} - - - - - - Action - - - - - - - -

Enter Order

- - - - - - - - - - - - - - - - - -
Order No :
Product Name :
Quantity :
Price :
- - - -
-
- + + + + + + + + +

JSF 2 dataTable example

+ + + + + + Order No + #{o.orderNo} + + + + + + Product Name + #{o.productName} + + + + + + Price + #{o.price} + + + + + + Quantity + #{o.qty} + + + + + + Action + + + + + + + +

Enter Order

+ + + + + + + + + + + + + + + + + +
Order No :
Product Name :
Quantity :
Price :
+ + + +
+
+ \ No newline at end of file diff --git a/JavaServerFaces_34DataTableAdd/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_34DataTableAdd/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_34DataTableAdd/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_34DataTableAdd/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_35DataTableUpdate/pom.xml b/JavaServerFaces_35DataTableUpdate/pom.xml index 2350ce4..2f485e2 100644 --- a/JavaServerFaces_35DataTableUpdate/pom.xml +++ b/JavaServerFaces_35DataTableUpdate/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_35DataTableUpdate - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_35DataTableUpdate + + \ No newline at end of file diff --git a/JavaServerFaces_35DataTableUpdate/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_35DataTableUpdate/src/main/java/com/xxy/OrderBean.java index 5ad1449..fdc7b16 100644 --- a/JavaServerFaces_35DataTableUpdate/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_35DataTableUpdate/src/main/java/com/xxy/OrderBean.java @@ -1,102 +1,102 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private static final ArrayList orderList = - new ArrayList(Arrays.asList( - - new Order("A0001", "Intel CPU", - new BigDecimal("700.00"), 1), - new Order("A0002", "Harddisk 10TB", - new BigDecimal("500.00"), 2), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 8), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 3), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("100.00"), 10) - )); - - public ArrayList getOrderList() { - - return orderList; - - } - - public String saveAction() { - - //get all existing value but set "editable" to false - for (Order order : orderList){ - order.setEditable(false); - } - - //return to current page - return null; - - } - - public String editAction(Order order) { - - order.setEditable(true); - return null; - } - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - boolean editable; - - public Order(String orderNo, String productName, BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public boolean isEditable() { - return editable; - } - public void setEditable(boolean editable) { - this.editable = editable; - } - public String getOrderNo() { - return orderNo; - } - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - public String getProductName() { - return productName; - } - public void setProductName(String productName) { - this.productName = productName; - } - public BigDecimal getPrice() { - return price; - } - public void setPrice(BigDecimal price) { - this.price = price; - } - public int getQty() { - return qty; - } - public void setQty(int qty) { - this.qty = qty; - } - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private static final ArrayList orderList = + new ArrayList(Arrays.asList( + + new Order("A0001", "Intel CPU", + new BigDecimal("700.00"), 1), + new Order("A0002", "Harddisk 10TB", + new BigDecimal("500.00"), 2), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 8), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 3), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("100.00"), 10) + )); + + public ArrayList getOrderList() { + + return orderList; + + } + + public String saveAction() { + + //get all existing value but set "editable" to false + for (Order order : orderList){ + order.setEditable(false); + } + + //return to current page + return null; + + } + + public String editAction(Order order) { + + order.setEditable(true); + return null; + } + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + boolean editable; + + public Order(String orderNo, String productName, BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public boolean isEditable() { + return editable; + } + public void setEditable(boolean editable) { + this.editable = editable; + } + public String getOrderNo() { + return orderNo; + } + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getPrice() { + return price; + } + public void setPrice(BigDecimal price) { + this.price = price; + } + public int getQty() { + return qty; + } + public void setQty(int qty) { + this.qty = qty; + } + } } \ No newline at end of file diff --git a/JavaServerFaces_35DataTableUpdate/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_35DataTableUpdate/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_35DataTableUpdate/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_35DataTableUpdate/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_35DataTableUpdate/src/main/webapp/default.xhtml b/JavaServerFaces_35DataTableUpdate/src/main/webapp/default.xhtml index 88c0a16..74abb6a 100644 --- a/JavaServerFaces_35DataTableUpdate/src/main/webapp/default.xhtml +++ b/JavaServerFaces_35DataTableUpdate/src/main/webapp/default.xhtml @@ -1,77 +1,77 @@ - - - - - - - - -

JSF 2 dataTable example

- - - - - - Order No - - - - - - - - - - Product Name - - - - - - - - - - Price - - - - - - - - - - Quantity - - - - - - - - - - Action - - - - - - - - - - -
- + + + + + + + + +

JSF 2 dataTable example

+ + + + + + Order No + + + + + + + + + + Product Name + + + + + + + + + + Price + + + + + + + + + + Quantity + + + + + + + + + + Action + + + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_35DataTableUpdate/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_35DataTableUpdate/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_35DataTableUpdate/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_35DataTableUpdate/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_36DataTableDelete/pom.xml b/JavaServerFaces_36DataTableDelete/pom.xml index a364633..f4f22d8 100644 --- a/JavaServerFaces_36DataTableDelete/pom.xml +++ b/JavaServerFaces_36DataTableDelete/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_36DataTableDelete - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_36DataTableDelete + + \ No newline at end of file diff --git a/JavaServerFaces_36DataTableDelete/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_36DataTableDelete/src/main/java/com/xxy/OrderBean.java index 632f2df..74537b8 100644 --- a/JavaServerFaces_36DataTableDelete/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_36DataTableDelete/src/main/java/com/xxy/OrderBean.java @@ -1,84 +1,84 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private static final ArrayList orderList = - new ArrayList(Arrays.asList( - - new Order("A0001", "Intel CPU", - new BigDecimal("700.00"), 1), - new Order("A0002", "Harddisk 10TB", - new BigDecimal("500.00"), 2), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 8), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 3), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("100.00"), 10) - )); - - public ArrayList getOrderList() { - - return orderList; - - } - - public String deleteAction(Order order) { - - orderList.remove(order); - return null; - } - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public Order(String orderNo, String productName, - BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public String getOrderNo() { - return orderNo; - } - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - public String getProductName() { - return productName; - } - public void setProductName(String productName) { - this.productName = productName; - } - public BigDecimal getPrice() { - return price; - } - public void setPrice(BigDecimal price) { - this.price = price; - } - public int getQty() { - return qty; - } - public void setQty(int qty) { - this.qty = qty; - } - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private static final ArrayList orderList = + new ArrayList(Arrays.asList( + + new Order("A0001", "Intel CPU", + new BigDecimal("700.00"), 1), + new Order("A0002", "Harddisk 10TB", + new BigDecimal("500.00"), 2), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 8), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 3), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("100.00"), 10) + )); + + public ArrayList getOrderList() { + + return orderList; + + } + + public String deleteAction(Order order) { + + orderList.remove(order); + return null; + } + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public Order(String orderNo, String productName, + BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public String getOrderNo() { + return orderNo; + } + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + public String getProductName() { + return productName; + } + public void setProductName(String productName) { + this.productName = productName; + } + public BigDecimal getPrice() { + return price; + } + public void setPrice(BigDecimal price) { + this.price = price; + } + public int getQty() { + return qty; + } + public void setQty(int qty) { + this.qty = qty; + } + } } \ No newline at end of file diff --git a/JavaServerFaces_36DataTableDelete/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_36DataTableDelete/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_36DataTableDelete/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_36DataTableDelete/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_36DataTableDelete/src/main/webapp/default.xhtml b/JavaServerFaces_36DataTableDelete/src/main/webapp/default.xhtml index d0e2515..7fa5677 100644 --- a/JavaServerFaces_36DataTableDelete/src/main/webapp/default.xhtml +++ b/JavaServerFaces_36DataTableDelete/src/main/webapp/default.xhtml @@ -1,63 +1,63 @@ - - - - - - - - -

JSF 2 dataTable example

- - - - - - Order No - #{o.orderNo} - - - - - - Product Name - #{o.productName} - - - - - - Price - #{o.price} - - - - - - Quantity - #{o.qty} - - - - - - Action - - - - - - - - -
- + + + + + + + + +

JSF 2 dataTable example

+ + + + + + Order No + #{o.orderNo} + + + + + + Product Name + #{o.productName} + + + + + + Price + #{o.price} + + + + + + Quantity + #{o.qty} + + + + + + Action + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_36DataTableDelete/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_36DataTableDelete/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_36DataTableDelete/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_36DataTableDelete/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_37DataTableRowNumbers/pom.xml b/JavaServerFaces_37DataTableRowNumbers/pom.xml index 8bbd48c..0dca9c0 100644 --- a/JavaServerFaces_37DataTableRowNumbers/pom.xml +++ b/JavaServerFaces_37DataTableRowNumbers/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_37DataTableRowNumbers - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_37DataTableRowNumbers + + \ No newline at end of file diff --git a/JavaServerFaces_37DataTableRowNumbers/src/main/java/com/xxy/PersonBean.java b/JavaServerFaces_37DataTableRowNumbers/src/main/java/com/xxy/PersonBean.java index 61fbb8f..eb3b927 100644 --- a/JavaServerFaces_37DataTableRowNumbers/src/main/java/com/xxy/PersonBean.java +++ b/JavaServerFaces_37DataTableRowNumbers/src/main/java/com/xxy/PersonBean.java @@ -1,73 +1,73 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.model.ArrayDataModel; -import javax.faces.model.DataModel; - -@ManagedBean(name="person") -@SessionScoped -public class PersonBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private static final Person[] personList = new Person[]{ - - new Person("Person", "A", 10), - new Person("Person", "B", 20), - new Person("Person", "C", 30), - new Person("Person", "D", 40), - new Person("Person", "E", 50) - - }; - - /* To get the row numbers, use dataModel instead - public Person[] getPersonList() { - - return personList; - - } - */ - - private DataModel person = new ArrayDataModel(personList); - - public DataModel getPersonList() { - - return person; - - } - - public static class Person{ - - String firstName; - String lastName; - int age; - - public Person(String firstName, String lastName, int age) { - super(); - this.firstName = firstName; - this.lastName = lastName; - this.age = age; - } - - public String getFirstName() { - return firstName; - } - public void setFirstName(String firstName) { - this.firstName = firstName; - } - public String getLastName() { - return lastName; - } - public void setLastName(String lastName) { - this.lastName = lastName; - } - public int getAge() { - return age; - } - public void setAge(int age) { - this.age = age; - } - } +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.model.ArrayDataModel; +import javax.faces.model.DataModel; + +@ManagedBean(name="person") +@SessionScoped +public class PersonBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private static final Person[] personList = new Person[]{ + + new Person("Person", "A", 10), + new Person("Person", "B", 20), + new Person("Person", "C", 30), + new Person("Person", "D", 40), + new Person("Person", "E", 50) + + }; + + /* To get the row numbers, use dataModel instead + public Person[] getPersonList() { + + return personList; + + } + */ + + private DataModel person = new ArrayDataModel(personList); + + public DataModel getPersonList() { + + return person; + + } + + public static class Person{ + + String firstName; + String lastName; + int age; + + public Person(String firstName, String lastName, int age) { + super(); + this.firstName = firstName; + this.lastName = lastName; + this.age = age; + } + + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } + public int getAge() { + return age; + } + public void setAge(int age) { + this.age = age; + } + } } \ No newline at end of file diff --git a/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/default.xhtml b/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/default.xhtml index 9445bf9..d7fa753 100644 --- a/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/default.xhtml +++ b/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/default.xhtml @@ -1,53 +1,53 @@ - - - - - - - - -

Display dataTable row numbers in JSF

- - - - - - No - #{person.personList.rowIndex + 1} - - - - - - First Name - #{p.firstName} - - - - - - Last Name - #{p.lastName} - - - - - - Age - #{p.age} - - - - - -
+ + + + + + + + +

Display dataTable row numbers in JSF

+ + + + + + No + #{person.personList.rowIndex + 1} + + + + + + First Name + #{p.firstName} + + + + + + Last Name + #{p.lastName} + + + + + + Age + #{p.age} + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/resources/css/table-style.css index 74a3ac5..b788b45 100644 --- a/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_37DataTableRowNumbers/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.person-table{ - border-collapse:collapse; -} - -.person-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.person-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.person-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.person-table{ + border-collapse:collapse; +} + +.person-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.person-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.person-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_38RepeatTag/pom.xml b/JavaServerFaces_38RepeatTag/pom.xml index 9e17aa2..432aa4c 100644 --- a/JavaServerFaces_38RepeatTag/pom.xml +++ b/JavaServerFaces_38RepeatTag/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_38RepeatTag - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_38RepeatTag + + \ No newline at end of file diff --git a/JavaServerFaces_38RepeatTag/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_38RepeatTag/src/main/java/com/xxy/OrderBean.java index 853d9da..72b80d8 100644 --- a/JavaServerFaces_38RepeatTag/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_38RepeatTag/src/main/java/com/xxy/OrderBean.java @@ -1,93 +1,93 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private static final ArrayList orderList = - new ArrayList(Arrays.asList( - - new Order("A0001", "Intel CPU", - new BigDecimal("700.00"), 1), - new Order("A0002", "Harddisk 10TB", - new BigDecimal("500.00"), 2), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 8), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 3), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("100.00"), 10) - )); - - public ArrayList getOrderList() { - - return orderList; - - } - - public String deleteAction(Order order) { - - orderList.remove(order); - return null; - } - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public Order(String orderNo, String productName, - BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public String getOrderNo() { - return orderNo; - } - - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public int getQty() { - return qty; - } - - public void setQty(int qty) { - this.qty = qty; - } - - - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private static final ArrayList orderList = + new ArrayList(Arrays.asList( + + new Order("A0001", "Intel CPU", + new BigDecimal("700.00"), 1), + new Order("A0002", "Harddisk 10TB", + new BigDecimal("500.00"), 2), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 8), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 3), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("100.00"), 10) + )); + + public ArrayList getOrderList() { + + return orderList; + + } + + public String deleteAction(Order order) { + + orderList.remove(order); + return null; + } + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public Order(String orderNo, String productName, + BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public int getQty() { + return qty; + } + + public void setQty(int qty) { + this.qty = qty; + } + + + } } \ No newline at end of file diff --git a/JavaServerFaces_38RepeatTag/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_38RepeatTag/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_38RepeatTag/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_38RepeatTag/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_38RepeatTag/src/main/webapp/default.xhtml b/JavaServerFaces_38RepeatTag/src/main/webapp/default.xhtml index d83c71d..2d79850 100644 --- a/JavaServerFaces_38RepeatTag/src/main/webapp/default.xhtml +++ b/JavaServerFaces_38RepeatTag/src/main/webapp/default.xhtml @@ -1,45 +1,45 @@ - - - - - - - - -

JSF 2 ui:repeat tag example

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Order NoProduct NamePriceQuantity
#{o.orderNo}#{o.productName}#{o.price}#{o.qty}
#{o.orderNo}#{o.productName}#{o.price}#{o.qty}
-
+ + + + + + + + +

JSF 2 ui:repeat tag example

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Order NoProduct NamePriceQuantity
#{o.orderNo}#{o.productName}#{o.price}#{o.qty}
#{o.orderNo}#{o.productName}#{o.price}#{o.qty}
+
\ No newline at end of file diff --git a/JavaServerFaces_38RepeatTag/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_38RepeatTag/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_38RepeatTag/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_38RepeatTag/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_39DataTableSorting/pom.xml b/JavaServerFaces_39DataTableSorting/pom.xml index b587d32..ca9e242 100644 --- a/JavaServerFaces_39DataTableSorting/pom.xml +++ b/JavaServerFaces_39DataTableSorting/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_39DataTableSorting - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_39DataTableSorting + + \ No newline at end of file diff --git a/JavaServerFaces_39DataTableSorting/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_39DataTableSorting/src/main/java/com/xxy/OrderBean.java index ce6df51..f1868fb 100644 --- a/JavaServerFaces_39DataTableSorting/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_39DataTableSorting/src/main/java/com/xxy/OrderBean.java @@ -1,135 +1,135 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private List orderArrayList; - - private boolean sortAscending = true; - - private static final Order[] orderList = { - new Order("A0002", "Harddisk 100TB", - new BigDecimal("500.00"), 3), - new Order("A0001", "Intel CPU", - new BigDecimal("4200.00"), 6), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 10), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 9), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("200.00"), 20) - }; - - public OrderBean(){ - - orderArrayList = new ArrayList(Arrays.asList(orderList)); - - } - - public List getOrderList() { - - return orderArrayList; - - } - - //sort by order no - public String sortByOrderNo() { - - if(sortAscending){ - - //ascending order - Collections.sort(orderArrayList, new Comparator() { - - @Override - public int compare(Order o1, Order o2) { - - return o1.getOrderNo().compareTo(o2.getOrderNo()); - - } - - }); - sortAscending = false; - - }else{ - - //descending order - Collections.sort(orderArrayList, new Comparator() { - - @Override - public int compare(Order o1, Order o2) { - - return o2.getOrderNo().compareTo(o1.getOrderNo()); - - } - - }); - sortAscending = true; - } - - return null; - } - - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public Order(String orderNo, String productName, - BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public String getOrderNo() { - return orderNo; - } - - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public int getQty() { - return qty; - } - - public void setQty(int qty) { - this.qty = qty; - } - - - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private List orderArrayList; + + private boolean sortAscending = true; + + private static final Order[] orderList = { + new Order("A0002", "Harddisk 100TB", + new BigDecimal("500.00"), 3), + new Order("A0001", "Intel CPU", + new BigDecimal("4200.00"), 6), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 10), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 9), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("200.00"), 20) + }; + + public OrderBean(){ + + orderArrayList = new ArrayList(Arrays.asList(orderList)); + + } + + public List getOrderList() { + + return orderArrayList; + + } + + //sort by order no + public String sortByOrderNo() { + + if(sortAscending){ + + //ascending order + Collections.sort(orderArrayList, new Comparator() { + + @Override + public int compare(Order o1, Order o2) { + + return o1.getOrderNo().compareTo(o2.getOrderNo()); + + } + + }); + sortAscending = false; + + }else{ + + //descending order + Collections.sort(orderArrayList, new Comparator() { + + @Override + public int compare(Order o1, Order o2) { + + return o2.getOrderNo().compareTo(o1.getOrderNo()); + + } + + }); + sortAscending = true; + } + + return null; + } + + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public Order(String orderNo, String productName, + BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public int getQty() { + return qty; + } + + public void setQty(int qty) { + this.qty = qty; + } + + + } } \ No newline at end of file diff --git a/JavaServerFaces_39DataTableSorting/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_39DataTableSorting/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_39DataTableSorting/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_39DataTableSorting/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_39DataTableSorting/src/main/webapp/default.xhtml b/JavaServerFaces_39DataTableSorting/src/main/webapp/default.xhtml index 16c2686..e99c1a0 100644 --- a/JavaServerFaces_39DataTableSorting/src/main/webapp/default.xhtml +++ b/JavaServerFaces_39DataTableSorting/src/main/webapp/default.xhtml @@ -1,52 +1,52 @@ - - - - - - - - -

JSF 2 dataTable sorting example

- - - - - - - Order No - - - #{o.orderNo} - - - - - Product Name - - #{o.productName} - - - - Price - #{o.price} - - - - Quantity - #{o.qty} - - - - - -
+ + + + + + + + +

JSF 2 dataTable sorting example

+ + + + + + + Order No + + + #{o.orderNo} + + + + + Product Name + + #{o.productName} + + + + Price + #{o.price} + + + + Quantity + #{o.qty} + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_39DataTableSorting/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_39DataTableSorting/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_39DataTableSorting/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_39DataTableSorting/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_40DataTableSortingDataModel/pom.xml b/JavaServerFaces_40DataTableSortingDataModel/pom.xml index be430f6..f480cf4 100644 --- a/JavaServerFaces_40DataTableSortingDataModel/pom.xml +++ b/JavaServerFaces_40DataTableSortingDataModel/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_40DataTableSortingDataModel - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_40DataTableSortingDataModel + + \ No newline at end of file diff --git a/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/OrderBean.java b/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/OrderBean.java index cb21ad2..3dccd46 100644 --- a/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/OrderBean.java +++ b/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/OrderBean.java @@ -1,131 +1,131 @@ -package com.xxy; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Comparator; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.model.ArrayDataModel; -import javax.faces.model.DataModel; - -@ManagedBean(name="order") -@SessionScoped -public class OrderBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private SortableDataModel sotableDataModel; - - private boolean sortAscending = true; - - private static final Order[] orderList = { - new Order("A0002", "Harddisk 100TB", - new BigDecimal("500.00"), 3), - new Order("A0001", "Intel CPU", - new BigDecimal("4200.00"), 6), - new Order("A0004", "Samsung LCD", - new BigDecimal("5200.00"), 10), - new Order("A0003", "Dell Laptop", - new BigDecimal("11600.00"), 9), - new Order("A0005", "A4Tech Mouse", - new BigDecimal("200.00"), 20) - }; - - public OrderBean(){ - - sotableDataModel = new SortableDataModel(new ArrayDataModel(orderList)); - - } - - public DataModel getOrderList() { - - return sotableDataModel; - - } - - //sort by order no - public String sortByOrderNo() { - - if(sortAscending){ - - sotableDataModel.sortBy(new Comparator() { - - @Override - public int compare(Order o1, Order o2) { - - return o1.getOrderNo().compareTo(o2.getOrderNo()); - - } - }); - - sortAscending = false; - - }else{ - - //descending order - sotableDataModel.sortBy(new Comparator() { - - @Override - public int compare(Order o1, Order o2) { - - return o2.getOrderNo().compareTo(o1.getOrderNo()); - - } - }); - sortAscending = true; - } - - return null; - } - - - public static class Order{ - - String orderNo; - String productName; - BigDecimal price; - int qty; - - public Order(String orderNo, String productName, - BigDecimal price, int qty) { - this.orderNo = orderNo; - this.productName = productName; - this.price = price; - this.qty = qty; - } - - public String getOrderNo() { - return orderNo; - } - - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public BigDecimal getPrice() { - return price; - } - - public void setPrice(BigDecimal price) { - this.price = price; - } - - public int getQty() { - return qty; - } - - public void setQty(int qty) { - this.qty = qty; - } - - - } +package com.xxy; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Comparator; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.model.ArrayDataModel; +import javax.faces.model.DataModel; + +@ManagedBean(name="order") +@SessionScoped +public class OrderBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private SortableDataModel sotableDataModel; + + private boolean sortAscending = true; + + private static final Order[] orderList = { + new Order("A0002", "Harddisk 100TB", + new BigDecimal("500.00"), 3), + new Order("A0001", "Intel CPU", + new BigDecimal("4200.00"), 6), + new Order("A0004", "Samsung LCD", + new BigDecimal("5200.00"), 10), + new Order("A0003", "Dell Laptop", + new BigDecimal("11600.00"), 9), + new Order("A0005", "A4Tech Mouse", + new BigDecimal("200.00"), 20) + }; + + public OrderBean(){ + + sotableDataModel = new SortableDataModel(new ArrayDataModel(orderList)); + + } + + public DataModel getOrderList() { + + return sotableDataModel; + + } + + //sort by order no + public String sortByOrderNo() { + + if(sortAscending){ + + sotableDataModel.sortBy(new Comparator() { + + @Override + public int compare(Order o1, Order o2) { + + return o1.getOrderNo().compareTo(o2.getOrderNo()); + + } + }); + + sortAscending = false; + + }else{ + + //descending order + sotableDataModel.sortBy(new Comparator() { + + @Override + public int compare(Order o1, Order o2) { + + return o2.getOrderNo().compareTo(o1.getOrderNo()); + + } + }); + sortAscending = true; + } + + return null; + } + + + public static class Order{ + + String orderNo; + String productName; + BigDecimal price; + int qty; + + public Order(String orderNo, String productName, + BigDecimal price, int qty) { + this.orderNo = orderNo; + this.productName = productName; + this.price = price; + this.qty = qty; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public BigDecimal getPrice() { + return price; + } + + public void setPrice(BigDecimal price) { + this.price = price; + } + + public int getQty() { + return qty; + } + + public void setQty(int qty) { + this.qty = qty; + } + + + } } \ No newline at end of file diff --git a/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/SortableDataModel.java b/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/SortableDataModel.java index bdf353e..3eb9c26 100644 --- a/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/SortableDataModel.java +++ b/JavaServerFaces_40DataTableSortingDataModel/src/main/java/com/xxy/SortableDataModel.java @@ -1,93 +1,93 @@ - -package com.xxy; - -import java.util.Arrays; -import java.util.Comparator; -import javax.faces.model.DataModel; - -public class SortableDataModel extends DataModel{ - - DataModel model; - private Integer[] rows; - - SortableDataModel(DataModel model){ - this.model = model; - initRows(); - } - - public void initRows(){ - int rowCount = model.getRowCount(); - if(rowCount != -1){ - this.rows = new Integer[rowCount]; - for(int i = 0; i < rowCount; ++i){ - rows[i] = i; - } - } - } - - public void sortBy(final Comparator comparator){ - Comparator rowComp = new Comparator() { - public int compare(Integer i1, Integer i2){ - E o1 = getData(i1); - E o2 = getData(i2); - return comparator.compare(o1, o2); - } - }; - Arrays.sort(rows, rowComp); - - } - - private E getData(int row){ - int originalRowIndex = model.getRowIndex(); - - model.setRowIndex(row); - E newRowData = model.getRowData(); - model.setRowIndex(originalRowIndex); - - return newRowData; - } - - @Override - public void setRowIndex(int rowIndex) { - - if(0 <= rowIndex && rowIndex < rows.length){ - model.setRowIndex(rows[rowIndex]); - }else{ - model.setRowIndex(rowIndex); - } - } - - @Override - public boolean isRowAvailable() { - return model.isRowAvailable(); - } - - @Override - public int getRowCount() { - return model.getRowCount(); - } - - @Override - public E getRowData() { - return model.getRowData(); - } - - @Override - public int getRowIndex() { - return model.getRowIndex(); - } - - @Override - public Object getWrappedData() { - return model.getWrappedData(); - } - - @Override - public void setWrappedData(Object data) { - - model.setWrappedData(data); - initRows(); - - } - + +package com.xxy; + +import java.util.Arrays; +import java.util.Comparator; +import javax.faces.model.DataModel; + +public class SortableDataModel extends DataModel{ + + DataModel model; + private Integer[] rows; + + SortableDataModel(DataModel model){ + this.model = model; + initRows(); + } + + public void initRows(){ + int rowCount = model.getRowCount(); + if(rowCount != -1){ + this.rows = new Integer[rowCount]; + for(int i = 0; i < rowCount; ++i){ + rows[i] = i; + } + } + } + + public void sortBy(final Comparator comparator){ + Comparator rowComp = new Comparator() { + public int compare(Integer i1, Integer i2){ + E o1 = getData(i1); + E o2 = getData(i2); + return comparator.compare(o1, o2); + } + }; + Arrays.sort(rows, rowComp); + + } + + private E getData(int row){ + int originalRowIndex = model.getRowIndex(); + + model.setRowIndex(row); + E newRowData = model.getRowData(); + model.setRowIndex(originalRowIndex); + + return newRowData; + } + + @Override + public void setRowIndex(int rowIndex) { + + if(0 <= rowIndex && rowIndex < rows.length){ + model.setRowIndex(rows[rowIndex]); + }else{ + model.setRowIndex(rowIndex); + } + } + + @Override + public boolean isRowAvailable() { + return model.isRowAvailable(); + } + + @Override + public int getRowCount() { + return model.getRowCount(); + } + + @Override + public E getRowData() { + return model.getRowData(); + } + + @Override + public int getRowIndex() { + return model.getRowIndex(); + } + + @Override + public Object getWrappedData() { + return model.getWrappedData(); + } + + @Override + public void setWrappedData(Object data) { + + model.setWrappedData(data); + initRows(); + + } + } \ No newline at end of file diff --git a/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/default.xhtml b/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/default.xhtml index 2171451..63d7fba 100644 --- a/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/default.xhtml +++ b/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/default.xhtml @@ -1,52 +1,52 @@ - - - - - - - - -

JSF 2 dataTable sorting example

- - - - - - - Order No - - - #{o.orderNo} - - - - - Product Name - - #{o.productName} - - - - Price - #{o.price} - - - - Quantity - #{o.qty} - - - - - -
+ + + + + + + + +

JSF 2 dataTable sorting example

+ + + + + + + Order No + + + #{o.orderNo} + + + + + Product Name + + #{o.productName} + + + + Price + #{o.price} + + + + Quantity + #{o.qty} + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_40DataTableSortingDataModel/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/pom.xml b/JavaServerFaces_41FaceletsTemplate/pom.xml index 9d3c036..c1b374e 100644 --- a/JavaServerFaces_41FaceletsTemplate/pom.xml +++ b/JavaServerFaces_41FaceletsTemplate/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_41FaceletsTemplate - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_41FaceletsTemplate + + \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_41FaceletsTemplate/src/main/java/com/xxy/UserBean.java index 056f4d3..976ef2f 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_41FaceletsTemplate/src/main/java/com/xxy/UserBean.java @@ -1,13 +1,13 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - //... - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + //... + } \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/WEB-INF/web.xml index 098e013..ff7ff56 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/WEB-INF/web.xml @@ -1,47 +1,47 @@ - - - - JavaServerFaces - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - + + + + JavaServerFaces + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/default.xhtml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/default.xhtml index 2b73137..db8932f 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/default.xhtml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/default.xhtml @@ -1,17 +1,17 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/page1.xhtml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/page1.xhtml index f54e2bf..a2ca136 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/page1.xhtml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/page1.xhtml @@ -1,24 +1,24 @@ - - - - - - - - -

This is page1 content

-
- - -

This is page1 Footer

-
- -
- -
- + + + + + + + + +

This is page1 content

+
+ + +

This is page1 Footer

+
+ +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/resources/css/common-style.css b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/resources/css/common-style.css index f212e90..dba8019 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/resources/css/common-style.css +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/resources/css/common-style.css @@ -1,25 +1,25 @@ -#page{ - width: 800px; - margin: 0 auto; -} - -#header{ - width: 100%; - height:100px; - border: 1px solid #000; - margin-bottom:16px; -} - -#content{ - width: 100%; - height:200px; - margin-right:16px; - margin-bottom:16px; - border: 1px solid #000; -} - -#footer{ - width: 100%; - height:100px; - border: 1px solid #000; +#page{ + width: 800px; + margin: 0 auto; +} + +#header{ + width: 100%; + height:100px; + border: 1px solid #000; + margin-bottom:16px; +} + +#content{ + width: 100%; + height:200px; + margin-right:16px; + margin-bottom:16px; + border: 1px solid #000; +} + +#footer{ + width: 100%; + height:100px; + border: 1px solid #000; } \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonContent.xhtml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonContent.xhtml index 996ae9d..a34fd0b 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonContent.xhtml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonContent.xhtml @@ -1,16 +1,16 @@ - - - - - - -

This is default content

- -
- - - - + + + + + + +

This is default content

+ +
+ + + + diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonFooter.xhtml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonFooter.xhtml index d5d8263..49fa4d9 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonFooter.xhtml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonFooter.xhtml @@ -1,14 +1,14 @@ - - - - - - -

This is default footer

- -
- + + + + + + +

This is default footer

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonHeader.xhtml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonHeader.xhtml index c69a314..c9c37a7 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonHeader.xhtml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonHeader.xhtml @@ -1,16 +1,16 @@ - - - - - - -

This is default header

- -
- - - - + + + + + + +

This is default header

+ +
+ + + + diff --git a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonLayout.xhtml b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonLayout.xhtml index e0fa1b5..359c133 100644 --- a/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonLayout.xhtml +++ b/JavaServerFaces_41FaceletsTemplate/src/main/webapp/template/common/commonLayout.xhtml @@ -1,39 +1,39 @@ - - - - - - - - - - -
- - - -
- - - -
- - - -
- -
- + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/pom.xml b/JavaServerFaces_42ParameterInTemplate/pom.xml index f45063a..3e35add 100644 --- a/JavaServerFaces_42ParameterInTemplate/pom.xml +++ b/JavaServerFaces_42ParameterInTemplate/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_42ParameterInTemplate - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_42ParameterInTemplate + + \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_42ParameterInTemplate/src/main/java/com/xxy/UserBean.java index 056f4d3..976ef2f 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_42ParameterInTemplate/src/main/java/com/xxy/UserBean.java @@ -1,13 +1,13 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - //... - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + //... + } \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/WEB-INF/web.xml index 098e013..ff7ff56 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/WEB-INF/web.xml @@ -1,47 +1,47 @@ - - - - JavaServerFaces - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - + + + + JavaServerFaces + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/default.xhtml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/default.xhtml index 6bd004b..c77fb82 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/default.xhtml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/default.xhtml @@ -1,18 +1,18 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/page1.xhtml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/page1.xhtml index 7213eee..85ef033 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/page1.xhtml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/page1.xhtml @@ -1,21 +1,21 @@ - - - - - - - - - -

This is page1 content

-
- -
- -
- + + + + + + + + + +

This is page1 content

+
+ +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/resources/css/common-style.css b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/resources/css/common-style.css index bbfb03a..02b7b15 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/resources/css/common-style.css +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/resources/css/common-style.css @@ -1,25 +1,25 @@ -#page{ - width: 800px; - margin: 0 auto; -} - -#header{ - width: 100%; - height:150px; - border: 1px solid #000; - margin-bottom:16px; -} - -#content{ - width: 100%; - height:200px; - margin-right:16px; - margin-bottom:16px; - border: 1px solid #000; -} - -#footer{ - width: 100%; - height:100px; - border: 1px solid #000; +#page{ + width: 800px; + margin: 0 auto; +} + +#header{ + width: 100%; + height:150px; + border: 1px solid #000; + margin-bottom:16px; +} + +#content{ + width: 100%; + height:200px; + margin-right:16px; + margin-bottom:16px; + border: 1px solid #000; +} + +#footer{ + width: 100%; + height:100px; + border: 1px solid #000; } \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonContent.xhtml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonContent.xhtml index 996ae9d..a34fd0b 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonContent.xhtml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonContent.xhtml @@ -1,16 +1,16 @@ - - - - - - -

This is default content

- -
- - - - + + + + + + +

This is default content

+ +
+ + + + diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonFooter.xhtml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonFooter.xhtml index d5d8263..49fa4d9 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonFooter.xhtml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonFooter.xhtml @@ -1,14 +1,14 @@ - - - - - - -

This is default footer

- -
- + + + + + + +

This is default footer

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonHeader.xhtml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonHeader.xhtml index 10c7c2b..d6e846a 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonHeader.xhtml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonHeader.xhtml @@ -1,17 +1,17 @@ - - - - - - -

This is default header

-

Tag Line : #{tagLine}

- -
- - - - + + + + + + +

This is default header

+

Tag Line : #{tagLine}

+ +
+ + + + diff --git a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonLayout.xhtml b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonLayout.xhtml index 2e4ac7d..0c5ec0d 100644 --- a/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonLayout.xhtml +++ b/JavaServerFaces_42ParameterInTemplate/src/main/webapp/template/common/commonLayout.xhtml @@ -1,42 +1,42 @@ - - - - - - - - - - -
- - - -
- Current File : #{curFileName} - - - -
- - - -
- -
- + + + + + + + + + + +
+ + + +
+ Current File : #{curFileName} + + + +
+ + + +
+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/pom.xml b/JavaServerFaces_43CustomTag/pom.xml index b884c66..c735a69 100644 --- a/JavaServerFaces_43CustomTag/pom.xml +++ b/JavaServerFaces_43CustomTag/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_43CustomTag - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_43CustomTag + + \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_43CustomTag/src/main/java/com/xxy/UserBean.java index 056f4d3..976ef2f 100644 --- a/JavaServerFaces_43CustomTag/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_43CustomTag/src/main/java/com/xxy/UserBean.java @@ -1,13 +1,13 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - //... - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + //... + } \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/mkyong.taglib.xml b/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/mkyong.taglib.xml index 6006822..b5003eb 100644 --- a/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/mkyong.taglib.xml +++ b/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/mkyong.taglib.xml @@ -1,11 +1,11 @@ - - - - http://mkyong.com/facelets - - button - tags/com/mkyong/button.xhtml - + + + + http://mkyong.com/facelets + + button + tags/com/mkyong/button.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/tags/com/mkyong/button.xhtml b/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/tags/com/mkyong/button.xhtml index dacb542..5fbdc63 100644 --- a/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/tags/com/mkyong/button.xhtml +++ b/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/tags/com/mkyong/button.xhtml @@ -1,16 +1,16 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/web.xml index f3e4101..db0203f 100644 --- a/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_43CustomTag/src/main/webapp/WEB-INF/web.xml @@ -1,53 +1,53 @@ - - - - JavaServerFaces - - - - facelets.LIBRARIES - /WEB-INF/mkyong.taglib.xml - - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - + + + + JavaServerFaces + + + + facelets.LIBRARIES + /WEB-INF/mkyong.taglib.xml + + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/src/main/webapp/default.xhtml b/JavaServerFaces_43CustomTag/src/main/webapp/default.xhtml index c026a36..4353ba6 100644 --- a/JavaServerFaces_43CustomTag/src/main/webapp/default.xhtml +++ b/JavaServerFaces_43CustomTag/src/main/webapp/default.xhtml @@ -1,18 +1,18 @@ - - - - -

Custome Tags in JSF 2.0

- - - -
- + + + + +

Custome Tags in JSF 2.0

+ + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_43CustomTag/src/main/webapp/resources/css/common-style.css b/JavaServerFaces_43CustomTag/src/main/webapp/resources/css/common-style.css index bbfb03a..02b7b15 100644 --- a/JavaServerFaces_43CustomTag/src/main/webapp/resources/css/common-style.css +++ b/JavaServerFaces_43CustomTag/src/main/webapp/resources/css/common-style.css @@ -1,25 +1,25 @@ -#page{ - width: 800px; - margin: 0 auto; -} - -#header{ - width: 100%; - height:150px; - border: 1px solid #000; - margin-bottom:16px; -} - -#content{ - width: 100%; - height:200px; - margin-right:16px; - margin-bottom:16px; - border: 1px solid #000; -} - -#footer{ - width: 100%; - height:100px; - border: 1px solid #000; +#page{ + width: 800px; + margin: 0 auto; +} + +#header{ + width: 100%; + height:150px; + border: 1px solid #000; + margin-bottom:16px; +} + +#content{ + width: 100%; + height:200px; + margin-right:16px; + margin-bottom:16px; + border: 1px solid #000; +} + +#footer{ + width: 100%; + height:100px; + border: 1px solid #000; } \ No newline at end of file diff --git a/JavaServerFaces_44RemoveTag/pom.xml b/JavaServerFaces_44RemoveTag/pom.xml index 46c629f..46eb12f 100644 --- a/JavaServerFaces_44RemoveTag/pom.xml +++ b/JavaServerFaces_44RemoveTag/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_44RemoveTag - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_44RemoveTag + + \ No newline at end of file diff --git a/JavaServerFaces_44RemoveTag/src/main/java/com/xxy/MessageBean.java b/JavaServerFaces_44RemoveTag/src/main/java/com/xxy/MessageBean.java index ed0a6d0..cef3901 100644 --- a/JavaServerFaces_44RemoveTag/src/main/java/com/xxy/MessageBean.java +++ b/JavaServerFaces_44RemoveTag/src/main/java/com/xxy/MessageBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="msg") -@SessionScoped -public class MessageBean implements Serializable{ - - String buttonLabel = "Submit"; - - public String getButtonLabel() { - return buttonLabel; - } - - public void setButtonLabel(String buttonLabel) { - this.buttonLabel = buttonLabel; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="msg") +@SessionScoped +public class MessageBean implements Serializable{ + + String buttonLabel = "Submit"; + + public String getButtonLabel() { + return buttonLabel; + } + + public void setButtonLabel(String buttonLabel) { + this.buttonLabel = buttonLabel; + } + } \ No newline at end of file diff --git a/JavaServerFaces_44RemoveTag/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_44RemoveTag/src/main/webapp/WEB-INF/web.xml index 1c7de7d..fe08533 100644 --- a/JavaServerFaces_44RemoveTag/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_44RemoveTag/src/main/webapp/WEB-INF/web.xml @@ -1,54 +1,54 @@ - - - - JavaServerFaces - - - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - + + + + JavaServerFaces + + + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + \ No newline at end of file diff --git a/JavaServerFaces_44RemoveTag/src/main/webapp/default.xhtml b/JavaServerFaces_44RemoveTag/src/main/webapp/default.xhtml index 188ec0e..5abef59 100644 --- a/JavaServerFaces_44RemoveTag/src/main/webapp/default.xhtml +++ b/JavaServerFaces_44RemoveTag/src/main/webapp/default.xhtml @@ -1,18 +1,18 @@ - - - - -

How to uses comments in JSF 2.0

- - - - - -
- + + + + +

How to uses comments in JSF 2.0

+ + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_45ConverNumber/pom.xml b/JavaServerFaces_45ConverNumber/pom.xml index 7dc46e3..1ad1b49 100644 --- a/JavaServerFaces_45ConverNumber/pom.xml +++ b/JavaServerFaces_45ConverNumber/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_45ConverNumber - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_45ConverNumber + + \ No newline at end of file diff --git a/JavaServerFaces_45ConverNumber/src/main/java/com/xxy/ReceiptBean.java b/JavaServerFaces_45ConverNumber/src/main/java/com/xxy/ReceiptBean.java index c015c0a..0fbc206 100644 --- a/JavaServerFaces_45ConverNumber/src/main/java/com/xxy/ReceiptBean.java +++ b/JavaServerFaces_45ConverNumber/src/main/java/com/xxy/ReceiptBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="receipt") -@SessionScoped -public class ReceiptBean implements Serializable{ - - double amount; - - public double getAmount() { - return amount; - } - - public void setAmount(double amount) { - this.amount = amount; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="receipt") +@SessionScoped +public class ReceiptBean implements Serializable{ + + double amount; + + public double getAmount() { + return amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } + } \ No newline at end of file diff --git a/JavaServerFaces_45ConverNumber/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_45ConverNumber/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_45ConverNumber/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_45ConverNumber/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_45ConverNumber/src/main/webapp/default.xhtml b/JavaServerFaces_45ConverNumber/src/main/webapp/default.xhtml index 610b07f..1ec3eaf 100644 --- a/JavaServerFaces_45ConverNumber/src/main/webapp/default.xhtml +++ b/JavaServerFaces_45ConverNumber/src/main/webapp/default.xhtml @@ -1,34 +1,34 @@ - - - - - -

JSF 2 convertNumber example

- - - - - - Amount : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 convertNumber example

+ + + + + + Amount : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_45ConverNumber/src/main/webapp/receipt.xhtml b/JavaServerFaces_45ConverNumber/src/main/webapp/receipt.xhtml index 46212ac..1fabf4e 100644 --- a/JavaServerFaces_45ConverNumber/src/main/webapp/receipt.xhtml +++ b/JavaServerFaces_45ConverNumber/src/main/webapp/receipt.xhtml @@ -1,47 +1,47 @@ - - - - - -

JSF 2 convertNumber example

- -
    -
  1. - Amount [minFractionDigits="2"] : - - - -
  2. -
  3. - Amount [pattern="#0.000"] : - - - -
  4. -
  5. - Amount [currencySymbol="$"] : - - - -
  6. -
  7. - Amount [currencyCode="GBP"] : - - - -
  8. -
  9. - Amount [type="percent"] : - - - -
  10. -
- -
+ + + + + +

JSF 2 convertNumber example

+ +
    +
  1. + Amount [minFractionDigits="2"] : + + + +
  2. +
  3. + Amount [pattern="#0.000"] : + + + +
  4. +
  5. + Amount [currencySymbol="$"] : + + + +
  6. +
  7. + Amount [currencyCode="GBP"] : + + + +
  8. +
  9. + Amount [type="percent"] : + + + +
  10. +
+ +
\ No newline at end of file diff --git a/JavaServerFaces_46ConverDateTime/pom.xml b/JavaServerFaces_46ConverDateTime/pom.xml index 8f5b72f..64feb89 100644 --- a/JavaServerFaces_46ConverDateTime/pom.xml +++ b/JavaServerFaces_46ConverDateTime/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_46ConverDateTime - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_46ConverDateTime + + \ No newline at end of file diff --git a/JavaServerFaces_46ConverDateTime/src/main/java/com/xxy/ReceiptBean.java b/JavaServerFaces_46ConverDateTime/src/main/java/com/xxy/ReceiptBean.java index 86b3df4..89b8d11 100644 --- a/JavaServerFaces_46ConverDateTime/src/main/java/com/xxy/ReceiptBean.java +++ b/JavaServerFaces_46ConverDateTime/src/main/java/com/xxy/ReceiptBean.java @@ -1,25 +1,25 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.Date; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="receipt") -@SessionScoped -public class ReceiptBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - Date date; - - public Date getDate() { - return date; - } - - public void setDate(Date date) { - this.date = date; - } - +package com.xxy; + +import java.io.Serializable; +import java.util.Date; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="receipt") +@SessionScoped +public class ReceiptBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + Date date; + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + } \ No newline at end of file diff --git a/JavaServerFaces_46ConverDateTime/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_46ConverDateTime/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_46ConverDateTime/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_46ConverDateTime/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_46ConverDateTime/src/main/webapp/default.xhtml b/JavaServerFaces_46ConverDateTime/src/main/webapp/default.xhtml index 22654f3..978d3f7 100644 --- a/JavaServerFaces_46ConverDateTime/src/main/webapp/default.xhtml +++ b/JavaServerFaces_46ConverDateTime/src/main/webapp/default.xhtml @@ -1,34 +1,34 @@ - - - - - -

JSF 2 convertDate example

- - - - - - Receipt Date : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 convertDate example

+ + + + + + Receipt Date : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_46ConverDateTime/src/main/webapp/receipt.xhtml b/JavaServerFaces_46ConverDateTime/src/main/webapp/receipt.xhtml index 550f4b2..578327f 100644 --- a/JavaServerFaces_46ConverDateTime/src/main/webapp/receipt.xhtml +++ b/JavaServerFaces_46ConverDateTime/src/main/webapp/receipt.xhtml @@ -1,19 +1,19 @@ - - - - - -

JSF 2 convertDate example

- - Receipt Date : - - - - -
+ + + + + +

JSF 2 convertDate example

+ + Receipt Date : + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_47ValidateLength/pom.xml b/JavaServerFaces_47ValidateLength/pom.xml index 934cd75..d9f7b9f 100644 --- a/JavaServerFaces_47ValidateLength/pom.xml +++ b/JavaServerFaces_47ValidateLength/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_47ValidateLength - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_47ValidateLength + + \ No newline at end of file diff --git a/JavaServerFaces_47ValidateLength/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_47ValidateLength/src/main/java/com/xxy/UserBean.java index b42c343..2598ffb 100644 --- a/JavaServerFaces_47ValidateLength/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_47ValidateLength/src/main/java/com/xxy/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - String username; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + String username; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + } \ No newline at end of file diff --git a/JavaServerFaces_47ValidateLength/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_47ValidateLength/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_47ValidateLength/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_47ValidateLength/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_47ValidateLength/src/main/webapp/default.xhtml b/JavaServerFaces_47ValidateLength/src/main/webapp/default.xhtml index c5ec57f..1f907f0 100644 --- a/JavaServerFaces_47ValidateLength/src/main/webapp/default.xhtml +++ b/JavaServerFaces_47ValidateLength/src/main/webapp/default.xhtml @@ -1,34 +1,34 @@ - - - - - -

JSF 2 validateLength example

- - - - - - Enter UserName : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 validateLength example

+ + + + + + Enter UserName : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_47ValidateLength/src/main/webapp/result.xhtml b/JavaServerFaces_47ValidateLength/src/main/webapp/result.xhtml index f48276f..1ac984b 100644 --- a/JavaServerFaces_47ValidateLength/src/main/webapp/result.xhtml +++ b/JavaServerFaces_47ValidateLength/src/main/webapp/result.xhtml @@ -1,17 +1,17 @@ - - - - - -

JSF 2 validateLength example

- - UserName : - - -
+ + + + + +

JSF 2 validateLength example

+ + UserName : + + +
\ No newline at end of file diff --git a/JavaServerFaces_48ValidateLongRange/pom.xml b/JavaServerFaces_48ValidateLongRange/pom.xml index 98b6edc..21429da 100644 --- a/JavaServerFaces_48ValidateLongRange/pom.xml +++ b/JavaServerFaces_48ValidateLongRange/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_48ValidateLongRange - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_48ValidateLongRange + + \ No newline at end of file diff --git a/JavaServerFaces_48ValidateLongRange/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_48ValidateLongRange/src/main/java/com/xxy/UserBean.java index 2cd9e51..93743fa 100644 --- a/JavaServerFaces_48ValidateLongRange/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_48ValidateLongRange/src/main/java/com/xxy/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - int age; - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + int age; + + public int getAge() { + return age; + } + + public void setAge(int age) { + this.age = age; + } + } \ No newline at end of file diff --git a/JavaServerFaces_48ValidateLongRange/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_48ValidateLongRange/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_48ValidateLongRange/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_48ValidateLongRange/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_48ValidateLongRange/src/main/webapp/default.xhtml b/JavaServerFaces_48ValidateLongRange/src/main/webapp/default.xhtml index 4451fce..95c86b0 100644 --- a/JavaServerFaces_48ValidateLongRange/src/main/webapp/default.xhtml +++ b/JavaServerFaces_48ValidateLongRange/src/main/webapp/default.xhtml @@ -1,34 +1,34 @@ - - - - - -

JSF 2 validateLongRange example

- - - - - - Enter your age : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 validateLongRange example

+ + + + + + Enter your age : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_48ValidateLongRange/src/main/webapp/result.xhtml b/JavaServerFaces_48ValidateLongRange/src/main/webapp/result.xhtml index bfa1dce..38ff30f 100644 --- a/JavaServerFaces_48ValidateLongRange/src/main/webapp/result.xhtml +++ b/JavaServerFaces_48ValidateLongRange/src/main/webapp/result.xhtml @@ -1,17 +1,17 @@ - - - - - -

JSF 2 validateLongRange example

- - Age : - - -
+ + + + + +

JSF 2 validateLongRange example

+ + Age : + + +
\ No newline at end of file diff --git a/JavaServerFaces_49ValidateDoubleRange/pom.xml b/JavaServerFaces_49ValidateDoubleRange/pom.xml index f6493ce..416a285 100644 --- a/JavaServerFaces_49ValidateDoubleRange/pom.xml +++ b/JavaServerFaces_49ValidateDoubleRange/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_49ValidateDoubleRange - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_49ValidateDoubleRange + + \ No newline at end of file diff --git a/JavaServerFaces_49ValidateDoubleRange/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_49ValidateDoubleRange/src/main/java/com/xxy/UserBean.java index 471e69d..f11ebcf 100644 --- a/JavaServerFaces_49ValidateDoubleRange/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_49ValidateDoubleRange/src/main/java/com/xxy/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - double salary; - - public double getSalary() { - return salary; - } - - public void setSalary(double salary) { - this.salary = salary; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + double salary; + + public double getSalary() { + return salary; + } + + public void setSalary(double salary) { + this.salary = salary; + } + } \ No newline at end of file diff --git a/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/default.xhtml b/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/default.xhtml index a043c0f..a03f77e 100644 --- a/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/default.xhtml +++ b/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/default.xhtml @@ -1,35 +1,35 @@ - - - - - -

JSF 2 validateDoubleRange example

- - - - - - Enter your salary : - - - - - - - - - - - - - - - -
+ + + + + +

JSF 2 validateDoubleRange example

+ + + + + + Enter your salary : + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/result.xhtml b/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/result.xhtml index 818ee4a..c91cec8 100644 --- a/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/result.xhtml +++ b/JavaServerFaces_49ValidateDoubleRange/src/main/webapp/result.xhtml @@ -1,17 +1,17 @@ - - - - - -

JSF 2 validateDoubleRange example

- - Salary : - - -
+ + + + + +

JSF 2 validateDoubleRange example

+ + Salary : + + +
\ No newline at end of file diff --git a/JavaServerFaces_50ValidateRequired/pom.xml b/JavaServerFaces_50ValidateRequired/pom.xml index 0b1c6a7..e5861a7 100644 --- a/JavaServerFaces_50ValidateRequired/pom.xml +++ b/JavaServerFaces_50ValidateRequired/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_50ValidateRequired - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_50ValidateRequired + + \ No newline at end of file diff --git a/JavaServerFaces_50ValidateRequired/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_50ValidateRequired/src/main/java/com/xxy/UserBean.java index 70be705..a0c0cd5 100644 --- a/JavaServerFaces_50ValidateRequired/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_50ValidateRequired/src/main/java/com/xxy/UserBean.java @@ -1,27 +1,27 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - String password; - String confPassword; - - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getConfPassword() { - return confPassword; - } - public void setConfPassword(String confPassword) { - this.confPassword = confPassword; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + String password; + String confPassword; + + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + public String getConfPassword() { + return confPassword; + } + public void setConfPassword(String confPassword) { + this.confPassword = confPassword; + } + } \ No newline at end of file diff --git a/JavaServerFaces_50ValidateRequired/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_50ValidateRequired/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_50ValidateRequired/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_50ValidateRequired/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_50ValidateRequired/src/main/webapp/default.xhtml b/JavaServerFaces_50ValidateRequired/src/main/webapp/default.xhtml index 2ef4735..1cb50d4 100644 --- a/JavaServerFaces_50ValidateRequired/src/main/webapp/default.xhtml +++ b/JavaServerFaces_50ValidateRequired/src/main/webapp/default.xhtml @@ -1,41 +1,41 @@ - - - - - -

JSF 2 validateRequired example

- - - - - - Enter your password : - - - - - - Enter your password again : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 validateRequired example

+ + + + + + Enter your password : + + + + + + Enter your password again : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_50ValidateRequired/src/main/webapp/result.xhtml b/JavaServerFaces_50ValidateRequired/src/main/webapp/result.xhtml index f160840..dd4d272 100644 --- a/JavaServerFaces_50ValidateRequired/src/main/webapp/result.xhtml +++ b/JavaServerFaces_50ValidateRequired/src/main/webapp/result.xhtml @@ -1,24 +1,24 @@ - - - - - -

JSF 2 validateRequired example

- - - - Password : - - - Confirm Password : - - - - -
+ + + + + +

JSF 2 validateRequired example

+ + + + Password : + + + Confirm Password : + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_51ValidateRegex/pom.xml b/JavaServerFaces_51ValidateRegex/pom.xml index 141f661..970b343 100644 --- a/JavaServerFaces_51ValidateRegex/pom.xml +++ b/JavaServerFaces_51ValidateRegex/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_51ValidateRegex - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_51ValidateRegex + + \ No newline at end of file diff --git a/JavaServerFaces_51ValidateRegex/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_51ValidateRegex/src/main/java/com/xxy/UserBean.java index 8229780..08f868e 100644 --- a/JavaServerFaces_51ValidateRegex/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_51ValidateRegex/src/main/java/com/xxy/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - String password; - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + String password; + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + } \ No newline at end of file diff --git a/JavaServerFaces_51ValidateRegex/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_51ValidateRegex/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_51ValidateRegex/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_51ValidateRegex/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_51ValidateRegex/src/main/webapp/default.xhtml b/JavaServerFaces_51ValidateRegex/src/main/webapp/default.xhtml index bde5d8a..76202ba 100644 --- a/JavaServerFaces_51ValidateRegex/src/main/webapp/default.xhtml +++ b/JavaServerFaces_51ValidateRegex/src/main/webapp/default.xhtml @@ -1,33 +1,33 @@ - - - - - -

JSF 2 validateRegex example

- - - - - - Enter your password : - - - - - - - - - - - - - -
+ + + + + +

JSF 2 validateRegex example

+ + + + + + Enter your password : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_51ValidateRegex/src/main/webapp/result.xhtml b/JavaServerFaces_51ValidateRegex/src/main/webapp/result.xhtml index 837c55b..ad8124b 100644 --- a/JavaServerFaces_51ValidateRegex/src/main/webapp/result.xhtml +++ b/JavaServerFaces_51ValidateRegex/src/main/webapp/result.xhtml @@ -1,21 +1,21 @@ - - - - - -

JSF 2 validateRegex example

- - - - Password : - - - - -
+ + + + + +

JSF 2 validateRegex example

+ + + + Password : + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/JavaServerFaces_52CustomValidation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..3d80321 --- /dev/null +++ b/JavaServerFaces_52CustomValidation/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,2 @@ + + diff --git a/JavaServerFaces_52CustomValidation/pom.xml b/JavaServerFaces_52CustomValidation/pom.xml index fae1cd9..541f0b1 100644 --- a/JavaServerFaces_52CustomValidation/pom.xml +++ b/JavaServerFaces_52CustomValidation/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_52CustomValidation - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_52CustomValidation + war + \ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_52CustomValidation/src/main/java/com/xxy/UserBean.java index 52db7e6..3f22fcc 100644 --- a/JavaServerFaces_52CustomValidation/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_52CustomValidation/src/main/java/com/xxy/UserBean.java @@ -1,29 +1,29 @@ -package com.xxy; - -import java.io.Serializable; -import java.sql.Date; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - String username; - Date dob; - - public String getUsername() { - return username; - } - public void setUsername(String username) { - this.username = username; - } - public Date getDob() { - return dob; - } - public void setDob(Date dob) { - this.dob = dob; - } - +package com.xxy; + +import java.io.Serializable; +import java.sql.Date; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + String username; + Date dob; + + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public Date getDob() { + return dob; + } + public void setDob(Date dob) { + this.dob = dob; + } + } \ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/src/main/resources/com/mkyong/MyMessage.properties b/JavaServerFaces_52CustomValidation/src/main/resources/com/mkyong/MyMessage.properties index 736b34c..320e796 100644 --- a/JavaServerFaces_52CustomValidation/src/main/resources/com/mkyong/MyMessage.properties +++ b/JavaServerFaces_52CustomValidation/src/main/resources/com/mkyong/MyMessage.properties @@ -1,4 +1,4 @@ -javax.faces.converter.DateTimeConverter.DATE={2}: ''{0}'' could not be understood as a date. -javax.faces.converter.DateTimeConverter.DATE_detail=Invalid date format. - +javax.faces.converter.DateTimeConverter.DATE={2}: ''{0}'' could not be understood as a date. +javax.faces.converter.DateTimeConverter.DATE_detail=Invalid date format. + javax.faces.validator.LengthValidator.MINIMUM=Minimum length of ''{0}'' is required. \ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/faces-config.xml index 877762e..51c383a 100644 --- a/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/faces-config.xml @@ -1,13 +1,13 @@ - - - - - com.xxy.MyMessage - - + + + + + com.mkyong.MyMessage + + \ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_52CustomValidation/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/src/main/webapp/default.xhtml b/JavaServerFaces_52CustomValidation/src/main/webapp/default.xhtml index 9a5878e..c41eb6f 100644 --- a/JavaServerFaces_52CustomValidation/src/main/webapp/default.xhtml +++ b/JavaServerFaces_52CustomValidation/src/main/webapp/default.xhtml @@ -1,42 +1,42 @@ - - - - - -

Customize validation error message in JSF 2.0

- - - - - - Enter your username : - - - - - - - - Enter your DOB : - - - - - - - - - - - - - - -
+ + + + + +

Customize validation error message in JSF 2.0

+ + + + + + Enter your username : + + + + + + + + Enter your DOB : + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_52CustomValidation/src/main/webapp/result.xhtml b/JavaServerFaces_52CustomValidation/src/main/webapp/result.xhtml index 233f159..452a3ca 100644 --- a/JavaServerFaces_52CustomValidation/src/main/webapp/result.xhtml +++ b/JavaServerFaces_52CustomValidation/src/main/webapp/result.xhtml @@ -1,24 +1,24 @@ - - - - - -

Customize validation error message in JSF 2.0

- - - - Username : - - - D.O.B : - - - - -
+ + + + + +

Customize validation error message in JSF 2.0

+ + + + Username : + + + D.O.B : + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/pom.xml b/JavaServerFaces_53CustomConverter/pom.xml index 0bce4f6..0cfab81 100644 --- a/JavaServerFaces_53CustomConverter/pom.xml +++ b/JavaServerFaces_53CustomConverter/pom.xml @@ -1,27 +1,27 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_53CustomConverter - - - commons-validator - commons-validator - 1.3.1 - - - - oro - oro - 2.0.8 - - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_53CustomConverter + + + commons-validator + commons-validator + 1.3.1 + + + + oro + oro + 2.0.8 + + + \ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLBookmark.java b/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLBookmark.java index 4b89c11..37ee743 100644 --- a/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLBookmark.java +++ b/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLBookmark.java @@ -1,23 +1,23 @@ -package com.xxy; - -public class URLBookmark{ - - String fullURL; - - public URLBookmark(String fullURL) { - this.fullURL = fullURL; - } - - public String getFullURL() { - return fullURL; - } - - public void setFullURL(String fullURL) { - this.fullURL = fullURL; - } - - public String toString(){ - return fullURL; - } - +package com.xxy; + +public class URLBookmark{ + + String fullURL; + + public URLBookmark(String fullURL) { + this.fullURL = fullURL; + } + + public String getFullURL() { + return fullURL; + } + + public void setFullURL(String fullURL) { + this.fullURL = fullURL; + } + + public String toString(){ + return fullURL; + } + } \ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLConverter.java b/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLConverter.java index 0c4b1bc..bc2ac0a 100644 --- a/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLConverter.java +++ b/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/URLConverter.java @@ -1,55 +1,55 @@ -package com.xxy; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.convert.Converter; -import javax.faces.convert.ConverterException; -import javax.faces.convert.FacesConverter; - -import com.xxy.URLBookmark; -import org.apache.commons.validator.UrlValidator; - -@FacesConverter("com.xxy.URLConverter") -public class URLConverter implements Converter{ - - @Override - public Object getAsObject(FacesContext context, UIComponent component, - String value) { - - String HTTP = "http://"; - StringBuilder url = new StringBuilder(); - - //if not start with http://, then add it - if(!value.startsWith(HTTP, 0)){ - url.append(HTTP); - } - url.append(value); - - //use Apache common URL validator to validate URL - UrlValidator urlValidator = new UrlValidator(); - //if URL is invalid - if(!urlValidator.isValid(url.toString())){ - - FacesMessage msg = - new FacesMessage("URL Conversion error.", - "Invalid URL format."); - msg.setSeverity(FacesMessage.SEVERITY_ERROR); - throw new ConverterException(msg); - } - - URLBookmark urlBookmark = new URLBookmark(url.toString()); - - return urlBookmark; - } - - @Override - public String getAsString(FacesContext context, UIComponent component, - Object value) { - - return value.toString(); - - } - - +package com.xxy; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.convert.ConverterException; +import javax.faces.convert.FacesConverter; + +import com.xxy.URLBookmark; +import org.apache.commons.validator.UrlValidator; + +@FacesConverter("com.xxy.URLConverter") +public class URLConverter implements Converter{ + + @Override + public Object getAsObject(FacesContext context, UIComponent component, + String value) { + + String HTTP = "http://"; + StringBuilder url = new StringBuilder(); + + //if not start with http://, then add it + if(!value.startsWith(HTTP, 0)){ + url.append(HTTP); + } + url.append(value); + + //use Apache common URL validator to validate URL + UrlValidator urlValidator = new UrlValidator(); + //if URL is invalid + if(!urlValidator.isValid(url.toString())){ + + FacesMessage msg = + new FacesMessage("URL Conversion error.", + "Invalid URL format."); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + throw new ConverterException(msg); + } + + URLBookmark urlBookmark = new URLBookmark(url.toString()); + + return urlBookmark; + } + + @Override + public String getAsString(FacesContext context, UIComponent component, + Object value) { + + return value.toString(); + + } + + } \ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/UserBean.java index 6c88d4d..63b1d1b 100644 --- a/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_53CustomConverter/src/main/java/com/xxy/UserBean.java @@ -1,21 +1,21 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - String bookmarkURL; - - public String getBookmarkURL() { - return bookmarkURL; - } - - public void setBookmarkURL(String bookmarkURL) { - this.bookmarkURL = bookmarkURL; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + String bookmarkURL; + + public String getBookmarkURL() { + return bookmarkURL; + } + + public void setBookmarkURL(String bookmarkURL) { + this.bookmarkURL = bookmarkURL; + } + } \ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_53CustomConverter/src/main/webapp/WEB-INF/web.xml index db6a861..605906b 100644 --- a/JavaServerFaces_53CustomConverter/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_53CustomConverter/src/main/webapp/WEB-INF/web.xml @@ -1,44 +1,44 @@ - - - JavaServerFaces - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 - javax.faces.STATE_SAVING_METHOD - client - - - javax.servlet.jsp.jstl.fmt.localizationContext - resources.application - - - com.sun.faces.config.ConfigureListener - + + + JavaServerFaces + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 + javax.faces.STATE_SAVING_METHOD + client + + + javax.servlet.jsp.jstl.fmt.localizationContext + resources.application + + + com.sun.faces.config.ConfigureListener + \ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/src/main/webapp/default.xhtml b/JavaServerFaces_53CustomConverter/src/main/webapp/default.xhtml index 95cf190..aa1a6b1 100644 --- a/JavaServerFaces_53CustomConverter/src/main/webapp/default.xhtml +++ b/JavaServerFaces_53CustomConverter/src/main/webapp/default.xhtml @@ -1,32 +1,32 @@ - - - - - -

Custom converter in JSF 2.0

- - - - - - Enter your bookmark URL : - - - - - - - - - - - - - -
+ + + + + +

Custom converter in JSF 2.0

+ + + + + + Enter your bookmark URL : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_53CustomConverter/src/main/webapp/result.xhtml b/JavaServerFaces_53CustomConverter/src/main/webapp/result.xhtml index 47f1263..ce9c462 100644 --- a/JavaServerFaces_53CustomConverter/src/main/webapp/result.xhtml +++ b/JavaServerFaces_53CustomConverter/src/main/webapp/result.xhtml @@ -1,21 +1,21 @@ - - - - - -

Custom converter in JSF 2.0

- - - - Bookmark URL : - - - - -
+ + + + + +

Custom converter in JSF 2.0

+ + + + Bookmark URL : + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_54CustomValidator/pom.xml b/JavaServerFaces_54CustomValidator/pom.xml index c80e26c..68ecdbe 100644 --- a/JavaServerFaces_54CustomValidator/pom.xml +++ b/JavaServerFaces_54CustomValidator/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_54CustomValidator - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_54CustomValidator + + \ No newline at end of file diff --git a/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/EmailValidator.java b/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/EmailValidator.java index b0c6255..2989849 100644 --- a/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/EmailValidator.java +++ b/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/EmailValidator.java @@ -1,44 +1,44 @@ -package com.xxy; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; - -@FacesValidator("com.xxy.EmailValidator") -public class EmailValidator implements Validator{ - - private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\." + - "[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*" + - "(\\.[A-Za-z]{2,})$"; - - private Pattern pattern; - private Matcher matcher; - - public EmailValidator(){ - pattern = Pattern.compile(EMAIL_PATTERN); - } - - @Override - public void validate(FacesContext context, UIComponent component, - Object value) throws ValidatorException { - - matcher = pattern.matcher(value.toString()); - if(!matcher.matches()){ - - FacesMessage msg = - new FacesMessage("E-mail validation failed.", - "Invalid E-mail format."); - msg.setSeverity(FacesMessage.SEVERITY_ERROR); - throw new ValidatorException(msg); - - } - - } - +package com.xxy; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +@FacesValidator("com.xxy.EmailValidator") +public class EmailValidator implements Validator{ + + private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\." + + "[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*" + + "(\\.[A-Za-z]{2,})$"; + + private Pattern pattern; + private Matcher matcher; + + public EmailValidator(){ + pattern = Pattern.compile(EMAIL_PATTERN); + } + + @Override + public void validate(FacesContext context, UIComponent component, + Object value) throws ValidatorException { + + matcher = pattern.matcher(value.toString()); + if(!matcher.matches()){ + + FacesMessage msg = + new FacesMessage("E-mail validation failed.", + "Invalid E-mail format."); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + throw new ValidatorException(msg); + + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/UserBean.java index 0a34f6b..c1f054d 100644 --- a/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_54CustomValidator/src/main/java/com/xxy/UserBean.java @@ -1,23 +1,23 @@ -package com.xxy; - -import java.io.Serializable; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - String email; - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - +package com.xxy; + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + String email; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + } \ No newline at end of file diff --git a/JavaServerFaces_54CustomValidator/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_54CustomValidator/src/main/webapp/WEB-INF/web.xml index d8b1311..c98746c 100644 --- a/JavaServerFaces_54CustomValidator/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_54CustomValidator/src/main/webapp/WEB-INF/web.xml @@ -1,47 +1,47 @@ - - - - JavaServerFaces - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - - + + + + JavaServerFaces + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + + diff --git a/JavaServerFaces_54CustomValidator/src/main/webapp/default.xhtml b/JavaServerFaces_54CustomValidator/src/main/webapp/default.xhtml index 4bc9195..d1e53db 100644 --- a/JavaServerFaces_54CustomValidator/src/main/webapp/default.xhtml +++ b/JavaServerFaces_54CustomValidator/src/main/webapp/default.xhtml @@ -1,32 +1,32 @@ - - - - - -

Custom validator in JSF 2.0

- - - - - - Enter your email : - - - - - - - - - - - - - -
+ + + + + +

Custom validator in JSF 2.0

+ + + + + + Enter your email : + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_54CustomValidator/src/main/webapp/result.xhtml b/JavaServerFaces_54CustomValidator/src/main/webapp/result.xhtml index 5fef859..d94d9ca 100644 --- a/JavaServerFaces_54CustomValidator/src/main/webapp/result.xhtml +++ b/JavaServerFaces_54CustomValidator/src/main/webapp/result.xhtml @@ -1,19 +1,19 @@ - - - - - -

Custom validator in JSF 2.0

- - - - Email Address : - - - - -
+ + + + + +

Custom validator in JSF 2.0

+ + + + Email Address : + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_55ValidatorMultipleComponents/pom.xml b/JavaServerFaces_55ValidatorMultipleComponents/pom.xml index 56be518..fdf5a04 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/pom.xml +++ b/JavaServerFaces_55ValidatorMultipleComponents/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_55ValidatorMultipleComponents - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_55ValidatorMultipleComponents + + \ No newline at end of file diff --git a/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java b/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java index d3b6544..d9edbf9 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java +++ b/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java @@ -1,39 +1,39 @@ -package com.xxy; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; - -@FacesValidator("passwordValidator") -public class PasswordValidator implements Validator { - - @Override - public void validate(FacesContext context, UIComponent component, - Object value) throws ValidatorException { - - String password = value.toString(); - - UIInput uiInputConfirmPassword = (UIInput) component.getAttributes() - .get("confirmPassword"); - String confirmPassword = uiInputConfirmPassword.getSubmittedValue() - .toString(); - - // Let required="true" do its job. - if (password == null || password.isEmpty() || confirmPassword == null - || confirmPassword.isEmpty()) { - return; - } - - if (!password.equals(confirmPassword)) { - uiInputConfirmPassword.setValid(false); - throw new ValidatorException(new FacesMessage( - "Password must match confirm password.")); - } - - } - +package com.xxy; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.component.UIInput; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +@FacesValidator("passwordValidator") +public class PasswordValidator implements Validator { + + @Override + public void validate(FacesContext context, UIComponent component, + Object value) throws ValidatorException { + + String password = value.toString(); + + UIInput uiInputConfirmPassword = (UIInput) component.getAttributes() + .get("confirmPassword"); + String confirmPassword = uiInputConfirmPassword.getSubmittedValue() + .toString(); + + // Let required="true" do its job. + if (password == null || password.isEmpty() || confirmPassword == null + || confirmPassword.isEmpty()) { + return; + } + + if (!password.equals(confirmPassword)) { + uiInputConfirmPassword.setValid(false); + throw new ValidatorException(new FacesMessage( + "Password must match confirm password.")); + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java index 7d46759..0daf7f9 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_55ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java @@ -1,71 +1,71 @@ -package com.xxy; - -import javax.faces.application.FacesMessage; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.context.FacesContext; -import javax.faces.event.ComponentSystemEvent; - -@ManagedBean(name = "user") -@SessionScoped -public class UserBean { - - public String username; - public String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public void validatePassword(ComponentSystemEvent event) { - - FacesContext fc = FacesContext.getCurrentInstance(); - - UIComponent components = event.getComponent(); - - // get password - UIInput uiInputPassword = (UIInput) components - .findComponent("password"); - - String password = uiInputPassword.getLocalValue() == null ? "" - : uiInputPassword.getLocalValue().toString(); - - String passwordId = uiInputPassword.getClientId(); - - // get confirm password - UIInput uiInputConfirmPassword = (UIInput) components - .findComponent("confirmPassword"); - String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? "" - : uiInputConfirmPassword.getLocalValue().toString(); - - // Let required="true" do its job. - if (password.isEmpty() || confirmPassword.isEmpty()) { - return; - } - - if (!password.equals(confirmPassword)) { - - FacesMessage msg = new FacesMessage( - "Password must match confirm password"); - msg.setSeverity(FacesMessage.SEVERITY_ERROR); - fc.addMessage(passwordId, msg); - fc.renderResponse(); - } - - } - +package com.xxy; + +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.component.UIComponent; +import javax.faces.component.UIInput; +import javax.faces.context.FacesContext; +import javax.faces.event.ComponentSystemEvent; + +@ManagedBean(name = "user") +@SessionScoped +public class UserBean { + + public String username; + public String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public void validatePassword(ComponentSystemEvent event) { + + FacesContext fc = FacesContext.getCurrentInstance(); + + UIComponent components = event.getComponent(); + + // get password + UIInput uiInputPassword = (UIInput) components + .findComponent("password"); + + String password = uiInputPassword.getLocalValue() == null ? "" + : uiInputPassword.getLocalValue().toString(); + + String passwordId = uiInputPassword.getClientId(); + + // get confirm password + UIInput uiInputConfirmPassword = (UIInput) components + .findComponent("confirmPassword"); + String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? "" + : uiInputConfirmPassword.getLocalValue().toString(); + + // Let required="true" do its job. + if (password.isEmpty() || confirmPassword.isEmpty()) { + return; + } + + if (!password.equals(confirmPassword)) { + + FacesMessage msg = new FacesMessage( + "Password must match confirm password"); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + fc.addMessage(passwordId, msg); + fc.renderResponse(); + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml index 1736ff1..043882d 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml @@ -1,31 +1,31 @@ - - - - JavaServerFaces - - - - javax.faces.PROJECT_STAGE - Development - - - - - default.jsf - - - - facesServlet - javax.faces.webapp.FacesServlet - 1 - - - facesServlet - *.jsf - - - + + + + JavaServerFaces + + + + javax.faces.PROJECT_STAGE + Development + + + + + default.jsf + + + + facesServlet + javax.faces.webapp.FacesServlet + 1 + + + facesServlet + *.jsf + + + diff --git a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default.xhtml b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default.xhtml index 41783bd..bcabda3 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default.xhtml +++ b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default.xhtml @@ -1,41 +1,41 @@ - - - - - -

Multiple-Components Validator in JSF 2.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + + + +

Multiple-Components Validator in JSF 2.0

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default1.xhtml b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default1.xhtml index ff71c17..a65d573 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default1.xhtml +++ b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/default1.xhtml @@ -1,43 +1,43 @@ - - - - - -

Multiple-Components Validator in JSF 2.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + + + +

Multiple-Components Validator in JSF 2.0

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/thanks.xhtml b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/thanks.xhtml index 4d63144..12a2f23 100644 --- a/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/thanks.xhtml +++ b/JavaServerFaces_55ValidatorMultipleComponents/src/main/webapp/thanks.xhtml @@ -1,10 +1,10 @@ - - - - -

Thanks for register

- -
+ + + + +

Thanks for register

+ +
\ No newline at end of file diff --git a/JavaServerFaces_56CompositeComponents/pom.xml b/JavaServerFaces_56CompositeComponents/pom.xml index c9d0372..7d94c20 100644 --- a/JavaServerFaces_56CompositeComponents/pom.xml +++ b/JavaServerFaces_56CompositeComponents/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_56CompositeComponents - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_56CompositeComponents + + \ No newline at end of file diff --git a/JavaServerFaces_56CompositeComponents/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_56CompositeComponents/src/main/java/com/xxy/UserBean.java index 996359e..a9332bf 100644 --- a/JavaServerFaces_56CompositeComponents/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_56CompositeComponents/src/main/java/com/xxy/UserBean.java @@ -1,29 +1,29 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public String name; - public String email; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - - public String registerAction(){ - return "result"; - } +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public String name; + public String email; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + + public String registerAction(){ + return "result"; + } } \ No newline at end of file diff --git a/JavaServerFaces_56CompositeComponents/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_56CompositeComponents/src/main/webapp/WEB-INF/web.xml index 9ba68a8..b62f56b 100644 --- a/JavaServerFaces_56CompositeComponents/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_56CompositeComponents/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_56CompositeComponents - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_56CompositeComponents + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_56CompositeComponents/src/main/webapp/default.xhtml b/JavaServerFaces_56CompositeComponents/src/main/webapp/default.xhtml index 189575d..bde7c54 100644 --- a/JavaServerFaces_56CompositeComponents/src/main/webapp/default.xhtml +++ b/JavaServerFaces_56CompositeComponents/src/main/webapp/default.xhtml @@ -1,25 +1,25 @@ - - - - - - -

Composite Components in JSF 2.0

- - - -
- + + + + + + +

Composite Components in JSF 2.0

+ + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_56CompositeComponents/src/main/webapp/resources/mkyong/register.xhtml b/JavaServerFaces_56CompositeComponents/src/main/webapp/resources/mkyong/register.xhtml index 38b02ca..0e061fe 100644 --- a/JavaServerFaces_56CompositeComponents/src/main/webapp/resources/mkyong/register.xhtml +++ b/JavaServerFaces_56CompositeComponents/src/main/webapp/resources/mkyong/register.xhtml @@ -1,47 +1,47 @@ - - - - - - - - - - - - - - - - - - - - - - - - - #{cc.attrs.nameLable} : - - - #{cc.attrs.emailLable} : - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + #{cc.attrs.nameLable} : + + + #{cc.attrs.emailLable} : + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_56CompositeComponents/src/main/webapp/result.xhtml b/JavaServerFaces_56CompositeComponents/src/main/webapp/result.xhtml index 82fb447..be17040 100644 --- a/JavaServerFaces_56CompositeComponents/src/main/webapp/result.xhtml +++ b/JavaServerFaces_56CompositeComponents/src/main/webapp/result.xhtml @@ -1,20 +1,20 @@ - - - - - - -

Composite Components in JSF 2.0

- - Name : #{user.name} - -
- - E-mail : #{user.email} - -
- + + + + + + +

Composite Components in JSF 2.0

+ + Name : #{user.name} + +
+ + E-mail : #{user.email} + +
+ \ No newline at end of file diff --git a/JavaServerFaces_57ValueChangeListener/pom.xml b/JavaServerFaces_57ValueChangeListener/pom.xml index ecb46b4..b89fc79 100644 --- a/JavaServerFaces_57ValueChangeListener/pom.xml +++ b/JavaServerFaces_57ValueChangeListener/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_57ValueChangeListener - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_57ValueChangeListener + + \ No newline at end of file diff --git a/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryBean.java b/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryBean.java index 89db276..6270931 100644 --- a/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryBean.java +++ b/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryBean.java @@ -1,46 +1,46 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.event.ValueChangeEvent; - -@ManagedBean(name="country") -@SessionScoped -public class CountryBean implements Serializable{ - - private static final long serialVersionUID = 1L; - - private static Map countries; - - private String localeCode = "en"; //default value - - static{ - countries = new LinkedHashMap(); - countries.put("United Kingdom", "en"); //label, value - countries.put("French", "fr"); - countries.put("German", "de"); - countries.put("China", "zh_CN"); - } - - public void countryLocaleCodeChanged(ValueChangeEvent e){ - //assign new value to localeCode - localeCode = e.getNewValue().toString(); - - } - - public Map getCountryInMap() { - return this.countries; - } - - public String getLocaleCode() { - return localeCode; - } - - public void setLocaleCode(String localeCode) { - this.localeCode = localeCode; - } - +package com.xxy; + +import java.io.Serializable; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.event.ValueChangeEvent; + +@ManagedBean(name="country") +@SessionScoped +public class CountryBean implements Serializable{ + + private static final long serialVersionUID = 1L; + + private static Map countries; + + private String localeCode = "en"; //default value + + static{ + countries = new LinkedHashMap(); + countries.put("United Kingdom", "en"); //label, value + countries.put("French", "fr"); + countries.put("German", "de"); + countries.put("China", "zh_CN"); + } + + public void countryLocaleCodeChanged(ValueChangeEvent e){ + //assign new value to localeCode + localeCode = e.getNewValue().toString(); + + } + + public Map getCountryInMap() { + return this.countries; + } + + public String getLocaleCode() { + return localeCode; + } + + public void setLocaleCode(String localeCode) { + this.localeCode = localeCode; + } + } \ No newline at end of file diff --git a/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryValueListener.java b/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryValueListener.java index 2b0b30b..462bfa5 100644 --- a/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryValueListener.java +++ b/JavaServerFaces_57ValueChangeListener/src/main/java/com/xxy/CountryValueListener.java @@ -1,25 +1,25 @@ -package com.xxy; - -import com.xxy.CountryBean; - -import javax.faces.context.FacesContext; -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ValueChangeEvent; -import javax.faces.event.ValueChangeListener; - -public class CountryValueListener implements ValueChangeListener{ - - @Override - public void processValueChange(ValueChangeEvent event) - throws AbortProcessingException { - - //access country bean directly - CountryBean country = (CountryBean) FacesContext.getCurrentInstance(). - getExternalContext().getSessionMap().get("country"); - - country.setLocaleCode(event.getNewValue().toString()); - - } - - +package com.xxy; + +import com.xxy.CountryBean; + +import javax.faces.context.FacesContext; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ValueChangeEvent; +import javax.faces.event.ValueChangeListener; + +public class CountryValueListener implements ValueChangeListener{ + + @Override + public void processValueChange(ValueChangeEvent event) + throws AbortProcessingException { + + //access country bean directly + CountryBean country = (CountryBean) FacesContext.getCurrentInstance(). + getExternalContext().getSessionMap().get("country"); + + country.setLocaleCode(event.getNewValue().toString()); + + } + + } \ No newline at end of file diff --git a/JavaServerFaces_57ValueChangeListener/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_57ValueChangeListener/src/main/webapp/WEB-INF/web.xml index 9ca14df..718b49b 100644 --- a/JavaServerFaces_57ValueChangeListener/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_57ValueChangeListener/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_57ValueChangeListener - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_57ValueChangeListener + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_57ValueChangeListener/src/main/webapp/default.xhtml b/JavaServerFaces_57ValueChangeListener/src/main/webapp/default.xhtml index c452ee8..9943d70 100644 --- a/JavaServerFaces_57ValueChangeListener/src/main/webapp/default.xhtml +++ b/JavaServerFaces_57ValueChangeListener/src/main/webapp/default.xhtml @@ -1,40 +1,40 @@ - - - - - -

JSF 2 valueChangeListener example

- - - - - - Selected country locale : - - - Select a country {method binding}: - - - - - - - Select a country {ValueChangeListener class}: - - - - - - - - - - -
+ + + + + +

JSF 2 valueChangeListener example

+ + + + + + Selected country locale : + + + Select a country {method binding}: + + + + + + + Select a country {ValueChangeListener class}: + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_58ActionListener/pom.xml b/JavaServerFaces_58ActionListener/pom.xml index 844433b..23c71f3 100644 --- a/JavaServerFaces_58ActionListener/pom.xml +++ b/JavaServerFaces_58ActionListener/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_58ActionListener - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_58ActionListener + + \ No newline at end of file diff --git a/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalActionListener.java b/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalActionListener.java index 0dcf40d..1a9cd4c 100644 --- a/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalActionListener.java +++ b/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalActionListener.java @@ -1,17 +1,17 @@ -package com.xxy; - -import javax.faces.event.AbortProcessingException; -import javax.faces.event.ActionEvent; -import javax.faces.event.ActionListener; - -public class NormalActionListener implements ActionListener{ - - @Override - public void processAction(ActionEvent event) - throws AbortProcessingException { - - System.out.println("Any use case here?"); - - } - +package com.xxy; + +import javax.faces.event.AbortProcessingException; +import javax.faces.event.ActionEvent; +import javax.faces.event.ActionListener; + +public class NormalActionListener implements ActionListener{ + + @Override + public void processAction(ActionEvent event) + throws AbortProcessingException { + + System.out.println("Any use case here?"); + + } + } \ No newline at end of file diff --git a/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalBean.java b/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalBean.java index 56c23f4..7524014 100644 --- a/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalBean.java +++ b/JavaServerFaces_58ActionListener/src/main/java/com/xxy/NormalBean.java @@ -1,31 +1,31 @@ -package com.xxy; - -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.event.ActionEvent; - -@ManagedBean(name="normal") -@SessionScoped -public class NormalBean{ - - public String buttonId; - - public String getButtonId() { - return buttonId; - } - - public void setButtonId(String buttonId) { - this.buttonId = buttonId; - } - - public void printIt(ActionEvent event){ - - //Get submit button id - buttonId = event.getComponent().getClientId(); - - } - - public String outcome(){ - return "result"; - } +package com.xxy; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.event.ActionEvent; + +@ManagedBean(name="normal") +@SessionScoped +public class NormalBean{ + + public String buttonId; + + public String getButtonId() { + return buttonId; + } + + public void setButtonId(String buttonId) { + this.buttonId = buttonId; + } + + public void printIt(ActionEvent event){ + + //Get submit button id + buttonId = event.getComponent().getClientId(); + + } + + public String outcome(){ + return "result"; + } } \ No newline at end of file diff --git a/JavaServerFaces_58ActionListener/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_58ActionListener/src/main/webapp/WEB-INF/web.xml index 1c5b2a4..6e739cf 100644 --- a/JavaServerFaces_58ActionListener/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_58ActionListener/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_58ActionListener - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_58ActionListener + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_58ActionListener/src/main/webapp/default.xhtml b/JavaServerFaces_58ActionListener/src/main/webapp/default.xhtml index f7b60cd..8dfd5ec 100644 --- a/JavaServerFaces_58ActionListener/src/main/webapp/default.xhtml +++ b/JavaServerFaces_58ActionListener/src/main/webapp/default.xhtml @@ -1,31 +1,31 @@ - - - - - - -

JSF 2 actionListener example

- - - - - - - - - - - - - - -
+ + + + + + +

JSF 2 actionListener example

+ + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/JavaServerFaces_58ActionListener/src/main/webapp/result.xhtml b/JavaServerFaces_58ActionListener/src/main/webapp/result.xhtml index 93bd3ad..1a71c25 100644 --- a/JavaServerFaces_58ActionListener/src/main/webapp/result.xhtml +++ b/JavaServerFaces_58ActionListener/src/main/webapp/result.xhtml @@ -1,15 +1,15 @@ - - - - - - -

JSF 2 actionListener example

- - #{normal.buttonId} - -
+ + + + + + +

JSF 2 actionListener example

+ + #{normal.buttonId} + +
\ No newline at end of file diff --git a/JavaServerFaces_59PostConstructApplicationEvent/pom.xml b/JavaServerFaces_59PostConstructApplicationEvent/pom.xml index 2a674af..d0f889f 100644 --- a/JavaServerFaces_59PostConstructApplicationEvent/pom.xml +++ b/JavaServerFaces_59PostConstructApplicationEvent/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_59PostConstructApplicationEvent - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_59PostConstructApplicationEvent + + \ No newline at end of file diff --git a/JavaServerFaces_59PostConstructApplicationEvent/src/main/java/com/xxy/FacesAppListener.java b/JavaServerFaces_59PostConstructApplicationEvent/src/main/java/com/xxy/FacesAppListener.java index 2bc8c2c..4f5441a 100644 --- a/JavaServerFaces_59PostConstructApplicationEvent/src/main/java/com/xxy/FacesAppListener.java +++ b/JavaServerFaces_59PostConstructApplicationEvent/src/main/java/com/xxy/FacesAppListener.java @@ -1,32 +1,32 @@ -package com.xxy; - -import javax.faces.application.Application; -import javax.faces.event.AbortProcessingException; -import javax.faces.event.PostConstructApplicationEvent; -import javax.faces.event.PreDestroyApplicationEvent; -import javax.faces.event.SystemEvent; -import javax.faces.event.SystemEventListener; - -public class FacesAppListener implements SystemEventListener{ - - @Override - public void processEvent(SystemEvent event) throws AbortProcessingException { - - if(event instanceof PostConstructApplicationEvent){ - System.out.println("PostConstructApplicationEvent is Called"); - } - - if(event instanceof PreDestroyApplicationEvent){ - System.out.println("PreDestroyApplicationEvent is Called"); - } - - } - - @Override - public boolean isListenerForSource(Object source) { - //only for Application - return (source instanceof Application); - - } - +package com.xxy; + +import javax.faces.application.Application; +import javax.faces.event.AbortProcessingException; +import javax.faces.event.PostConstructApplicationEvent; +import javax.faces.event.PreDestroyApplicationEvent; +import javax.faces.event.SystemEvent; +import javax.faces.event.SystemEventListener; + +public class FacesAppListener implements SystemEventListener{ + + @Override + public void processEvent(SystemEvent event) throws AbortProcessingException { + + if(event instanceof PostConstructApplicationEvent){ + System.out.println("PostConstructApplicationEvent is Called"); + } + + if(event instanceof PreDestroyApplicationEvent){ + System.out.println("PreDestroyApplicationEvent is Called"); + } + + } + + @Override + public boolean isListenerForSource(Object source) { + //only for Application + return (source instanceof Application); + + } + } \ No newline at end of file diff --git a/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/faces-config.xml index 34570a7..de4a0a5 100644 --- a/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/faces-config.xml @@ -1,30 +1,30 @@ - - - - - - - - com.xxy.FacesAppListener - - javax.faces.event.PostConstructApplicationEvent - - - - - - com.xxy.FacesAppListener - - - javax.faces.event.PreDestroyApplicationEvent - - - - - + + + + + + + + com.xxy.FacesAppListener + + javax.faces.event.PostConstructApplicationEvent + + + + + + com.xxy.FacesAppListener + + + javax.faces.event.PreDestroyApplicationEvent + + + + + \ No newline at end of file diff --git a/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/web.xml index 201e409..c3ecf62 100644 --- a/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_59PostConstructApplicationEvent/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_59PostConstructApplicationEvent - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_59PostConstructApplicationEvent + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_60PreRenderViewEvent/pom.xml b/JavaServerFaces_60PreRenderViewEvent/pom.xml index fc723f7..03cd588 100644 --- a/JavaServerFaces_60PreRenderViewEvent/pom.xml +++ b/JavaServerFaces_60PreRenderViewEvent/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_60PreRenderViewEvent - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_60PreRenderViewEvent + + \ No newline at end of file diff --git a/JavaServerFaces_60PreRenderViewEvent/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_60PreRenderViewEvent/src/main/java/com/xxy/UserBean.java index 9b5c1e0..ba1f646 100644 --- a/JavaServerFaces_60PreRenderViewEvent/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_60PreRenderViewEvent/src/main/java/com/xxy/UserBean.java @@ -1,27 +1,27 @@ -package com.xxy; - -import javax.faces.application.ConfigurableNavigationHandler; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.context.FacesContext; -import javax.faces.event.ComponentSystemEvent; - -@ManagedBean(name="user") -@SessionScoped -public class UserBean{ - - public void isAdmin(ComponentSystemEvent event){ - - FacesContext fc = FacesContext.getCurrentInstance(); - - if (!"admin".equals(fc.getExternalContext().getSessionMap().get("role"))){ - ConfigurableNavigationHandler nav - = (ConfigurableNavigationHandler) - fc.getApplication().getNavigationHandler(); - - nav.performNavigation("access-denied"); - } - - } - +package com.xxy; + +import javax.faces.application.ConfigurableNavigationHandler; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.faces.event.ComponentSystemEvent; + +@ManagedBean(name="user") +@SessionScoped +public class UserBean{ + + public void isAdmin(ComponentSystemEvent event){ + + FacesContext fc = FacesContext.getCurrentInstance(); + + if (!"admin".equals(fc.getExternalContext().getSessionMap().get("role"))){ + ConfigurableNavigationHandler nav + = (ConfigurableNavigationHandler) + fc.getApplication().getNavigationHandler(); + + nav.performNavigation("access-denied"); + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/WEB-INF/web.xml index c976463..7fa496b 100644 --- a/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/WEB-INF/web.xml @@ -1,32 +1,32 @@ - - - JavaServerFaces_60PreRenderViewEvent - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_60PreRenderViewEvent + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/access-denied.xhtml b/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/access-denied.xhtml index 1ed7daa..1ee170e 100644 --- a/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/access-denied.xhtml +++ b/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/access-denied.xhtml @@ -1,14 +1,14 @@ - - - - - - -

Access Denied!

- -
- + + + + + + +

Access Denied!

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/default.xhtml b/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/default.xhtml index 2f39784..1142deb 100644 --- a/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/default.xhtml +++ b/JavaServerFaces_60PreRenderViewEvent/src/main/webapp/default.xhtml @@ -1,17 +1,17 @@ - - - - - - - - -

JSF 2 protected page example

- -
- + + + + + + + + +

JSF 2 protected page example

+ +
+ \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/pom.xml b/JavaServerFaces_61ValidatorMultipleComponents/pom.xml index 77b9580..473b0ca 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/pom.xml +++ b/JavaServerFaces_61ValidatorMultipleComponents/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_61ValidatorMultipleComponents - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_61ValidatorMultipleComponents + + \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java b/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java index d3b6544..d9edbf9 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java +++ b/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/PasswordValidator.java @@ -1,39 +1,39 @@ -package com.xxy; - -import javax.faces.application.FacesMessage; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.context.FacesContext; -import javax.faces.validator.FacesValidator; -import javax.faces.validator.Validator; -import javax.faces.validator.ValidatorException; - -@FacesValidator("passwordValidator") -public class PasswordValidator implements Validator { - - @Override - public void validate(FacesContext context, UIComponent component, - Object value) throws ValidatorException { - - String password = value.toString(); - - UIInput uiInputConfirmPassword = (UIInput) component.getAttributes() - .get("confirmPassword"); - String confirmPassword = uiInputConfirmPassword.getSubmittedValue() - .toString(); - - // Let required="true" do its job. - if (password == null || password.isEmpty() || confirmPassword == null - || confirmPassword.isEmpty()) { - return; - } - - if (!password.equals(confirmPassword)) { - uiInputConfirmPassword.setValid(false); - throw new ValidatorException(new FacesMessage( - "Password must match confirm password.")); - } - - } - +package com.xxy; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.component.UIInput; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +@FacesValidator("passwordValidator") +public class PasswordValidator implements Validator { + + @Override + public void validate(FacesContext context, UIComponent component, + Object value) throws ValidatorException { + + String password = value.toString(); + + UIInput uiInputConfirmPassword = (UIInput) component.getAttributes() + .get("confirmPassword"); + String confirmPassword = uiInputConfirmPassword.getSubmittedValue() + .toString(); + + // Let required="true" do its job. + if (password == null || password.isEmpty() || confirmPassword == null + || confirmPassword.isEmpty()) { + return; + } + + if (!password.equals(confirmPassword)) { + uiInputConfirmPassword.setValid(false); + throw new ValidatorException(new FacesMessage( + "Password must match confirm password.")); + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java index 7d46759..0daf7f9 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_61ValidatorMultipleComponents/src/main/java/com/xxy/UserBean.java @@ -1,71 +1,71 @@ -package com.xxy; - -import javax.faces.application.FacesMessage; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.faces.component.UIComponent; -import javax.faces.component.UIInput; -import javax.faces.context.FacesContext; -import javax.faces.event.ComponentSystemEvent; - -@ManagedBean(name = "user") -@SessionScoped -public class UserBean { - - public String username; - public String password; - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public void validatePassword(ComponentSystemEvent event) { - - FacesContext fc = FacesContext.getCurrentInstance(); - - UIComponent components = event.getComponent(); - - // get password - UIInput uiInputPassword = (UIInput) components - .findComponent("password"); - - String password = uiInputPassword.getLocalValue() == null ? "" - : uiInputPassword.getLocalValue().toString(); - - String passwordId = uiInputPassword.getClientId(); - - // get confirm password - UIInput uiInputConfirmPassword = (UIInput) components - .findComponent("confirmPassword"); - String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? "" - : uiInputConfirmPassword.getLocalValue().toString(); - - // Let required="true" do its job. - if (password.isEmpty() || confirmPassword.isEmpty()) { - return; - } - - if (!password.equals(confirmPassword)) { - - FacesMessage msg = new FacesMessage( - "Password must match confirm password"); - msg.setSeverity(FacesMessage.SEVERITY_ERROR); - fc.addMessage(passwordId, msg); - fc.renderResponse(); - } - - } - +package com.xxy; + +import javax.faces.application.FacesMessage; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.component.UIComponent; +import javax.faces.component.UIInput; +import javax.faces.context.FacesContext; +import javax.faces.event.ComponentSystemEvent; + +@ManagedBean(name = "user") +@SessionScoped +public class UserBean { + + public String username; + public String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public void validatePassword(ComponentSystemEvent event) { + + FacesContext fc = FacesContext.getCurrentInstance(); + + UIComponent components = event.getComponent(); + + // get password + UIInput uiInputPassword = (UIInput) components + .findComponent("password"); + + String password = uiInputPassword.getLocalValue() == null ? "" + : uiInputPassword.getLocalValue().toString(); + + String passwordId = uiInputPassword.getClientId(); + + // get confirm password + UIInput uiInputConfirmPassword = (UIInput) components + .findComponent("confirmPassword"); + String confirmPassword = uiInputConfirmPassword.getLocalValue() == null ? "" + : uiInputConfirmPassword.getLocalValue().toString(); + + // Let required="true" do its job. + if (password.isEmpty() || confirmPassword.isEmpty()) { + return; + } + + if (!password.equals(confirmPassword)) { + + FacesMessage msg = new FacesMessage( + "Password must match confirm password"); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + fc.addMessage(passwordId, msg); + fc.renderResponse(); + } + + } + } \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml index f77da05..46132a8 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/WEB-INF/web.xml @@ -1,20 +1,20 @@ - - - JavaServerFaces_61ValidatorMultipleComponents - - javax.faces.PROJECT_STAGE - Development - - - default.jsf - - - facesServlet - javax.faces.webapp.FacesServlet - 1 - - - facesServlet - *.jsf - + + + JavaServerFaces_61ValidatorMultipleComponents + + javax.faces.PROJECT_STAGE + Development + + + default.jsf + + + facesServlet + javax.faces.webapp.FacesServlet + 1 + + + facesServlet + *.jsf + \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default.xhtml b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default.xhtml index 41783bd..bcabda3 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default.xhtml +++ b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default.xhtml @@ -1,41 +1,41 @@ - - - - - -

Multiple-Components Validator in JSF 2.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + + + +

Multiple-Components Validator in JSF 2.0

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default1.xhtml b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default1.xhtml index ff71c17..a65d573 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default1.xhtml +++ b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/default1.xhtml @@ -1,43 +1,43 @@ - - - - - -

Multiple-Components Validator in JSF 2.0

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- + + + + + +

Multiple-Components Validator in JSF 2.0

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/thanks.xhtml b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/thanks.xhtml index 4d63144..12a2f23 100644 --- a/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/thanks.xhtml +++ b/JavaServerFaces_61ValidatorMultipleComponents/src/main/webapp/thanks.xhtml @@ -1,10 +1,10 @@ - - - - -

Thanks for register

- -
+ + + + +

Thanks for register

+ +
\ No newline at end of file diff --git a/JavaServerFaces_62JDBCIntegration/pom.xml b/JavaServerFaces_62JDBCIntegration/pom.xml index 4b4d88c..3cbdc5a 100644 --- a/JavaServerFaces_62JDBCIntegration/pom.xml +++ b/JavaServerFaces_62JDBCIntegration/pom.xml @@ -1,15 +1,15 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_62JDBCIntegration - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_62JDBCIntegration + + \ No newline at end of file diff --git a/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/CustomerBean.java b/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/CustomerBean.java index d2df726..2ad63bd 100644 --- a/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/CustomerBean.java +++ b/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/CustomerBean.java @@ -1,75 +1,75 @@ -package com.xxy; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Resource; -import javax.faces.bean.ManagedBean; -import javax.faces.bean.SessionScoped; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.sql.DataSource; - -import com.xxy.customer.model.Customer; - -@ManagedBean(name="customer") -@SessionScoped -public class CustomerBean implements Serializable{ - - //resource injection - @Resource(name="jdbc/mkyongdb") - private DataSource ds; - - //if resource inject is not support, you still can get it manually. - /*public CustomerBean(){ - try { - Context ctx = new InitialContext(); - ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mkyongdb"); - } catch (NamingException e) { - e.printStackTrace(); - } - - }*/ - - //connect to DB and get customer list - public List getCustomerList() throws SQLException{ - - if(ds==null) - throw new SQLException("Can't get data source"); - - //get database connection - Connection con = ds.getConnection(); - - if(con==null) - throw new SQLException("Can't get database connection"); - - PreparedStatement ps - = con.prepareStatement( - "select customer_id, name, address, created_date from customer"); - - //get customer data from database - ResultSet result = ps.executeQuery(); - - List list = new ArrayList(); - - while(result.next()){ - Customer cust = new Customer(); - - cust.setCustomerID(result.getLong("customer_id")); - cust.setName(result.getString("name")); - cust.setAddress(result.getString("address")); - cust.setCreated_date(result.getDate("created_date")); - - //store all data into a List - list.add(cust); - } - - return list; - } -} +package com.xxy; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; + +import com.xxy.customer.model.Customer; + +@ManagedBean(name="customer") +@SessionScoped +public class CustomerBean implements Serializable{ + + //resource injection + @Resource(name="jdbc/mkyongdb") + private DataSource ds; + + //if resource inject is not support, you still can get it manually. + /*public CustomerBean(){ + try { + Context ctx = new InitialContext(); + ds = (DataSource)ctx.lookup("java:comp/env/jdbc/mkyongdb"); + } catch (NamingException e) { + e.printStackTrace(); + } + + }*/ + + //connect to DB and get customer list + public List getCustomerList() throws SQLException{ + + if(ds==null) + throw new SQLException("Can't get data source"); + + //get database connection + Connection con = ds.getConnection(); + + if(con==null) + throw new SQLException("Can't get database connection"); + + PreparedStatement ps + = con.prepareStatement( + "select customer_id, name, address, created_date from customer"); + + //get customer data from database + ResultSet result = ps.executeQuery(); + + List list = new ArrayList(); + + while(result.next()){ + Customer cust = new Customer(); + + cust.setCustomerID(result.getLong("customer_id")); + cust.setName(result.getString("name")); + cust.setAddress(result.getString("address")); + cust.setCreated_date(result.getDate("created_date")); + + //store all data into a List + list.add(cust); + } + + return list; + } +} diff --git a/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/customer/model/Customer.java b/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/customer/model/Customer.java index 10d7489..abdd5ea 100644 --- a/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/customer/model/Customer.java +++ b/JavaServerFaces_62JDBCIntegration/src/main/java/com/xxy/customer/model/Customer.java @@ -1,36 +1,36 @@ -package com.xxy.customer.model; - -import java.util.Date; - -public class Customer{ - - public long customerID; - public String name; - public String address; - public Date created_date; - - public long getCustomerID() { - return customerID; - } - public void setCustomerID(long customerID) { - this.customerID = customerID; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public Date getCreated_date() { - return created_date; - } - public void setCreated_date(Date created_date) { - this.created_date = created_date; - } +package com.xxy.customer.model; + +import java.util.Date; + +public class Customer{ + + public long customerID; + public String name; + public String address; + public Date created_date; + + public long getCustomerID() { + return customerID; + } + public void setCustomerID(long customerID) { + this.customerID = customerID; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getAddress() { + return address; + } + public void setAddress(String address) { + this.address = address; + } + public Date getCreated_date() { + return created_date; + } + public void setCreated_date(Date created_date) { + this.created_date = created_date; + } } \ No newline at end of file diff --git a/JavaServerFaces_62JDBCIntegration/src/main/webapp/META-INF/context.xml b/JavaServerFaces_62JDBCIntegration/src/main/webapp/META-INF/context.xml index e1afcfc..a1c1131 100644 --- a/JavaServerFaces_62JDBCIntegration/src/main/webapp/META-INF/context.xml +++ b/JavaServerFaces_62JDBCIntegration/src/main/webapp/META-INF/context.xml @@ -1,8 +1,8 @@ - - - - - + + + + + diff --git a/JavaServerFaces_62JDBCIntegration/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_62JDBCIntegration/src/main/webapp/WEB-INF/web.xml index f556d51..ffd27c9 100644 --- a/JavaServerFaces_62JDBCIntegration/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_62JDBCIntegration/src/main/webapp/WEB-INF/web.xml @@ -1,38 +1,38 @@ - - - JavaServerFaces_62JDBCIntegration - - MySQL Datasource example - jdbc/mkyongdb - javax.sql.DataSource - Container - - - javax.faces.PROJECT_STAGE - Development - - - faces/default.xhtml - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - + + + JavaServerFaces_62JDBCIntegration + + MySQL Datasource example + jdbc/mkyongdb + javax.sql.DataSource + Container + + + javax.faces.PROJECT_STAGE + Development + + + faces/default.xhtml + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_62JDBCIntegration/src/main/webapp/default.xhtml b/JavaServerFaces_62JDBCIntegration/src/main/webapp/default.xhtml index 278ea36..9d4aa29 100644 --- a/JavaServerFaces_62JDBCIntegration/src/main/webapp/default.xhtml +++ b/JavaServerFaces_62JDBCIntegration/src/main/webapp/default.xhtml @@ -1,54 +1,54 @@ - - - - - - - - - -

JSF 2.0 + JDBC Example

- - - - - - Customer ID - - #{c.customerID} - - - - - Name - - #{c.name} - - - - - Address - - #{c.address} - - - - - Created Date - - #{c.created_date} - - - - -
- + + + + + + + + + +

JSF 2.0 + JDBC Example

+ + + + + + Customer ID + + #{c.customerID} + + + + + Name + + #{c.name} + + + + + Address + + #{c.address} + + + + + Created Date + + #{c.created_date} + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_62JDBCIntegration/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_62JDBCIntegration/src/main/webapp/resources/css/table-style.css index 10a18be..6c8794c 100644 --- a/JavaServerFaces_62JDBCIntegration/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_62JDBCIntegration/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/JavaServerFaces_63Spring/pom.xml b/JavaServerFaces_63Spring/pom.xml index 7a0325e..13acf39 100644 --- a/JavaServerFaces_63Spring/pom.xml +++ b/JavaServerFaces_63Spring/pom.xml @@ -1,48 +1,48 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_63Spring - - - org.springframework - spring - 2.5.6 - - - - org.springframework - spring-web - 2.5.6 - - - - - javax.inject - javax.inject - 1 - - - - - org.glassfish.web - el-impl - 2.2 - - - - - com.sun.el - el-ri - 1.0 - - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_63Spring + + + org.springframework + spring + 2.5.6 + + + + org.springframework + spring-web + 2.5.6 + + + + + javax.inject + javax.inject + 1 + + + + + org.glassfish.web + el-impl + 2.2 + + + + + com.sun.el + el-ri + 1.0 + + + \ No newline at end of file diff --git a/JavaServerFaces_63Spring/src/main/java/com/xxy/UserBean.java b/JavaServerFaces_63Spring/src/main/java/com/xxy/UserBean.java index edc8b3d..3c922e4 100644 --- a/JavaServerFaces_63Spring/src/main/java/com/xxy/UserBean.java +++ b/JavaServerFaces_63Spring/src/main/java/com/xxy/UserBean.java @@ -1,23 +1,23 @@ -package com.xxy; - -import javax.inject.Inject; -import javax.inject.Named; -import org.springframework.context.annotation.Scope; -import com.xxy.user.bo.UserBo; - -@Named -@Scope("session") -public class UserBean { - - @Inject - UserBo userBo; - - public void setUserBo(UserBo userBo) { - this.userBo = userBo; - } - - public String printMsgFromSpring() { - return userBo.getMessage(); - } - +package com.xxy; + +import javax.inject.Inject; +import javax.inject.Named; +import org.springframework.context.annotation.Scope; +import com.xxy.user.bo.UserBo; + +@Named +@Scope("session") +public class UserBean { + + @Inject + UserBo userBo; + + public void setUserBo(UserBo userBo) { + this.userBo = userBo; + } + + public String printMsgFromSpring() { + return userBo.getMessage(); + } + } \ No newline at end of file diff --git a/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/UserBo.java b/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/UserBo.java index 34d617f..d3d1d89 100644 --- a/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/UserBo.java +++ b/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/UserBo.java @@ -1,7 +1,7 @@ -package com.xxy.user.bo; - -public interface UserBo{ - - public String getMessage(); - +package com.xxy.user.bo; + +public interface UserBo{ + + public String getMessage(); + } \ No newline at end of file diff --git a/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/impl/UserBoImpl.java b/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/impl/UserBoImpl.java index f762d19..ecfdd2f 100644 --- a/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/impl/UserBoImpl.java +++ b/JavaServerFaces_63Spring/src/main/java/com/xxy/user/bo/impl/UserBoImpl.java @@ -1,16 +1,16 @@ -package com.xxy.user.bo.impl; - -import javax.inject.Named; - -import com.xxy.user.bo.UserBo; - -@Named -public class UserBoImpl implements UserBo{ - - public String getMessage() { - - return "JSF 2 + Spring Integration"; - - } - +package com.xxy.user.bo.impl; + +import javax.inject.Named; + +import com.xxy.user.bo.UserBo; + +@Named +public class UserBoImpl implements UserBo{ + + public String getMessage() { + + return "JSF 2 + Spring Integration"; + + } + } \ No newline at end of file diff --git a/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/applicationContext.xml b/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/applicationContext.xml index 2e060ab..226372c 100644 --- a/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/applicationContext.xml +++ b/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/applicationContext.xml @@ -1,21 +1,21 @@ - - - - - - - - - + + + + + + + + + diff --git a/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/faces-config.xml index 6ac0944..c2f9a01 100644 --- a/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/faces-config.xml @@ -1,22 +1,22 @@ - - - - - - org.springframework.web.jsf.el.SpringBeanFacesELResolver - - - - user - com.xxy.UserBean - session - - userBo - #{userBo} - - - - + + + + + + org.springframework.web.jsf.el.SpringBeanFacesELResolver + + + + user + com.xxy.UserBean + session + + userBo + #{userBo} + + + + diff --git a/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/web.xml index 0626c39..12ab78e 100644 --- a/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_63Spring/src/main/webapp/WEB-INF/web.xml @@ -1,34 +1,34 @@ - - - JavaServerFaces_63Spring - - - org.springframework.web.context.ContextLoaderListener - - - - - org.springframework.web.context.request.RequestContextListener - - - - javax.faces.PROJECT_STAGE - Development - - - default.jsf - - - facesServlet - javax.faces.webapp.FacesServlet - 1 - - - facesServlet - *.jsf - - - facesServlet - *.xhtml - + + + JavaServerFaces_63Spring + + + org.springframework.web.context.ContextLoaderListener + + + + + org.springframework.web.context.request.RequestContextListener + + + + javax.faces.PROJECT_STAGE + Development + + + default.jsf + + + facesServlet + javax.faces.webapp.FacesServlet + 1 + + + facesServlet + *.jsf + + + facesServlet + *.xhtml + \ No newline at end of file diff --git a/JavaServerFaces_63Spring/src/main/webapp/default.xhtml b/JavaServerFaces_63Spring/src/main/webapp/default.xhtml index f91f4d5..9036b9c 100644 --- a/JavaServerFaces_63Spring/src/main/webapp/default.xhtml +++ b/JavaServerFaces_63Spring/src/main/webapp/default.xhtml @@ -1,16 +1,16 @@ - - - - - - -

JSF 2.0 + Spring Example

- - #{userBean.printMsgFromSpring()} - -
- + + + + + + +

JSF 2.0 + Spring Example

+ + #{userBean.printMsgFromSpring()} + +
+ \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/pom.xml b/JavaServerFaces_64SpringHibernateIntegration/pom.xml index eded6ce..0189462 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/pom.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/pom.xml @@ -1,75 +1,75 @@ - - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_64SpringHibernateIntegration - - - - - mysql - mysql-connector-java - 5.1.9 - - - - - org.springframework - spring - 2.5.6 - - - - org.springframework - spring-web - 2.5.6 - - - - - org.hibernate - hibernate - 3.2.7.ga - - - - - dom4j - dom4j - 1.6.1 - - - - commons-logging - commons-logging - 1.1.1 - - - - commons-collections - commons-collections - 3.2.1 - - - - cglib - cglib - 2.2 - - - - - - antlr - antlr - 2.7.7 - - + + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + + JavaServerFaces_64SpringHibernateIntegration + + + + + mysql + mysql-connector-java + 5.1.9 + + + + + org.springframework + spring + 2.5.6 + + + + org.springframework + spring-web + 2.5.6 + + + + + org.hibernate + hibernate + 3.2.7.ga + + + + + dom4j + dom4j + 1.6.1 + + + + commons-logging + commons-logging + 1.1.1 + + + + commons-collections + commons-collections + 3.2.1 + + + + cglib + cglib + 2.2 + + + + + + antlr + antlr + 2.7.7 + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/CustomerBean.java b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/CustomerBean.java index 381e9c6..ba8c5f9 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/CustomerBean.java +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/CustomerBean.java @@ -1,62 +1,62 @@ -package com.xxy; - -import java.io.Serializable; -import java.util.List; - -import com.xxy.customer.bo.CustomerBo; -import com.xxy.customer.model.Customer; - -public class CustomerBean implements Serializable{ - - //DI via Spring - CustomerBo customerBo; - - public String name; - public String address; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public void setCustomerBo(CustomerBo customerBo) { - this.customerBo = customerBo; - } - - //get all customer data from database - public List getCustomerList(){ - return customerBo.findAllCustomer(); - } - - //add a new customer data into database - public String addCustomer(){ - - Customer cust = new Customer(); - cust.setName(getName()); - cust.setAddress(getAddress()); - - customerBo.addCustomer(cust); - - clearForm(); - - return ""; - } - - //clear form values - private void clearForm(){ - setName(""); - setAddress(""); - } - -} +package com.xxy; + +import java.io.Serializable; +import java.util.List; + +import com.xxy.customer.bo.CustomerBo; +import com.xxy.customer.model.Customer; + +public class CustomerBean implements Serializable{ + + //DI via Spring + CustomerBo customerBo; + + public String name; + public String address; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public void setCustomerBo(CustomerBo customerBo) { + this.customerBo = customerBo; + } + + //get all customer data from database + public List getCustomerList(){ + return customerBo.findAllCustomer(); + } + + //add a new customer data into database + public String addCustomer(){ + + Customer cust = new Customer(); + cust.setName(getName()); + cust.setAddress(getAddress()); + + customerBo.addCustomer(cust); + + clearForm(); + + return ""; + } + + //clear form values + private void clearForm(){ + setName(""); + setAddress(""); + } + +} diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/CustomerBo.java b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/CustomerBo.java index 9de0e0c..c76b9ca 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/CustomerBo.java +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/CustomerBo.java @@ -1,13 +1,13 @@ -package com.xxy.customer.bo; - -import java.util.List; - -import com.xxy.customer.model.Customer; - -public interface CustomerBo{ - - void addCustomer(Customer customer); - - List findAllCustomer(); - +package com.xxy.customer.bo; + +import java.util.List; + +import com.xxy.customer.model.Customer; + +public interface CustomerBo{ + + void addCustomer(Customer customer); + + List findAllCustomer(); + } \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/impl/CustomerBoImpl.java b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/impl/CustomerBoImpl.java index 4edbb69..bc734ad 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/impl/CustomerBoImpl.java +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/bo/impl/CustomerBoImpl.java @@ -1,27 +1,27 @@ -package com.xxy.customer.bo.impl; - -import java.util.List; - -import com.xxy.customer.bo.CustomerBo; -import com.xxy.customer.dao.CustomerDao; -import com.xxy.customer.model.Customer; - -public class CustomerBoImpl implements CustomerBo{ - - CustomerDao customerDao; - - public void setCustomerDao(CustomerDao customerDao) { - this.customerDao = customerDao; - } - - public void addCustomer(Customer customer){ - - customerDao.addCustomer(customer); - - } - - public List findAllCustomer(){ - - return customerDao.findAllCustomer(); - } +package com.xxy.customer.bo.impl; + +import java.util.List; + +import com.xxy.customer.bo.CustomerBo; +import com.xxy.customer.dao.CustomerDao; +import com.xxy.customer.model.Customer; + +public class CustomerBoImpl implements CustomerBo{ + + CustomerDao customerDao; + + public void setCustomerDao(CustomerDao customerDao) { + this.customerDao = customerDao; + } + + public void addCustomer(Customer customer){ + + customerDao.addCustomer(customer); + + } + + public List findAllCustomer(){ + + return customerDao.findAllCustomer(); + } } \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/CustomerDao.java b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/CustomerDao.java index aaee385..5fc0da5 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/CustomerDao.java +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/CustomerDao.java @@ -1,13 +1,13 @@ -package com.xxy.customer.dao; - -import java.util.List; - -import com.xxy.customer.model.Customer; - -public interface CustomerDao{ - - void addCustomer(Customer customer); - - List findAllCustomer(); - +package com.xxy.customer.dao; + +import java.util.List; + +import com.xxy.customer.model.Customer; + +public interface CustomerDao{ + + void addCustomer(Customer customer); + + List findAllCustomer(); + } \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/impl/CustomerDaoImpl.java b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/impl/CustomerDaoImpl.java index 045b723..6a22a49 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/impl/CustomerDaoImpl.java +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/dao/impl/CustomerDaoImpl.java @@ -1,25 +1,25 @@ -package com.xxy.customer.dao.impl; - -import java.util.Date; -import java.util.List; - -import com.xxy.customer.dao.CustomerDao; -import com.xxy.customer.model.Customer; -import org.springframework.orm.hibernate3.support.HibernateDaoSupport; - -public class CustomerDaoImpl extends - HibernateDaoSupport implements CustomerDao{ - - public void addCustomer(Customer customer){ - - customer.setCreatedDate(new Date()); - getHibernateTemplate().save(customer); - - } - - public List findAllCustomer(){ - - return getHibernateTemplate().find("from Customer"); - - } +package com.xxy.customer.dao.impl; + +import java.util.Date; +import java.util.List; + +import com.xxy.customer.dao.CustomerDao; +import com.xxy.customer.model.Customer; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +public class CustomerDaoImpl extends + HibernateDaoSupport implements CustomerDao{ + + public void addCustomer(Customer customer){ + + customer.setCreatedDate(new Date()); + getHibernateTemplate().save(customer); + + } + + public List findAllCustomer(){ + + return getHibernateTemplate().find("from Customer"); + + } } \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/model/Customer.java b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/model/Customer.java index 49fa328..575a324 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/model/Customer.java +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/java/com/xxy/customer/model/Customer.java @@ -1,37 +1,37 @@ -package com.xxy.customer.model; - -import java.util.Date; - -public class Customer{ - - public long customerId; - public String name; - public String address; - public Date createdDate; - - public long getCustomerId() { - return customerId; - } - public void setCustomerId(long customerId) { - this.customerId = customerId; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getAddress() { - return address; - } - public void setAddress(String address) { - this.address = address; - } - public Date getCreatedDate() { - return createdDate; - } - public void setCreatedDate(Date createdDate) { - this.createdDate = createdDate; - } - +package com.xxy.customer.model; + +import java.util.Date; + +public class Customer{ + + public long customerId; + public String name; + public String address; + public Date createdDate; + + public long getCustomerId() { + return customerId; + } + public void setCustomerId(long customerId) { + this.customerId = customerId; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getAddress() { + return address; + } + public void setAddress(String address) { + this.address = address; + } + public Date getCreatedDate() { + return createdDate; + } + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + } \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/applicationContext.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/applicationContext.xml index 6a02e0d..282c63b 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/applicationContext.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/applicationContext.xml @@ -1,13 +1,13 @@ - - - - - - - - - - + + + + + + + + + + diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/faces-config.xml index 7a491d3..474ce11 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/faces-config.xml @@ -1,25 +1,25 @@ - - - - - - org.springframework.web.jsf.el.SpringBeanFacesELResolver - - - - - customer - com.xxy.CustomerBean - session - - customerBo - #{customerBo} - - - + + + + + + org.springframework.web.jsf.el.SpringBeanFacesELResolver + + + + + customer + com.xxy.CustomerBean + session + + customerBo + #{customerBo} + + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/web.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/web.xml index 6d35ea9..c660dff 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/web.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/WEB-INF/web.xml @@ -1,59 +1,59 @@ - - - - JavaServerFaces - - - - - org.springframework.web.context.ContextLoaderListener - - - - - org.springframework.web.context.request.RequestContextListener - - - - - - javax.faces.PROJECT_STAGE - Development - - - - - faces/default.xhtml - - - - - Faces Servlet - javax.faces.webapp.FacesServlet - 1 - - - - - Faces Servlet - /faces/* - - - Faces Servlet - *.jsf - - - Faces Servlet - *.faces - - - Faces Servlet - *.xhtml - - + + + + JavaServerFaces + + + + + org.springframework.web.context.ContextLoaderListener + + + + + org.springframework.web.context.request.RequestContextListener + + + + + + javax.faces.PROJECT_STAGE + Development + + + + + faces/default.xhtml + + + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + + + Faces Servlet + /faces/* + + + Faces Servlet + *.jsf + + + Faces Servlet + *.faces + + + Faces Servlet + *.xhtml + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/default.xhtml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/default.xhtml index 6a8fc46..665020e 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/default.xhtml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/default.xhtml @@ -1,81 +1,81 @@ - - - - - - - - - -

JSF 2.0 + Spring + Hibernate Example

- - - - - - Customer ID - - #{c.customerId} - - - - - Name - - #{c.name} - - - - - Address - - #{c.address} - - - - - Created Date - - #{c.createdDate} - - - - -

Add New Customer

- - - - - Name : - - - - - - Address : - - - - - - - - - - - -
- + + + + + + + + + +

JSF 2.0 + Spring + Hibernate Example

+ + + + + + Customer ID + + #{c.customerId} + + + + + Name + + #{c.name} + + + + + Address + + #{c.address} + + + + + Created Date + + #{c.createdDate} + + + + +

Add New Customer

+ + + + + Name : + + + + + + Address : + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/hibernate/Customer.hbm.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/hibernate/Customer.hbm.xml index 2346fe5..3e5d686 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/hibernate/Customer.hbm.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/hibernate/Customer.hbm.xml @@ -1,23 +1,23 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/spring/CustomerBean.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/spring/CustomerBean.xml index 50029ca..d7a3c80 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/spring/CustomerBean.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/com/xxy/customer/spring/CustomerBean.xml @@ -1,17 +1,17 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/database/db.properties b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/database/db.properties index abbdfad..3135f22 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/database/db.properties +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/database/db.properties @@ -1,4 +1,4 @@ -jdbc.driverClassName=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/xxydb -jdbc.username=root +jdbc.driverClassName=com.mysql.jdbc.Driver +jdbc.url=jdbc:mysql://localhost:3306/xxydb +jdbc.username=root jdbc.password=password \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/DataSource.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/DataSource.xml index 4519e79..c1919fe 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/DataSource.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/DataSource.xml @@ -1,20 +1,20 @@ - - - - - config/database/db.properties - - - - - - - - - - + + + + + config/database/db.properties + + + + + + + + + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/HibernateSessionFactory.xml b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/HibernateSessionFactory.xml index 4a286a8..e0e3cba 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/HibernateSessionFactory.xml +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/config/spring/beans/HibernateSessionFactory.xml @@ -1,29 +1,29 @@ - - - - - - - - - - - - - org.hibernate.dialect.MySQLDialect - true - - - - - - com/xxy/customer/hibernate/Customer.hbm.xml - - - - + + + + + + + + + + + + + org.hibernate.dialect.MySQLDialect + true + + + + + + com/xxy/customer/hibernate/Customer.hbm.xml + + + + \ No newline at end of file diff --git a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/css/table-style.css b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/css/table-style.css index f4f5f4c..671019b 100644 --- a/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/css/table-style.css +++ b/JavaServerFaces_64SpringHibernateIntegration/src/main/webapp/resources/css/table-style.css @@ -1,22 +1,22 @@ -.order-table{ - border-collapse:collapse; -} - -.order-table-header{ - text-align:center; - background:none repeat scroll 0 0 #E5E5E5; - border-bottom:1px solid #BBBBBB; - padding:16px; -} - -.order-table-odd-row{ - text-align:center; - background:none repeat scroll 0 0 #FFFFFF; - border-top:1px solid #BBBBBB; -} - -.order-table-even-row{ - text-align:center; - background:none repeat scroll 0 0 #F9F9F9; - border-top:1px solid #BBBBBB; +.order-table{ + border-collapse:collapse; +} + +.order-table-header{ + text-align:center; + background:none repeat scroll 0 0 #E5E5E5; + border-bottom:1px solid #BBBBBB; + padding:16px; +} + +.order-table-odd-row{ + text-align:center; + background:none repeat scroll 0 0 #FFFFFF; + border-top:1px solid #BBBBBB; +} + +.order-table-even-row{ + text-align:center; + background:none repeat scroll 0 0 #F9F9F9; + border-top:1px solid #BBBBBB; } \ No newline at end of file diff --git a/README.md b/README.md index 1e47a35..13990b9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# JavaServerFaces -- 这是fork别人的项目,用来学习jsf的生命周期。 -- 现在项目使用的就是jsf框架,想深入的了解jsf的内部原理,让自己对J2EE的知识理解更深入。 -- 使用IDEA来打开,eclipse要装插件才行,不然无法识别。 +# JavaServerFaces +- 这是fork别人的项目,用来学习jsf的生命周期。 +- 现在项目使用的就是jsf框架,想深入的了解jsf的内部原理,让自己对J2EE的知识理解更深入。 +- 使用IDEA来打开,eclipse要装插件才行,不然无法识别。 diff --git a/pom.xml b/pom.xml index 6af9b32..9b0d201 100644 --- a/pom.xml +++ b/pom.xml @@ -1,139 +1,132 @@ - - - 4.0.0 - JavaServerFaces - JavaServerFaces-parent - 1.0-SNAPSHOT - pom - - JavaServerFaces_01HelloWorld - JavaServerFaces_02HelloWorldAjax - JavaServerFaces_03ManagedBeans - JavaServerFaces_04InjectManagedBeans - JavaServerFaces_05ImplicitNavigation - JavaServerFaces_06ConditionalNavigation - JavaServerFaces_07FormActionNavigation - JavaServerFaces_08PageRedirection - JavaServerFaces_09ResourceBundles - JavaServerFaces_10Internationlization - JavaServerFaces_11TextBox - JavaServerFaces_12Password - JavaServerFaces_13TextArea - JavaServerFaces_14HiddenValue - JavaServerFaces_15Checkboxes - JavaServerFaces_16RadioButtons - JavaServerFaces_17Listbox - JavaServerFaces_18MultiSelectListbox - JavaServerFaces_19DropdownBox - JavaServerFaces_20MultipleSelectDropdownBox - JavaServerFaces_21OutputText - JavaServerFaces_22OutputFormat - JavaServerFaces_23GraphicImage - JavaServerFaces_24OutputStyleSheet - JavaServerFaces_25OutputScript - JavaServerFaces_26ButtonCommanButton - JavaServerFaces_27LinkCommandLinkOutputlink - JavaServerFaces_28PanelGrid - JavaServerFaces_29Message - JavaServerFaces_30Param - JavaServerFaces_31Attribute - JavaServerFaces_32SetpropertyActionListener - JavaServerFaces_33DataTable - JavaServerFaces_34DataTableAdd - JavaServerFaces_35DataTableUpdate - JavaServerFaces_36DataTableDelete - JavaServerFaces_37DataTableRowNumbers - JavaServerFaces_38RepeatTag - JavaServerFaces_39DataTableSorting - JavaServerFaces_40DataTableSortingDataModel - JavaServerFaces_41FaceletsTemplate - JavaServerFaces_42ParameterInTemplate - JavaServerFaces_43CustomTag - JavaServerFaces_44RemoveTag - JavaServerFaces_45ConverNumber - JavaServerFaces_46ConverDateTime - JavaServerFaces_47ValidateLength - JavaServerFaces_48ValidateLongRange - JavaServerFaces_49ValidateDoubleRange - JavaServerFaces_50ValidateRequired - JavaServerFaces_51ValidateRegex - JavaServerFaces_52CustomValidation - JavaServerFaces_53CustomConverter - JavaServerFaces_54CustomValidator - JavaServerFaces_55ValidatorMultipleComponents - JavaServerFaces_56CompositeComponents - JavaServerFaces_57ValueChangeListener - JavaServerFaces_58ActionListener - JavaServerFaces_59PostConstructApplicationEvent - JavaServerFaces_60PreRenderViewEvent - JavaServerFaces_61ValidatorMultipleComponents - JavaServerFaces_62JDBCIntegration - JavaServerFaces_63Spring - JavaServerFaces_64SpringHibernateIntegration - - - - - com.sun.faces - jsf-api - 2.1.3 - - - com.sun.faces - jsf-impl - 2.1.3 - - - - javax.servlet - jstl - 1.2 - - - - javax.servlet - servlet-api - 2.5 - - - - javax.servlet.jsp - jsp-api - 2.1 - - - - com.sun.el - el-ri - 1.0 - - - - - - - - java.net.m2 - java.net m2 repo - http://download.java.net/maven/2 - - - - - JavaServerFaces - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - + + + 4.0.0 + JavaServerFaces + JavaServerFaces-parent + 1.0-SNAPSHOT + http://maven.aliyun.com/nexus/content/groups/public/ + pom + + JavaServerFaces_01HelloWorld + JavaServerFaces_02HelloWorldAjax + JavaServerFaces_03ManagedBeans + JavaServerFaces_04InjectManagedBeans + JavaServerFaces_05ImplicitNavigation + JavaServerFaces_06ConditionalNavigation + JavaServerFaces_07FormActionNavigation + JavaServerFaces_08PageRedirection + JavaServerFaces_09ResourceBundles + JavaServerFaces_10Internationlization + JavaServerFaces_11TextBox + JavaServerFaces_12Password + JavaServerFaces_13TextArea + JavaServerFaces_14HiddenValue + JavaServerFaces_15Checkboxes + JavaServerFaces_16RadioButtons + JavaServerFaces_17Listbox + JavaServerFaces_18MultiSelectListbox + JavaServerFaces_19DropdownBox + JavaServerFaces_20MultipleSelectDropdownBox + JavaServerFaces_21OutputText + JavaServerFaces_22OutputFormat + JavaServerFaces_23GraphicImage + JavaServerFaces_24OutputStyleSheet + JavaServerFaces_25OutputScript + JavaServerFaces_26ButtonCommanButton + JavaServerFaces_27LinkCommandLinkOutputlink + JavaServerFaces_28PanelGrid + JavaServerFaces_29Message + JavaServerFaces_30Param + JavaServerFaces_31Attribute + JavaServerFaces_32SetpropertyActionListener + JavaServerFaces_33DataTable + JavaServerFaces_34DataTableAdd + JavaServerFaces_35DataTableUpdate + JavaServerFaces_36DataTableDelete + JavaServerFaces_37DataTableRowNumbers + JavaServerFaces_38RepeatTag + JavaServerFaces_39DataTableSorting + JavaServerFaces_40DataTableSortingDataModel + JavaServerFaces_41FaceletsTemplate + JavaServerFaces_42ParameterInTemplate + JavaServerFaces_43CustomTag + JavaServerFaces_44RemoveTag + JavaServerFaces_45ConverNumber + JavaServerFaces_46ConverDateTime + JavaServerFaces_47ValidateLength + JavaServerFaces_48ValidateLongRange + JavaServerFaces_49ValidateDoubleRange + JavaServerFaces_50ValidateRequired + JavaServerFaces_51ValidateRegex + JavaServerFaces_52CustomValidation + JavaServerFaces_53CustomConverter + JavaServerFaces_54CustomValidator + JavaServerFaces_55ValidatorMultipleComponents + JavaServerFaces_56CompositeComponents + JavaServerFaces_57ValueChangeListener + JavaServerFaces_58ActionListener + JavaServerFaces_59PostConstructApplicationEvent + JavaServerFaces_60PreRenderViewEvent + JavaServerFaces_61ValidatorMultipleComponents + JavaServerFaces_62JDBCIntegration + JavaServerFaces_63Spring + JavaServerFaces_64SpringHibernateIntegration + + + + + com.sun.faces + jsf-api + 2.1.3 + + + com.sun.faces + jsf-impl + 2.1.3 + + + + javax.servlet + jstl + 1.2 + + + + javax.servlet + servlet-api + 2.5 + + + + javax.servlet.jsp + jsp-api + 2.1 + + + + com.sun.el + el-ri + 1.0 + + + + + + + JavaServerFaces + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.4 + + 1.6 + 1.6 + + + + \ No newline at end of file From 6bb26a86b1669e60ac53425afea61fab15a52bd6 Mon Sep 17 00:00:00 2001 From: ragrok Date: Fri, 28 Oct 2016 15:29:45 +0800 Subject: [PATCH 4/5] learn jsf 10-28 --- .../main/webapp/WEB-INF/faces-config.pageflow | 2 + JavaServerFaces_09ResourceBundles/pom.xml | 22 +- .../src/main/webapp/WEB-INF/faces-config.xml | 11 +- .../main/webapp/WEB-INF/faces-config.pageflow | 2 + JavaServerFaces_10Internationlization/pom.xml | 21 +- ...lcome.properties => welcome_en.properties} | 0 .../src/main/webapp/WEB-INF/faces-config.xml | 2 +- .../src/main/webapp/default.xhtml | 2 +- .../src/main/java/com/xxy/form/UserBean.java | 6 +- .../src/main/webapp/demo.xhtml | 4 +- JavaServerFaces_16RadioButtons/pom.xml | 2 +- .../src/main/java/com/xxy/UserBean.java | 7 +- JavaServerFaces_18MultiSelectListbox/pom.xml | 2 +- JavaServerFaces_19DropdownBox/pom.xml | 2 +- JavaServerFaces_21OutputText/pom.xml | 2 +- .../src/main/webapp/demo.xhtml | 26 +- JavaServerFaces_24OutputStyleSheet/pom.xml | 2 +- .../src/main/java/com/xxy/UserBean.java | 2 +- JavaServerFaces_25OutputScript/pom.xml | 2 +- JavaServerFaces_26ButtonCommanButton/pom.xml | 2 +- .../pom.xml | 2 +- JavaServerFaces_28PanelGrid/pom.xml | 21 +- .../src/main/webapp/default.xhtml | 52 ++-- JavaServerFaces_29Message/pom.xml | 21 +- JavaServerFaces_30Param/pom.xml | 21 +- .../src/main/java/com/xxy/UserBean.java | 23 +- .../src/main/webapp/default.xhtml | 46 ++-- JavaServerFaces_31Attribute/pom.xml | 21 +- .../src/main/java/com/xxy/UserBean.java | 35 ++- .../src/main/webapp/default.xhtml | 8 +- .../src/main/webapp/result.xhtml | 1 + JavaServerFaces_33DataTable/pom.xml | 2 +- pom.xml | 241 +++++++++--------- 33 files changed, 312 insertions(+), 303 deletions(-) create mode 100644 JavaServerFaces_09ResourceBundles/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow create mode 100644 JavaServerFaces_10Internationlization/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow rename JavaServerFaces_10Internationlization/src/main/resources/com.xxy/{welcome.properties => welcome_en.properties} (100%) diff --git a/JavaServerFaces_09ResourceBundles/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/JavaServerFaces_09ResourceBundles/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..12579d8 --- /dev/null +++ b/JavaServerFaces_09ResourceBundles/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,2 @@ + + diff --git a/JavaServerFaces_09ResourceBundles/pom.xml b/JavaServerFaces_09ResourceBundles/pom.xml index fceb597..700b337 100644 --- a/JavaServerFaces_09ResourceBundles/pom.xml +++ b/JavaServerFaces_09ResourceBundles/pom.xml @@ -1,15 +1,13 @@ - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 - - JavaServerFaces_09ResourceBundles -war + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 + JavaServerFaces_09ResourceBundles + war \ No newline at end of file diff --git a/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml index 1cb880f..92200f5 100644 --- a/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_09ResourceBundles/src/main/webapp/WEB-INF/faces-config.xml @@ -1,13 +1,12 @@ - + version="2.0"> - com.xxy.messages + com.xxy.messages.properties msg diff --git a/JavaServerFaces_10Internationlization/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow b/JavaServerFaces_10Internationlization/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow new file mode 100644 index 0000000..375b3b2 --- /dev/null +++ b/JavaServerFaces_10Internationlization/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow @@ -0,0 +1,2 @@ + + diff --git a/JavaServerFaces_10Internationlization/pom.xml b/JavaServerFaces_10Internationlization/pom.xml index 986270d..a881bed 100644 --- a/JavaServerFaces_10Internationlization/pom.xml +++ b/JavaServerFaces_10Internationlization/pom.xml @@ -1,15 +1,14 @@ - - - JavaServerFaces-parent - JavaServerFaces - 1.0-SNAPSHOT - - 4.0.0 + + + JavaServerFaces-parent + JavaServerFaces + 1.0-SNAPSHOT + + 4.0.0 - JavaServerFaces_10Internationlization -war + JavaServerFaces_10Internationlization + war \ No newline at end of file diff --git a/JavaServerFaces_10Internationlization/src/main/resources/com.xxy/welcome.properties b/JavaServerFaces_10Internationlization/src/main/resources/com.xxy/welcome_en.properties similarity index 100% rename from JavaServerFaces_10Internationlization/src/main/resources/com.xxy/welcome.properties rename to JavaServerFaces_10Internationlization/src/main/resources/com.xxy/welcome_en.properties diff --git a/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml b/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml index c24f584..b13f76b 100644 --- a/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml +++ b/JavaServerFaces_10Internationlization/src/main/webapp/WEB-INF/faces-config.xml @@ -10,7 +10,7 @@ en - com.xxy.welcome + com.xxy.welcome_en.properties msg diff --git a/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml b/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml index 3e8db6a..41fa5f2 100644 --- a/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml +++ b/JavaServerFaces_10Internationlization/src/main/webapp/default.xhtml @@ -23,7 +23,7 @@ - + diff --git a/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java b/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java index a4130a0..b356dd9 100644 --- a/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java +++ b/JavaServerFaces_14HiddenValue/src/main/java/com/xxy/form/UserBean.java @@ -8,7 +8,8 @@ @SessionScoped public class UserBean implements Serializable { - String answer = "I'm Hidden value!"; + private String answer = "I'm Hidden value!"; + public String getAnswer() { return answer; @@ -17,6 +18,5 @@ public String getAnswer() { public void setAnswer(String answer) { this.answer = answer; } - - + } \ No newline at end of file diff --git a/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml b/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml index 507727a..ce30b19 100644 --- a/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml +++ b/JavaServerFaces_14HiddenValue/src/main/webapp/demo.xhtml @@ -8,7 +8,9 @@