Seam SVN: r15054 - branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-16 06:52:51 -0400 (Thu, 16 Aug 2012)
New Revision: 15054
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
Log:
Test case for issue JBSEAM-4966
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-16 09:33:07 UTC (rev 15053)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-16 10:52:51 UTC (rev 15054)
@@ -40,7 +40,6 @@
Log log
@Factory
- @Observer(["bookingConfirmed"])
public void getBookings()
{
bookings = em.createQuery('''
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-16 09:33:07 UTC (rev 15053)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-16 10:52:51 UTC (rev 15054)
@@ -82,13 +82,19 @@
}
}
+ @Out (required=false, scope=ScopeType.SESSION)
+ List <Booking> bookings
+
@End
void confirm()
{
em.persist(booking)
facesMessages.add "Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}", new Object[0]
log.info("New booking: #{booking.id} for #{user.username}")
- events.raiseTransactionSuccessEvent("bookingConfirmed")
+ //events.raiseTransactionSuccessEvent("bookingConfirmed")
+
+ // force refresh
+ bookings = null
}
@End
12 years, 4 months
Seam SVN: r15053 - branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-16 05:33:07 -0400 (Thu, 16 Aug 2012)
New Revision: 15053
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml
Log:
Undoing last (accidentally committed) commit (15052)
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml 2012-08-16 09:28:55 UTC (rev 15052)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml 2012-08-16 09:33:07 UTC (rev 15053)
@@ -56,7 +56,8 @@
</page>
<page view-id="/hotel.xhtml"
- conversation-required="true">
+ conversation-required="true"
+ login-required="true">
<description>View hotel: #{hotel.name}</description>
12 years, 4 months
Seam SVN: r15052 - branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-16 05:28:55 -0400 (Thu, 16 Aug 2012)
New Revision: 15052
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml
Log:
Groovybooking example missing @Restrict on some actions
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml 2012-08-16 09:26:21 UTC (rev 15051)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml 2012-08-16 09:28:55 UTC (rev 15052)
@@ -56,8 +56,7 @@
</page>
<page view-id="/hotel.xhtml"
- conversation-required="true"
- login-required="true">
+ conversation-required="true">
<description>View hotel: #{hotel.name}</description>
12 years, 4 months
Seam SVN: r15051 - branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-16 05:26:21 -0400 (Thu, 16 Aug 2012)
New Revision: 15051
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy
Log:
Groovybooking example missing @Restrict on some actions
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-16 08:57:55 UTC (rev 15050)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-16 09:26:21 UTC (rev 15051)
@@ -16,9 +16,11 @@
import org.jboss.seam.log.Log
import org.jboss.seam.example.groovy.model.Booking
import org.jboss.seam.example.groovy.model.User
+import org.jboss.seam.annotations.security.Restrict
@Scope(ScopeType.SESSION)
@Name("bookingList")
+@Restrict("#{identity.loggedIn}")
class BookingListAction implements Serializable
{
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-16 08:57:55 UTC (rev 15050)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-16 09:26:21 UTC (rev 15051)
@@ -16,8 +16,10 @@
import org.jboss.seam.example.groovy.model.Booking
import org.jboss.seam.example.groovy.model.Hotel
import org.jboss.seam.example.groovy.model.User
+import org.jboss.seam.annotations.security.Restrict
@Name("hotelBooking")
+@Restrict("#{identity.loggedIn}")
class HotelBookingAction
{
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy 2012-08-16 08:57:55 UTC (rev 15050)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy 2012-08-16 09:26:21 UTC (rev 15051)
@@ -13,9 +13,11 @@
import org.jboss.seam.annotations.Factory
import org.jboss.seam.example.groovy.model.Hotel
+import org.jboss.seam.annotations.security.Restrict
@Name("hotelSearch")
@Scope(ScopeType.SESSION)
+@Restrict("#{identity.loggedIn}")
class HotelSearchingAction
{
12 years, 4 months
Seam SVN: r15050 - branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-16 04:57:55 -0400 (Thu, 16 Aug 2012)
New Revision: 15050
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
Log:
http://jira.codehaus.org/browse/GROOVY-2679
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-16 04:31:22 UTC (rev 15049)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-16 08:57:55 UTC (rev 15050)
@@ -38,7 +38,7 @@
Log log
@Factory
- @Observer("bookingConfirmed")
+ @Observer(["bookingConfirmed"])
public void getBookings()
{
bookings = em.createQuery('''
12 years, 4 months
Seam SVN: r15048 - in branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main: webapp and 3 other directories.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-15 10:28:58 -0400 (Wed, 15 Aug 2012)
New Revision: 15048
Added:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/display.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/edit.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/bookingExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/confirmExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/introExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/loginExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/mainExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/registerExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/workspaceExp.html
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotelview.xhtml
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/faces-config.xml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/web.xml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/book.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/confirm.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/conversations.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/css/screen.css
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/home.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotel.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/main.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/password.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/register.xhtml
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/template.xhtml
Log:
groovybooking updated to more reflect current booking
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-15 14:28:58 UTC (rev 15048)
@@ -9,6 +9,7 @@
import org.jboss.seam.annotations.Logger
import org.jboss.seam.annotations.Name
import org.jboss.seam.annotations.Scope
+import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.datamodel.DataModel
import org.jboss.seam.annotations.datamodel.DataModelSelection
import org.jboss.seam.faces.FacesMessages
@@ -37,6 +38,7 @@
Log log
@Factory
+ @Observer("bookingConfirmed")
public void getBookings()
{
bookings = em.createQuery('''
@@ -56,4 +58,9 @@
FacesMessages.instance().add("Booking cancelled for confirmation number #0", booking.getId())
}
+ public Booking getBooking()
+ {
+ return booking
+ }
+
}
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-15 14:28:58 UTC (rev 15048)
@@ -80,19 +80,13 @@
}
}
- @Out (required=false, scope=ScopeType.SESSION)
- List <Booking> bookings
-
@End
void confirm()
{
em.persist(booking)
facesMessages.add "Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}", new Object[0]
log.info("New booking: #{booking.id} for #{user.username}")
- // events.raiseTransactionSuccessEvent("bookingConfirmed")
-
- // force refresh in main.xhtml
- bookings = null
+ events.raiseTransactionSuccessEvent("bookingConfirmed")
}
@End
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -2,14 +2,12 @@
<components xmlns="http://jboss.org/schema/seam/components"
xmlns:core="http://jboss.org/schema/seam/core"
xmlns:persistence="http://jboss.org/schema/seam/persistence"
- xmlns:drools="http://jboss.org/schema/seam/drools"
xmlns:security="http://jboss.org/schema/seam/security"
xmlns:mail="http://jboss.org/schema/seam/mail"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://jboss.org/schema/seam/core http://jboss.org/schema/seam/core-2.3.xsd
- http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
- http://jboss.org/schema/seam/drools http://jboss.org/schema/seam/drools-2.3.xsd
+ http://jboss.org/schema/seam/persistence http://jboss.org/schema/seam/persistence-2.3.xsd
http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd
http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
@@ -31,13 +29,6 @@
<security:identity authenticate-method="#{authenticator.authenticate}"
remember-me="true"/>
-
- <event type="org.jboss.seam.security.notLoggedIn">
- <action execute="#{redirect.captureCurrentView}"/>
- </event>
- <event type="org.jboss.seam.security.loginSuccessful">
- <action execute="#{redirect.returnToCapturedView}"/>
- </event>
<mail:mail-session host="localhost" port="2525" username="test" password="test" />
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/faces-config.xml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/faces-config.xml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -3,4 +3,5 @@
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd">
+
</faces-config>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/jboss-deployment-structure.xml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/jboss-deployment-structure.xml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,12 +1,12 @@
-<jboss-deployment-structure>
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
- <!-- <module name="org.apache.log4j" />-->
- <module name="org.dom4j" />
-<!-- <module name="org.apache.commons.logging" />
- <module name="org.apache.commons.collections" />
- <module name="javax.faces.api"/>
- <module name="com.sun.jsf-impl"/>-->
+ <module name="org.apache.log4j" export="true"/>
+ <module name="org.dom4j" export="true"/>
+ <module name="org.apache.commons.logging" export="true"/>
+ <module name="org.apache.commons.collections" export="true"/>
+ <module name="javax.faces.api" export="true"/>
+ <module name="com.sun.jsf-impl" export="true"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/pages.xml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -8,8 +8,7 @@
<page view-id="/register.xhtml">
- <action if="#{validation.failed}"
- execute="#{register.invalid}"/>
+ <action if="#{validation.failed}" execute="#{register.invalid}"/>
<navigation>
<rule if="#{register.registered}">
@@ -19,12 +18,15 @@
</page>
- <page view-id="/home.xhtml">
+ <page view-id="/home.xhtml" action="#{identity.isLoggedIn}">
- <navigation>
- <rule if="#{identity.loggedIn}">
+ <navigation from-action="#{identity.isLoggedIn}">
+ <rule if-outcome="true">
<redirect view-id="/main.xhtml"/>
</rule>
+ <rule if-outcome="false">
+ <render view-id="/home.xhtml"/>
+ </rule>
</navigation>
</page>
@@ -33,7 +35,7 @@
login-required="true">
<navigation>
- <rule if="#{changePassword.changed}">
+ <rule if="#{identity.loggedIn and changePassword.changed}">
<redirect view-id="/main.xhtml"/>
</rule>
</navigation>
@@ -47,10 +49,15 @@
<redirect view-id="/hotel.xhtml"/>
</navigation>
+ <navigation from-action="#{bookingList.cancel}">
+ <redirect/>
+ </navigation>
+
</page>
- <page view-id="/hotel.xhtml"
- conversation-required="true">
+ <page view-id="/hotel.xhtml"
+ conversation-required="true"
+ login-required="true">
<description>View hotel: #{hotel.name}</description>
@@ -60,8 +67,9 @@
</page>
- <page view-id="/book.xhtml"
- conversation-required="true">
+ <page view-id="/book.xhtml"
+ conversation-required="true"
+ login-required="true">
<description>Book hotel: #{hotel.name}</description>
@@ -73,8 +81,9 @@
</page>
- <page view-id="/confirm.xhtml"
- conversation-required="true">
+ <page view-id="/confirm.xhtml"
+ conversation-required="true"
+ login-required="true">
<description>Confirm booking: #{booking.description}</description>
@@ -85,7 +94,6 @@
</page>
<page view-id="*">
-
<navigation from-action="#{identity.logout}">
<redirect view-id="/home.xhtml"/>
</navigation>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/web.xml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/web.xml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,74 +1,73 @@
-<?xml version="1.0" ?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- version="3.0">
-
- <context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>blueSky</param-value>
- </context-param>
-
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <display-name>Seam Booking Example</display-name>
+
<!-- Seam -->
-
+
<listener>
<listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
</listener>
-
- <filter>
- <filter-name>Seam Filter</filter-name>
- <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>Seam Filter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
-
<servlet>
<servlet-name>Seam Resource Servlet</servlet-name>
<servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
</servlet>
-
+
<servlet-mapping>
<servlet-name>Seam Resource Servlet</servlet-name>
<url-pattern>/seam/resource/*</url-pattern>
</servlet-mapping>
-
- <!-- Facelets development mode (disable in production) -->
-
- <context-param>
- <param-name>facelets.DEVELOPMENT</param-name>
- <param-value>true</param-value>
- </context-param>
-
+
+ <filter>
+ <filter-name>Seam Filter</filter-name>
+ <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>Seam Filter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
<!-- JSF -->
-
+
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
+ <!-- <context-param> -->
+ <!-- <param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name> -->
+ <!-- <param-value>true</param-value> -->
+ <!-- </context-param> -->
+
+ <!-- <context-param> -->
+ <!-- <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> -->
+ <!-- <param-value>com.sun.facelets.FaceletViewHandler</param-value> -->
+ <!-- </context-param> -->
+
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-
+
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
-
- <security-constraint>
- <display-name>Restrict raw XHTML Documents</display-name>
- <web-resource-collection>
- <web-resource-name>XHTML</web-resource-name>
- <url-pattern>*.xhtml</url-pattern>
- </web-resource-collection>
- <auth-constraint>
- <role-name>NONE</role-name>
- </auth-constraint>
- </security-constraint>
-
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
</web-app>
+
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/book.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/book.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/book.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -14,156 +14,89 @@
<h1>Book Hotel</h1>
</div>
<div class="section">
+ <div class="entry errors">
+ <s:message id="messages" globalOnly="true"/>
+ </div>
+
+ <ui:include src="hotelview.xhtml"/>
+
+ <div style="clear:both"/>
+
<h:form id="booking">
<fieldset>
- <div class="entry">
- <div class="label">Name:</div>
- <div class="output">#{hotel.name}</div>
- </div>
- <div class="entry">
- <div class="label">Address:</div>
- <div class="output">#{hotel.address}</div>
- </div>
- <div class="entry">
- <div class="label">City, State:</div>
- <div class="output">#{hotel.city}, #{hotel.state}</div>
- </div>
- <div class="entry">
- <div class="label">Zip:</div>
- <div class="output">#{hotel.zip}</div>
- </div>
- <div class="entry">
- <div class="label">Country:</div>
- <div class="output">#{hotel.country}</div>
- </div>
- <div class="entry">
- <div class="label">Nightly rate:</div>
- <div class="output">
- <h:outputText value="#{hotel.price}">
- <f:convertNumber type="currency"
- currencySymbol="$"/>
- </h:outputText>
- </div>
- </div>
-
- <s:validateAll>
-
- <f:facet name="aroundInvalidField">
- <s:span id="Error" styleClass="errors"/>
- </f:facet>
- <f:facet name="afterInvalidField">
- <s:div id="Message" styleClass="errors">
- <s:message/>
- </s:div>
- </f:facet>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="checkinDate">Check In Date:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="checkinDateDecorate">
- <rich:calendar id="checkinDate" value="#{booking.checkinDate}" required="true" datePattern="MM/dd/yyyy" event="onblur" reRender="checkinDateDecorate" style="width: auto;" />
- </s:decorate>
- </div>
- </div>
- <div class="entry">
- <div class="label"><h:outputLabel for="checkoutDate">Check Out Date:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="checkoutDateDecorate">
- <rich:calendar id="checkoutDate" value="#{booking.checkoutDate}" required="true" datePattern="MM/dd/yyyy" event="onblur" reRender="checkoutDateDecorate" style="width: auto;" />
- </s:decorate>
- </div>
- </div>
+ <s:decorate id="checkinDateDecorate" template="edit.xhtml">
+ <ui:define name="label">Check In Date:</ui:define>
+ <rich:calendar id="checkinDate" value="#{booking.checkinDate}" required="true" datePattern="MM/dd/yyyy" render="checkinDateDecorate" style="width: auto;" />
+ </s:decorate>
+
+ <s:decorate id="checkoutDateDecorate" template="edit.xhtml">
+ <ui:define name="label">Check Out Date:</ui:define>
+ <rich:calendar id="checkoutDate" value="#{booking.checkoutDate}" required="true" datePattern="MM/dd/yyyy" render="checkoutDateDecorate" style="width: auto;"/>
+ </s:decorate>
+
+ <s:decorate id="bedsDecorate" template="edit.xhtml">
+ <ui:define name="label">Room Preference:</ui:define>
+ <h:selectOneMenu id="beds" value="#{booking.beds}">
+ <f:selectItem id="OneKingBed" itemLabel="One king-size bed" itemValue="1"/>
+ <f:selectItem id="TwoDoubleBeds" itemLabel="Two double beds" itemValue="2"/>
+ <f:selectItem id="ThreeBeds" itemLabel="Three beds" itemValue="3"/>
+ </h:selectOneMenu>
+ </s:decorate>
+
+ <s:decorate id="smokingDecorate" template="edit.xhtml">
+ <ui:define name="label">Smoking Preference:</ui:define>
+ <h:selectOneRadio id="smoking" value="#{booking.smoking}" layout="pageDirection" styleClass="radio">
+ <f:selectItem id="Smoking" itemLabel="Smoking" itemValue="true"/>
+ <f:selectItem id="NonSmoking" itemLabel="Non Smoking" itemValue="false"/>
+ </h:selectOneRadio>
+ </s:decorate>
- <div class="entry">
- <div class="label"><h:outputLabel for="beds">Room Preference:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="bedsDecorate">
- <h:selectOneMenu id="beds" value="#{booking.beds}">
- <f:selectItem itemLabel="One king-size bed" itemValue="1"/>
- <f:selectItem itemLabel="Two double beds" itemValue="2"/>
- <f:selectItem itemLabel="Three beds" itemValue="3"/>
- </h:selectOneMenu>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="smoking">Smoking Preference:</h:outputLabel></div>
- <div id="radio" class="input">
- <s:decorate id="smokingDecorate">
- <h:selectOneRadio id="smoking" value="#{booking.smoking}" layout="pageDirection">
- <f:selectItem itemLabel="Smoking" itemValue="true"/>
- <f:selectItem itemLabel="Non Smoking" itemValue="false"/>
- </h:selectOneRadio>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="creditCard">Credit Card #:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="creditCardDecorate">
- <h:inputText id="creditCard" value="#{booking.creditCard}" required="true">
- <a:ajax event="blur" render="creditCardDecorate"/>
- </h:inputText>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="creditCardName">Credit Card Name:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="creditCardNameDecorate">
- <h:inputText id="creditCardName" value="#{booking.creditCardName}" required="true">
- <a:ajax event="blur" render="creditCardNameDecorate"/>
- </h:inputText>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="creditCardExpiryMonth">Credit Card Expiry:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="creditCardExpiryDecorate">
- <h:selectOneMenu id="creditCardExpiryMonth" value="#{booking.creditCardExpiryMonth}">
- <f:selectItem itemLabel="Jan" itemValue="1"/>
- <f:selectItem itemLabel="Feb" itemValue="2"/>
- <f:selectItem itemLabel="Mar" itemValue="3"/>
- <f:selectItem itemLabel="Apr" itemValue="4"/>
- <f:selectItem itemLabel="May" itemValue="5"/>
- <f:selectItem itemLabel="Jun" itemValue="6"/>
- <f:selectItem itemLabel="Jul" itemValue="7"/>
- <f:selectItem itemLabel="Aug" itemValue="8"/>
- <f:selectItem itemLabel="Sep" itemValue="9"/>
- <f:selectItem itemLabel="Oct" itemValue="10"/>
- <f:selectItem itemLabel="Nov" itemValue="11"/>
- <f:selectItem itemLabel="Dec" itemValue="12"/>
- </h:selectOneMenu>
- <h:selectOneMenu id="creditCardExpiryYear" value="#{booking.creditCardExpiryYear}">
- <f:selectItem itemLabel="2005" itemValue="2005"/>
- <f:selectItem itemLabel="2006" itemValue="2006"/>
- <f:selectItem itemLabel="2007" itemValue="2007"/>
- <f:selectItem itemLabel="2008" itemValue="2008"/>
- <f:selectItem itemLabel="2009" itemValue="2009"/>
- </h:selectOneMenu>
- </s:decorate>
- </div>
- </div>
-
- </s:validateAll>
+ <s:decorate id="creditCardDecorate" template="edit.xhtml">
+ <ui:define name="label">Credit Card #:</ui:define>
+ <h:inputText id="creditCard" value="#{booking.creditCard}" required="true">
+ <a:ajax event="blur" render="creditCardDecorate"/>
+ </h:inputText>
+ </s:decorate>
+
+ <s:decorate id="creditCardNameDecorate" template="edit.xhtml">
+ <ui:define name="label">Credit Card Name:</ui:define>
+ <h:inputText id="creditCardName" value="#{booking.creditCardName}" required="true">
+ <a:ajax event="blur" render="creditCardNameDecorate"/>
+ </h:inputText>
+ </s:decorate>
+
+ <s:decorate id="creditCardExpiryDecorate" template="edit.xhtml">
+ <ui:define name="label">Credit Card Expiry:</ui:define>
+ <h:selectOneMenu id="creditCardExpiryMonth" value="#{booking.creditCardExpiryMonth}">
+ <f:selectItem id="Jan" itemLabel="Jan" itemValue="1"/>
+ <f:selectItem id="Feb" itemLabel="Feb" itemValue="2"/>
+ <f:selectItem id="Mar" itemLabel="Mar" itemValue="3"/>
+ <f:selectItem id="Apr" itemLabel="Apr" itemValue="4"/>
+ <f:selectItem id="May" itemLabel="May" itemValue="5"/>
+ <f:selectItem id="Jun" itemLabel="Jun" itemValue="6"/>
+ <f:selectItem id="Jul" itemLabel="Jul" itemValue="7"/>
+ <f:selectItem id="Aug" itemLabel="Aug" itemValue="8"/>
+ <f:selectItem id="Sep" itemLabel="Sep" itemValue="9"/>
+ <f:selectItem id="Oct" itemLabel="Oct" itemValue="10"/>
+ <f:selectItem id="Nov" itemLabel="Nov" itemValue="11"/>
+ <f:selectItem id="Dec" itemLabel="Dec" itemValue="12"/>
+ </h:selectOneMenu>
+ <h:selectOneMenu id="creditCardExpiryYear" value="#{booking.creditCardExpiryYear}">
+ <f:selectItem id="Year2005" itemLabel="2005" itemValue="2005"/>
+ <f:selectItem id="Year2006" itemLabel="2006" itemValue="2006"/>
+ <f:selectItem id="Year2007" itemLabel="2007" itemValue="2007"/>
+ <f:selectItem id="Year2008" itemLabel="2008" itemValue="2008"/>
+ <f:selectItem id="Year2009" itemLabel="2009" itemValue="2009"/>
+ </h:selectOneMenu>
+ </s:decorate>
- <div class="entry errors">
- <h:messages globalOnly="true"/>
+ <div class="buttonBox">
+ <h:commandButton id="proceed" value="Proceed" action="#{hotelBooking.setBookingDetails}"/>
+  
+ <s:button id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
</div>
- <div class="entry">
- <div class="label"> </div>
- <div class="input">
- <h:commandButton id="proceed" value="Proceed" action="#{hotelBooking.setBookingDetails}"/> 
- <s:button id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
- </div>
- </div>
</fieldset>
</h:form>
</div>
@@ -171,6 +104,19 @@
<!-- sidebar -->
<ui:define name="sidebar">
+
+<h1>Workspace management</h1>
+<p>
+ As you can see, Seam makes it easy to work in multiple windows or multiple browser
+ tabs. But you can even switch between multiple tasks inside a single browser tab!
+ The "Workspaces" section showcases this advanced feature.
+</p>
+<p>
+ <a href="#" onclick="window.open('exp/workspaceExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the workspace list work?
+ </a>
+</p>
+
</ui:define>
</ui:composition>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/confirm.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/confirm.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/confirm.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -8,68 +8,67 @@
<!-- content -->
<ui:define name="content">
+
<div class="section">
<h1>Confirm Hotel Booking</h1>
</div>
+
<div class="section">
- <h:form id="confirm">
- <fieldset>
- <div class="entry">
- <div class="label">Name:</div>
- <div class="output">#{hotel.name}</div>
- </div>
- <div class="entry">
- <div class="label">Address:</div>
- <div class="output">#{hotel.address}</div>
- </div>
- <div class="entry">
- <div class="label">City, State:</div>
- <div class="output">#{hotel.city}, #{hotel.state}</div>
- </div>
- <div class="entry">
- <div class="label">Zip:</div>
- <div class="output">#{hotel.zip}</div>
- </div>
- <div class="entry">
- <div class="label">Country:</div>
- <div class="output">#{hotel.country}</div>
- </div>
- <div class="entry">
- <div class="label">Total payment:</div>
- <div class="output">
- <h:outputText value="#{booking.total}">
- <f:convertNumber type="currency"
- currencySymbol="$"/>
- </h:outputText>
- </div>
- </div>
- <div class="entry">
- <div class="label">Check In Date:</div>
- <div class="output"><h:outputText value="#{booking.checkinDate}"/></div>
- </div>
- <div class="entry">
- <div class="label">Check Out Date:</div>
- <div class="output"><h:outputText value="#{booking.checkoutDate}"/></div>
- </div>
- <div class="entry">
- <div class="label">Credit Card #:</div>
- <div class="output">#{booking.creditCard}</div>
- </div>
- <div class="entry">
- <div class="label"> </div>
- <div class="input">
- <h:commandButton id="confirm" value="Confirm" action="#{hotelBooking.confirm}"/> 
- <s:button id="revise" value="Revise" view="/book.xhtml"/> 
- <h:commandButton id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
- </div>
- </div>
- </fieldset>
- </h:form>
+
+ <ui:include src="hotelview.xhtml"/>
+
+ <s:decorate id="DecorateTotalPayment" template="display.xhtml">
+ <ui:define name="label">Total Payment:</ui:define>
+ <h:outputText id="BookingTotal" value="#{booking.total}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </s:decorate>
+
+ <s:decorate id="DecorateCheckInDate" template="display.xhtml">
+ <ui:define name="label">Check In Date:</ui:define>
+ <h:outputText id="BookingCheckinDate" value="#{booking.checkinDate}"/>
+ </s:decorate>
+
+ <s:decorate id="DecorateCheckoutDate" template="display.xhtml">
+ <ui:define name="label">Check Out Date:</ui:define>
+ <h:outputText id="BookingCheckoutDate" value="#{booking.checkoutDate}"/>
+ </s:decorate>
+
+ <s:decorate id="DecorateCreditCard" template="display.xhtml">
+ <ui:define name="label">Credit Card #:</ui:define>
+ #{booking.creditCard}
+ </s:decorate>
+
+ <div class="buttonBox">
+ <h:form id="confirm">
+ <h:commandButton id="confirm" value="Confirm" action="#{hotelBooking.confirm}"/>
+  
+ <s:button id="revise" value="Revise" view="/book.xhtml"/>
+  
+ <h:commandButton id="cancel" value="Cancel" action="#{hotelBooking.cancel}"/>
+ </h:form>
+ </div>
+
</div>
+
</ui:define>
<!-- sidebar -->
<ui:define name="sidebar">
+<h1>Back button navigation</h1>
+<p>
+ When you click "Confirm", the new booking is written to the database, the
+ conversation ends, and state associated with the conversation is automatically
+ destroyed by Seam. After you confirm your booking, try hitting the back button
+ on your web browser and clicking "Confirm" again. Seam makes it easy implement
+ applications that behave elegantly in response to the back, forward and refresh
+ buttons.
+</p>
+<p>
+ <a href="#" onclick="window.open('exp/confirmExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when the conversation ends?
+ </a>
+</p>
</ui:define>
</ui:composition>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/conversations.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/conversations.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/conversations.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,34 +1,38 @@
-<!-- DOCTYPE div PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
-<div xmlns="http://www.w3.org/1999/xhtml"
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:s="http://jboss.org/schema/seam/taglib">
-
-<div class="section">
- <h1><h:outputText rendered="#{not empty conversationList}" value="Workspaces"/></h1>
-</div>
-
-<div class="section">
- <h:form id="ConversationListForm">
- <h:dataTable id="ConversationListDataTable" value="#{conversationList}" var="entry">
- <h:column id="column1">
- <h:commandLink id="EntryDescriptionLink" action="#{entry.select}" value="#{entry.description}"/>
-  
- <h:outputText id="CurrentEntry" value="[current]" rendered="#{entry.current}"/>
- </h:column>
- <h:column id="column2">
- <h:outputText id="EntryStartDateTime" value="#{entry.startDatetime}">
- <f:convertDateTime type="time" pattern="hh:mm"/>
- </h:outputText>
- -
- <h:outputText id="EntryLastDateTime" value="#{entry.lastDatetime}">
- <f:convertDateTime type="time" pattern="hh:mm"/>
- </h:outputText>
- </h:column>
- </h:dataTable>
- </h:form>
-</div>
-
-</div>
+ <div>
+
+ <div class="section">
+ <h1><h:outputText rendered="#{not empty conversationList}" value="Workspaces"/></h1>
+ </div>
+
+ <div class="section">
+ <h:form id="ConversationListForm">
+ <h:dataTable id="ConversationListDataTable" value="#{conversationList}" var="entry">
+ <h:column id="column1">
+ <h:commandLink id="EntryDescriptionLink" action="#{entry.select}" value="#{entry.description}"/>
+  
+ <h:outputText id="CurrentEntry" value="[current]" rendered="#{entry.current}"/>
+ </h:column>
+ <h:column id="column2">
+ <h:outputText id="EntryStartDateTime" value="#{entry.startDatetime}">
+ <!--<s:convertDateTime type="time" pattern="kk:mm:ss"/>-->
+ <f:convertDateTime type="time" pattern="kk:mm:ss"/>
+ </h:outputText>
+ -
+ <h:outputText id="EntryLastDateTime" value="#{entry.lastDatetime}">
+ <!--<s:convertDateTime type="time" pattern="hh:mm"/>-->
+ <f:convertDateTime type="time" pattern="kk:mm:ss"/>
+ </h:outputText>
+ </h:column>
+ </h:dataTable>
+ </h:form>
+ </div>
+
+ </div>
+</ui:composition>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/css/screen.css
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/css/screen.css 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/css/screen.css 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,6 +1,6 @@
/* Setup defaults since variable in browsers
----------------------------------------------- */
-body, div, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
+body, div, span, dd, dt, dl, img, ul, ol, li, p, h1, h2, h3, h4, h5, form, hr, fieldset {
margin: 0;
padding: 0;
}
@@ -24,7 +24,7 @@
margin-left: auto;
margin-right: auto;
}
-label {
+.label {
font-weight: bold;
color: #5E5147;
}
@@ -39,7 +39,8 @@
padding: 4px;
margin: 5px 0;
background: #fff url(../img/input.bg.gif) 0 0 repeat-x;
-}ol, ul {
+}
+ol, ul {
margin: 10px 0px 10px 6px;
}
li {
@@ -110,23 +111,27 @@
}
.entry .label {
float: left;
- padding-top: 10px;
padding-right: 5px;
font-weight: bold;
width: 150px;
text-align: right;
}
.entry .output {
- float: left;
- width: 250px;
+ float: right;
+ width: 360px;
padding-top: 10px;
text-align: left;
}
.entry .input {
- float: left;
- width: 250px;
+ float: right;
+ width: 360px;
text-align: left;
}
+.entry .error {
+ float: right;
+ width: 360px;
+ text-align: left;
+}
/* Sidebar
----------------------------------------------- */
.notes {
@@ -146,6 +151,9 @@
.errors div {
text-align: left;
}
+.errors span {
+ text-align: left;
+}
.errors input {
border: 1px solid #600;
}
@@ -155,6 +163,7 @@
.buttonBox {
text-align: center;
padding: 5px 0;
+ clear: both;
}
#sidebar p {
font-size: small;
@@ -228,12 +237,12 @@
float: left;
width: 66%;
}
-#radio table {
+#content table.radio {
border: 0px;
}
#content .input table,
#content .input tbody tr td,
-#radio table tr td {
+#content table.radio tbody tr td {
border: 0px;
border-left: 0px;
border-bottom: 0px;
@@ -269,6 +278,3 @@
#pgHome #content {
margin-top: 183px;
}
-#pgHome #sidebar input[type="submit"] {
- height: 30px;
-}
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/display.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/display.xhtml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/display.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,16 @@
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.org/schema/seam/taglib">
+
+ <div class="entry">
+ <span class="label">
+ <ui:insert name="label"/>
+ </span>
+ <span class="input">
+ <ui:insert/>
+ </span>
+ </div>
+
+</ui:composition>
\ No newline at end of file
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/edit.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/edit.xhtml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/edit.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,21 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.org/schema/seam/taglib">
+
+ <div class="entry">
+ <s:label id="Label" styleClass="label #{invalid?'errors':''}">
+ <ui:insert name="label"/>
+ <s:span id="RequiredStyle" styleClass="required" rendered="#{required}">*</s:span>
+ </s:label>
+ <span class="input #{invalid?'errors':''}">
+ <s:validateAll id="ValidateAll">
+ <ui:insert/>
+ </s:validateAll>
+ </span>
+ <s:message id="message" styleClass="error errors" globalOnly="true"/>
+ </div>
+
+</ui:composition>
\ No newline at end of file
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/bookingExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/bookingExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/bookingExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,161 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">5</div>
+ <h2>Conversations</h2>
+ <img src="../img/header_line.gif" />
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ <p>
+ The hotel booking "wizard" is implemented by a conversation-scoped
+ stateful session bean. All Seam components are in the
+ conversation scope by default.
+ The <code>HotelBookingAction</code> maintains
+ state associated with the booking process in the Seam conversation
+ scope. This ensures that if the user is working in multiple brower
+ tabs or multiple brower windows, the various conversations are
+ completely isolated from each other.
+ </p>
+ <p>
+ To see this working in practice, right click on the "View Hotel" button
+ in the search screen and select "open in new tab" or "open in new window",
+ and try working on multiple hotel bookings simultaneously.
+ In the <a href="workspaceExp.html">next step</a>, we will discuss
+ Seam's built-in components to manage multiple concurrent conversations.
+ </p>
+
+<code class="block">
+@Stateful
+@Name("hotelBooking")
+@LoggedIn
+public class HotelBookingAction implements HotelBooking
+{
+
+ @PersistenceContext(type=EXTENDED)
+ private EntityManager em;
+
+ @In
+ private User user;
+
+ @In(required=false) @Out
+ private Hotel hotel;
+
+ @In(required=false)
+ @Out(required=false)
+ private Booking booking;
+
+ @In(create=true)
+ private FacesMessages facesMessages;
+
+ @In(create=true)
+ private Events events;
+
+ @In
+ private HotelSearching hotelSearch;
+
+ @Logger
+ private Log log;
+
+ private boolean bookingValid;
+
+ @Begin
+ public void selectHotel(Hotel selectedHotel)
+ {
+ hotel = em.merge(selectedHotel);
+ }
+
+ public void bookHotel()
+ {
+ booking = new Booking(hotel, user);
+ Calendar calendar = Calendar.getInstance();
+ booking.setCheckinDate( calendar.getTime() );
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ booking.setCheckoutDate( calendar.getTime() );
+ }
+
+
+ public void setBookingDetails()
+ {
+ Calendar calendar = Calendar.getInstance();
+ calendar.add(Calendar.DAY_OF_MONTH, -1);
+ if ( booking.getCheckinDate().before( calendar.getTime() ) )
+ {
+ facesMessages.addToControl("checkinDate", "Check in date must be a future date");
+ bookingValid=false;
+ }
+ else if ( !booking.getCheckinDate().before( booking.getCheckoutDate() ) )
+ {
+ facesMessages.addToControl("checkoutDate", "Check out date must be later than check in date");
+ bookingValid=false;
+ }
+ else
+ {
+ bookingValid=true;
+ }
+ }
+
+ public boolean isBookingValid()
+ {
+ return bookingValid;
+ }
+
+ @End
+ public void confirm()
+ {
+ em.persist(booking);
+ facesMessages.add("Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}");
+ log.info("New booking: #{booking.id} for #{user.username}");
+ events.raiseTransactionSuccessEvent("bookingConfirmed");
+ }
+
+ @End
+ public void cancel() {}
+
+ @Remove
+ public void destroy() {}
+}</code>
+
+ <p>
+ The conversation begins when the <code>@Begin</code> annotated
+ <code>selectHotel()</code> is called, and ends when
+ the <code>@End</code> annotated
+ <code>confirm()</code> or <code>cancel()</code> is called. Between the
+ <code>@Begin</code> and <code>@End</code> methods, the user can do
+ any number of things with the application (i.e., invoke any
+ event handler method or use the BACK button etc.) and the
+ <code>hotelBooking</code> maintains its state throughout the process.
+ When the <code>@End</code> method is called, Seam destroys this
+ component and avoids any memory leak.
+ </p>
+
+ <p>
+ However, none of the <code>HotelBookingAction</code> bean methods
+ may be called outside of a long-running conversation.
+ So if we try to use the
+ back button after the end of the conversation, Seam will redirect to the main page, with an
+ error message.
+ </p>
+
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ </div>
+</div>
+
+</body>
+</html>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/confirmExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/confirmExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/confirmExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,104 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">7</div>
+ <h2>Ending Conversations</h2>
+ <img src="../img/header_line.gif" />
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ <p>
+ The "Confirm" button is bound to the action method <code>confirm()</code>
+ of <code>HotelBookingAction</code>.
+ </p>
+
+<code class="block">
+<h:commandButton value="Confirm"
+ action="#{hotelBooking.confirm}"
+ id="confirm"/>
+</code>
+
+ <p>
+ The <code>confirm()</code> method is tagged with the <code>@End</code> annotation,
+ which ends the long-running conversation and results in all state associated with
+ the conversation being destroyed at the end of the request.
+ Since the <code>pages.xml</code> file specifies a redirect for this action, the state
+ will not be destroyed
+ until <em>after the redirect completes</em>. Note that even the success message
+ that we create using the built-in <code>facesMessages</code> component is transparently
+ propagated across the redirect!
+ </p>
+
+<code class="block">
+ @End
+ public void confirm()
+ {
+ if (booking==null || hotel==null) return "main";
+ em.persist(booking);
+ facesMessages.add("Thank you, #{user.name}, your confimation number " +
+ "for #{hotel.name} is #{booking.id}");
+ log.info("New booking: #{booking.id} for #{user.username}");
+ events.raiseEvent("bookingConfirmed");
+ }
+
+ @End
+ public void cancel() {}
+
+ @Destroy @Remove
+ public void destroy() {}
+}
+</code>
+
+ <p>
+ When the conversation state is finally destroyed, Seam calls the <code>@Destroy</code> method,
+ which results in removal of the SFSB.
+ </p>
+
+ <p>
+ Notice that the <code>HotelBookingAction.confirm()</code> method
+ raises a <code>bookingConfirmed</code> event before it finishes. The
+ event mechanism allows Seam components to communicate with each other
+ without direct coupling. In this case, the <code>BookingListAction</code>
+ component captures the <code>bookingConfirmed</code> event and refreshes
+ the existing booking list for the current user.
+ </p>
+
+<code class="block">
+public class BookingListAction implements BookingList, Serializable
+{
+
+ ... ...
+
+ @Factory
+ @Observer("bookingConfirmed")
+ public void getBookings()
+ {
+ bookings = em.createQuery("from Booking b where b.user.username = " +
+ ":username order by b.checkinDate")
+ .setParameter("username", user.getUsername())
+ .getResultList();
+ }
+}
+</code>
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ </div>
+</div>
+
+</body>
+</html>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/introExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/introExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/introExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,73 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">1</div>
+ <h2>What is JBoss Seam</h2>
+ <img src="../img/header_line.gif" />
+
+ <p>
+ <center>
+ <form>
+ <INPUT type="button" value="Close Window" onclick="window.close()">
+ </form>
+ </center>
+ </p>
+
+ <p>
+ EJB 3.0 and JSF are perhaps the most exciting new developments in the Java EE 5 platform.
+ Seam is an innovative new application framework that integrates the EJB 3.0 component model
+ with JSF as a presentation tier. Seam builds upon the standard extension points provided by
+ both specifications and provides a set of Java annotations that extends the standard
+ annotations defined by the EJB specification. In addition, Seam introduces several innovative
+ new ideas: managed conversations, declarative and contextual application state management,
+ bijection and integrated business process management.
+ </p>
+
+ <p>
+ Traditional web applications are incredibly vulnerable to bugs and performance problems
+ relating to state management. Developers are forced to handle issues like back button
+ navigation, multi-window browsing, session size management in an utterly ad-hoc fashion.
+ Access to transactional components from the web tier has also been problematic. J2EE
+ provided no way to have simultaneous access to state held in contexts associated with
+ the web request, and state held in transactional resources accessed via EJB. Finally,
+ J2EE had no first-class construct for representing state associated with a long-running
+ business process. Seam tackles all these problems, and provides a uniform model for
+ stateful components in Java EE 5.
+ </p>
+
+ <p>
+ Like all JBoss software, this entire software stack is free. The full source code of this
+ sample application is available in the <code>examples/booking</code> directory of the
+ <a href="http://www.jboss.com/products/list/downloads#seam">Seam distribution</a>.
+ <!--
+ There is even a
+ <a target="_blank" href="http://docs.jboss.com/TrailBlazer/seam-booking/Seam.htm">
+ 10-minute flash demo
+ </a>
+ showing how to build a Seam web application from ground up.
+ -->
+ </p>
+
+ <p>
+ <center>
+ <form>
+ <INPUT type="button" value="Close Window" onclick="window.close()">
+ </form>
+ </center>
+ </p>
+
+ </div>
+</div>
+
+</body>
+</html>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/loginExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/loginExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/loginExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,161 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">2</div>
+ <h2>What happens when you login?</h2>
+ <img src="../img/header_line.gif" />
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ <p>
+ The login page is defined using pure XHTML with JSF controls.
+ The form uses JSF EL value binding and method binding
+ expressions to refer to Seam components. For example,
+ <code>#{identity.username}</code> refers to a property of the
+ <code>Identity</code> component and <code>#{identity.login}</code>
+ refers to a method of the <code>Identity</code> component.
+ </p>
+
+<code class="block">
+<div>
+ <h:outputLabel for="username">Login Name</h:outputLabel>
+ <h:inputText id="username" value="#{identity.username}" />
+</div>
+<div>
+ <h:outputLabel for="password">Password</h:outputLabel>
+ <h:inputSecret id="password" value="#{identity.password}" />
+</div>
+
+... ...
+
+<div class="buttonBox">
+ <h:commandButton id="login"
+ action="#{identity.login}"
+ value="Account Login" />
+</div>
+</code>
+
+ <p>
+ After logging in, the <code>User</code> enity bean is mapped to the Seam
+ context variable named <code>user</code> bean via the
+ <code>@Name</code> annotation. <code>User</code> is
+ a session scoped bean, meaning that the <code>user</code>
+ component value is retained for the entire session for
+ each user. You might also notice there are validation annotation
+ on the data properties. We will discuss those annotations in the
+ <a href="registerExp.html">next step</a>.
+ </p>
+
+<code class="block">
+@Entity
+@Name("user")
+@Scope(SESSION)
+public class User implements Serializable {
+ private String username;
+ private String password;
+ private String name;
+
+ @NotNull
+ @Length(min=5, max=15)
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+
+ @Id
+ @Length(min=4, max=15)
+ @Pattern(regex="^\\w*$", message="not a valid username")
+ public String getUsername () {
+ return username;
+ }
+ public void setUsername (String username) {
+ this.username = username;
+ }
+
+ // ... ...
+}
+</code>
+
+ <p>
+ Seam comes with its own Security framework, based on JAAS. It allows you
+ to perform user authentication by configuring your own authentication method
+ in <code>components.xml</code>.
+ </p>
+
+<code class="block">
+ <security:identity authenticate-method="#{authenticator.authenticate}"/>
+</code>
+
+ <p>
+ <code>AuthenticatorAction</code> is an EJB 3.0 session bean mapped
+ to the Seam context variable named <code>authenticator</code>. When
+ the login button is clicked, the JSF method binding
+ <code>#{identity.login}</code> is evaluated, and based upon the previous configuration, the
+ <code>authenticate()</code> method is invoked upon <code>AuthenticatorAction</code>.
+ </p>
+
+<code class="block">
+@Stateless
+@Scope(EVENT)
+@Name("authenticator")
+public class AuthenticatorAction implements Authenticator
+{
+ @PersistenceContext EntityManager em;
+
+ @Out(required=false, scope = SESSION)
+ private User user;
+
+ public boolean authenticate()
+ {
+ List results = em.createQuery("select u from User u where" +
+ " u.username=#{identity.username}" +
+ " and u.password=#{identity.password}")
+ .getResultList();
+
+ if ( results.size()==0 )
+ {
+ return false;
+ }
+ else
+ {
+ user = (User) results.get(0);
+ return true;
+ }
+ }
+}
+</code>
+
+ <p>
+ The <code>@Out</code>
+ annotation indicates the <code>AuthenticatorAction</code> bean can change the
+ value of the <code>user</code> context variable and make the new instance
+ available to other session beans and JSF pages. The query expression
+ makes use of a special syntax in Seam that allows EL expressions to
+ serve as query parameters. This query references the <code>identity</code> component,
+ a built-in Seam component that provides security functionality.
+ </p>
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ </div>
+</div>
+
+</body>
+</html>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/mainExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/mainExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/mainExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,214 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">4</div>
+ <h2>Stateful components</h2>
+ <img src="../img/header_line.gif" />
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ <p>
+ The hotel search page is backed by the a stateful session bean named
+ <code>hotelSearch</code> and implemented by the class
+ <code>HotelSearchingAction</code>.
+ </p>
+
+<code class="block">
+<h:inputText id="searchString" value="#{hotelSearch.searchString}" >
+ <a:support event="onkeyup" actionListener="#{hotelSearch.find}"
+ reRender="searchResults"/>
+</h:inputText>
+
+<h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
+ <f:selectItem itemLabel="5" itemValue="5"/>
+ <f:selectItem itemLabel="10" itemValue="10"/>
+ <f::selectItem itemLabel="20" itemValue="20"/>
+</h:selectOneMenu>
+</code>
+
+ <p>
+ When the button is clicked, the form is submitted and JSF sets the value
+ of the text box and drop down menu onto the <code>searchString</code> and
+ <code>pageSize</code> attributes of <code>HotelSearchingAction</code>
+ before calling the <code>find()</code> action listener method. We've used a
+ session-scope stateful bean because we want it's state (the search results) to
+ be held in the session between requests to the server. The <code><a:support></code>
+ tax specfies that after a keypress, the contents of the <code><a:outputPanel></code> whose
+ id is <code>searchResults</code> should be rerendererd. This is done through an AJAX-style
+ call back to the server with no additional code required of the application.
+ </p>
+
+<code class="block">
+@Stateful
+@Name("hotelSearch")
+(a)Scope(ScopeType.SESSION)
+@LoggedIn
+public class HotelSearchingAction implements HotelSearching
+{
+ @PersistenceContext
+ private EntityManager em;
+
+ private String searchString;
+ private int pageSize = 10;
+ private int page;
+
+ @DataModel
+ private List<Hotel> hotels;
+
+ public void find()
+ {
+ page = 0;
+ queryHotels();
+ }
+ public void nextPage()
+ {
+ page++;
+ queryHotels();
+ }
+
+ private void queryHotels()
+ {
+ hotels = em.createQuery("select h from Hotel h where lower(h.name) " +
+ "like #{pattern} or lower(h.city) like #{pattern} " +
+ "or lower(h.zip) like #{pattern} or " +
+ "lower(h.address) like #{pattern}")
+ .setMaxResults(pageSize)
+ .setFirstResult( page * pageSize )
+ .getResultList();
+ }
+
+ public boolean isNextPageAvailable()
+ {
+ return hotels!=null && hotels.size()==pageSize;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(int pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ @Factory(value="pattern", scope=ScopeType.EVENT)
+ public String getSearchPattern()
+ {
+ return searchString==null ?
+ "%" : '%' + searchString.toLowerCase().replace('*', '%') + '%';
+ }
+
+ public String getSearchString()
+ {
+ return searchString;
+ }
+
+ public void setSearchString(String searchString)
+ {
+ this.searchString = searchString;
+ }
+
+ @Remove
+ public void destroy() {}
+}</code>
+
+ <p>
+ The <code>find()</code> method retrieves a list of hotels from the database and
+ initializes the <code>hotels</code> field. The <code>hotels</code> field is marked
+ with the <code>@DataModel</code> annotation, so when the <code>find()</code> method
+ returns, Seam outjects an instance of <code>ListDataModel</code> to a context
+ variable named <code>hotels</code>. So, when the search page is re-rendered, the
+ result list is available to the JSF <code>dataTable</code>.
+ Each row of the data table has an associated command button or link
+ (see below).
+ </p>
+
+<code class="block">
+<h:outputText value="No Hotels Found"
+ rendered="#{hotels != null and hotels.rowCount==0}"/>
+<h:dataTable value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
+ <h:column>
+ <f:facet name="header">Name</f:facet>
+ #{hot.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Address</f:facet>
+ #{hot.address}
+ </h:column>
+ <h:column>
+ <f:facet name="header">City, State</f:facet>
+ #{hot.city}, #{hot.state}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Zip</f:facet>
+ #{hot.zip}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Action</f:facet>
+ <s:link value="View Hotel"
+ action="#{hotelBooking.selectHotel(hot)}"/>
+ </h:column>
+</h:dataTable>
+</code>
+
+ <p>
+ The "View Hotel" link is the above mentioned command link associated
+ with each row of the data table. It is implemented
+ using a Seam <code><s:link></code>, which is part of Seam's
+ extension of JSF controls.
+ This JSF control let's us call an action, and pass a request parameter, without
+ submitting any JSF form. The advantage of <code><s:link></code> is that,
+ unlike a standard JSF <code><h:commandLink></code>, there is no JavaScript
+ used, so "open link in new tab" works seamlessly.
+ </p>
+ <p>
+ When this link is clicked, the <code>selectHotel()</code> method of the
+ <code>HotelBookingAction</code> bean is called with the <code>hot</code>
+ parameter that is specified in the query. The parameter values are evaluated
+ at invocation time, not when the link is generated, so the <code><s:link></code>
+ tag adds a dataModelSelection parameter that indicates the value of the
+ <code>hot</code> loop variable for the given row.</p>
+ <p> The <code>selectHotel()</code> method merges the selected hotel into
+ the current persistence context (in case the same
+ hotel has been accessed before in the same session),
+ and starts a Seam conversation. We will discuss Seam conversations
+ in the next step.
+ </p>
+
+<code class="block">
+@Stateful
+@Name("hotelBooking")
+@LoggedIn
+public class HotelBookingAction implements HotelBooking
+{
+
+ ... ...
+
+ @Begin
+ public void selectHotel(Hotel selectedHotel)
+ {
+ hotel = em.merge(selectedHotel);
+ }
+}
+</code>
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ </div>
+</div>
+
+</body>
+</html>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/registerExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/registerExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/registerExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,229 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">3</div>
+ <h2>What happens in the registration process?</h2>
+ <img src="img/header_line.gif" />
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ <p>
+ The register.xhtml JSF form captures the user input for new account
+ registration. It validates the user input, binds the data to a
+ Seam data component, and invokes a Seam UI event handler method
+ when the form is submitted.
+ </p>
+
+<code class="block">
+<s:validateAll>
+<div class="entry">
+ <div class="label">
+ <h:outputLabel for="username">Username:</h:outputLabel>
+ </div>
+ <div class="input">
+ <h:inputText id="username" value="#{user.username}"/><br/>
+ <span class="errors"><h:message for="username" /></span>
+ </div>
+</div>
+<div class="entry">
+ <div class="label">
+ <h:outputLabel for="name">Real Name:</h:outputLabel>
+ </div>
+ <div class="input">
+ <h:inputText id="name" value="#{user.name}" /><br/>
+ <span class="errors"><h:message for="name" /></span>
+ </div>
+</div>
+</s:validateAll>
+
+... ...
+
+ <div class="input">
+ <h:commandButton value="Register"
+ action="#{register.register}"
+ class="button"/>
+ <h:commandButton value="Cancel" action="login" class="button"/>
+ </div>
+</code>
+
+ <p>
+ The form fields are bound to properties of a Seam component named
+ <code>user</code> via JSF EL value binding expressions such as
+ <code>#{user.username}</code>. The form submit button is bound
+ to the <code>register()</code> method of the Seam component named
+ <code>register</code> using the JSF method binding expression
+ <code>#{register.register}</code>.
+ </p>
+
+ <p>
+ Notice that the input fields are enclosed by a <code><s:validateAll</code>
+ tag. This tag is part of Seam's extension to JSF. It tells the Seam
+ runtime to validate those input fields when the form is submitted.
+ The validation conditions are specified on the entity bean classes
+ those input fields map to (e.g., here the validation condition is
+ on the <code>User</code> class, see later).
+ This JSF form also includes <code><h:message></code> tags that
+ will display the results of any JSF validation failures.
+ </p>
+
+ <p>
+ The <code>User</code> class is an EJB 3.0 entity bean with a
+ <code>@Name</code> annotation that binds the bean instance to a
+ context variable named <code>user</code>. In addition to the standard
+ EJB 3.0 O/R mapping metadata, this bean features several Hibernate
+ Validator annotations such as
+ <code>@NotNull</code>, <code>@Length</code>. Due to the
+ <code><s:validateAll</code> tag in the form, these constraints are
+ automatically validated by Seam when the form is submitted. If the user
+ enters invalid data in the JSF form, the form will be redisplayed with
+ error messages.
+ </p>
+
+<code class="block">
+@Entity
+@Name("user")
+@Scope(SESSION)
+public class User implements Serializable
+{
+ private String username;
+ private String password;
+ private String name;
+
+ public User(String name, String password, String username)
+ {
+ this.name = name;
+ this.password = password;
+ this.username = username;
+ }
+
+ public User() {}
+
+ @NotNull
+ @Length(max=100)
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ @NotNull
+ @Length(min=5, max=15)
+ public String getPassword()
+ {
+ return password;
+ }
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ @Id
+ @Length(min=5, max=15)
+ public String getUsername()
+ {
+ return username;
+ }
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+}</code>
+
+ <p>
+ <code>RegisterAction</code> is an EJB 3.0 stateful session bean
+ bound to the Seam context variable named <code>register</code>.
+ The <code>register()</code> method is invoked when the form is
+ submitted.
+ </p>
+
+<code class="block">
+@Stateful
+@Scope(EVENT)
+@Name("register")
+public class RegisterAction implements Register
+{
+
+ @In
+ private User user;
+
+ @PersistenceContext
+ private EntityManager em;
+
+ @In(create=true)
+ private transient FacesMessages facesMessages;
+
+ private String verify;
+
+ public String register()
+ {
+ if ( user.getPassword().equals(verify) )
+ {
+ List existing = em.createQuery("select username from User " +
+ "where username=:username")
+ .setParameter("username", user.getUsername())
+ .getResultList();
+ if (existing.size()==0)
+ {
+ em.persist(user);
+ return "login";
+ }
+ else
+ {
+ facesMessages.add("username #{user.username} already exists");
+ return null;
+ }
+ }
+ else
+ {
+ facesMessages.add("re-enter your password");
+ verify=null;
+ return null;
+ }
+ }
+
+ public String getVerify()
+ {
+ return verify;
+ }
+
+ public void setVerify(String verify)
+ {
+ this.verify = verify;
+ }
+
+ @Destroy @Remove
+ public void destroy() {}
+}</code>
+
+ <p>
+ The <code>@In</code> annotations inject Seam components into the <code>RegisterAction</code>
+ bean. The <code>user</code> component is our entity bean, of course. The <code>facesMessages</code>
+ component is a built-in Seam component that makes it very easy to display templated and localized
+ messages to the user, even when redirect after post is used.
+ </p>
+
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+
+ </div>
+</div>
+
+</body>
+</html>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/workspaceExp.html
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/workspaceExp.html (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/exp/workspaceExp.html 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,92 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>In-depth Explanation</title>
+ <link href="../css/trailblazer_main.css" rel="stylesheet" type="text/css" />
+</head>
+
+<body>
+
+<div id="main">
+ <div class="trail">
+ <div class="numbox">6</div>
+ <h2>The Workspace List</h2>
+ <img src="../img/header_line.gif" />
+
+ <p>
+ <center>
+ <form>
+ <INPUT type="button" value="Close Window" onclick="window.close()">
+ </form>
+ </center>
+ </p>
+
+ <p>
+ The workspace list allows the user to switch between multiple
+ conversations from the same browser tab. There is no Java code
+ to write, just the following JSF code to include:
+ </p>
+
+<code class="block">
+<h:dataTable value="#{conversationList}" var="entry">
+ <h:column>
+ <h:commandLink action="#{entry.select}" value="#{entry.description}"/>
+
+ <h:outputText value="[current]" rendered="#{entry.current}"/>
+ </h:column>
+ <h:column>
+ <h:outputText value="#{entry.startDatetime}">
+ <f:convertDateTime type="time" pattern="hh:mm"/>
+ </h:outputText>
+ -
+ <h:outputText value="#{entry.lastDatetime}">
+ <f:convertDateTime type="time" pattern="hh:mm"/>
+ </h:outputText>
+ </h:column>
+</h:dataTable>
+</code>
+
+ <p>
+ We do need to specify what text will be displayed by <code>#{entry.description}</code>.
+ We do this by setting the <code>description</code> value for each page in <code>pages.xml</code>.
+ </p>
+
+<code class="block">
+<pages>
+ <!-- ... -->
+ <page view-id="/hotel.xhtml"
+ conversation-required="true"
+ login-required="true">
+
+ <description>View hotel: #{hotel.name}</description>
+ <!-- ... -->
+ </page>
+
+ <page view-id="/book.xhtml"
+ conversation-required="true"
+ login-required="true">
+
+ <description>Book hotel: #{hotel.name}</description>
+ <!-- ... -->
+ </page>
+<pages>
+</code>
+
+ <p>
+ Note that you don't need the <code>pages.xml</code> file if you don't want the
+ workspace list in your application.
+ </p>
+
+ <p>
+ <form>
+ <input type="button" value="Close Window" onclick="window.close()"/>
+ </form>
+ </p>
+
+ </div>
+</div>
+
+</body>
+</html>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/home.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/home.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/home.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<h:html xmlns="http://www.w3.org/1999/xhtml"
+<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
@@ -9,7 +9,7 @@
<title>JBoss Suites: Seam Framework</title>
<link href="css/screen.css" rel="stylesheet" type="text/css" />
</h:head>
-<h:body id="pgHome">
+<body id="pgHome">
<f:view>
<div id="document">
<div id="header">
@@ -20,16 +20,16 @@
<h:form id="login">
<fieldset>
<div>
- <h:outputLabel for="username">Login Name</h:outputLabel>
+ <h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
<h:inputText id="username" value="#{identity.username}" style="width: 175px;"/>
- <div class="errors"><h:message for="username"/></div>
+ <div class="errors"><h:message id="UsernameMessage" for="username"/></div>
</div>
<div>
- <h:outputLabel for="password">Password</h:outputLabel>
+ <h:outputLabel id="PasswordLabel" for="password">Password</h:outputLabel>
<h:inputSecret id="password" value="#{identity.password}" style="width: 175px;"/>
</div>
- <div class="errors"><h:messages globalOnly="true"/></div>
- <div class="buttonBox"><h:commandButton id="login" action="#{identity.login}" value="Account Login"/></div>
+ <div class="errors"><h:messages id="messages" globalOnly="true"/></div>
+ <div class="buttonBox"><h:commandButton id="login" action="#{identity.quietLogin}" value="Account Login"/></div>
<div class="notes"><s:link id="register" view="/register.xhtml" value="Register New User"/></div>
<div class="subnotes">
Or use a demo account:
@@ -41,9 +41,41 @@
</fieldset>
</h:form>
</div>
+ <div id="content">
+ <div class="section">
+
+ <h1>About this example application</h1>
+
+ <p>
+ This sample application demonstrates how easy it is to develop stateful web
+ applications using JBoss Seam. Just register, login, and book a room to see
+ Seam in action. Throughout the application you'll see popup links like
+ the ones at the bottom of this page. Click them to see how the application
+ works under the hood.
+ </p>
+
+ <p>
+ Note: Please do NOT enter personal information or your credit card number in
+ this sample application.
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/introExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What is JBoss Seam?
+ </a>
+ </p>
+
+ <p>
+ <a href="#" onclick="window.open('exp/loginExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when I login?
+ </a>
+ </p>
+
+ </div>
+ </div>
</div>
<div id="footer">Created with JBoss EJB 3.0, Seam, JSF (Mojarra), and Facelets</div>
</div>
</f:view>
-</h:body>
-</h:html>
+</body>
+</html>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotel.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotel.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotel.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -3,61 +3,54 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.org/schema/seam/taglib"
+ xmlns:s="http://jboss.org/schema/seam/taglib"
template="template.xhtml">
<!-- content -->
<ui:define name="content">
+
<div class="section">
<h1>View Hotel</h1>
</div>
+
<div class="section">
- <div class="entry">
- <div class="label">Name:</div>
- <div class="output">#{hotel.name}</div>
+ <ui:include src="hotelview.xhtml"/>
+
+ <div class="buttonBox">
+ <h:form id="hotel">
+ <h:commandButton id="bookHotel" action="#{hotelBooking.bookHotel}" value="Book Hotel"/>
+  
+ <h:commandButton id="cancel" action="#{hotelBooking.cancel}" value="Back to Search"/>
+ </h:form>
</div>
- <div class="entry">
- <div class="label">Address:</div>
- <div class="output">#{hotel.address}</div>
- </div>
- <div class="entry">
- <div class="label">City:</div>
- <div class="output">#{hotel.city}</div>
- </div>
- <div class="entry">
- <div class="label">State:</div>
- <div class="output">#{hotel.state}</div>
- </div>
- <div class="entry">
- <div class="label">Zip:</div>
- <div class="output">#{hotel.zip}</div>
- </div>
- <div class="entry">
- <div class="label">Country:</div>
- <div class="output">#{hotel.country}</div>
- </div>
- <div class="entry">
- <div class="label">Nightly rate:</div>
- <div class="output">
- <h:outputText value="#{hotel.price}">
- <f:convertNumber type="currency"
- currencySymbol="$"/>
- </h:outputText>
- </div>
- </div>
+
+
</div>
-<div class="section">
- <h:form id="hotel">
- <fieldset class="buttonBox">
- <h:commandButton id="bookHotel" action="#{hotelBooking.bookHotel}" value="Book Hotel"/> 
- <h:commandButton id="cancel" action="#{hotelBooking.cancel}" value="Back to Search"/>
- </fieldset>
- </h:form>
-</div>
+
</ui:define>
<!-- sidebar -->
<ui:define name="sidebar">
+
+<h1>Don't kill your database</h1>
+<p>
+ Keeping conversational state in memory in the middle tier is a great way to
+ improve your application's scalability. It saves hitting the database every
+ time we refresh a page, to re-read the data we were just looking at five
+ seconds ago. By using Seam's conversation context, we get a natural cache
+ of data associated with the what the user is currently doing. By nature,
+ this cache has a more efficient eviction policy than the MRU-type algorithms
+ used by a typical second-level data cache in an O/R mapping engine like
+ Hibernate (at least for some kinds of data). Of course, you should use
+ a clever combination of second-level caching and conversational data
+ caching to achieve the best performance for your application.
+</p>
+<p>
+ <a href="#" onclick="window.open('exp/bookingExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the hotel booking wizard work?
+ </a>
+</p>
+
</ui:define>
</ui:composition>
Added: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotelview.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotelview.xhtml (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/hotelview.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -0,0 +1,45 @@
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.org/schema/seam/taglib">
+
+ <s:decorate id="DecorateName" template="display.xhtml">
+ <ui:define name="label">Name:</ui:define>
+ #{hotel.name}
+ </s:decorate>
+
+ <s:decorate id="DecorateAddress" template="display.xhtml">
+ <ui:define name="label">Address:</ui:define>
+ #{hotel.address}
+ </s:decorate>
+
+ <s:decorate id="DecorateCity" template="display.xhtml">
+ <ui:define name="label">City:</ui:define>
+ #{hotel.city}
+ </s:decorate>
+
+ <s:decorate id="DecorateState" template="display.xhtml">
+ <ui:define name="label">State:</ui:define>
+ #{hotel.state}
+ </s:decorate>
+
+ <s:decorate id="DecorateZip" template="display.xhtml">
+ <ui:define name="label">Zip:</ui:define>
+ #{hotel.zip}
+ </s:decorate>
+
+ <s:decorate id="DecorateCountry" template="display.xhtml">
+ <ui:define name="label">Country:</ui:define>
+ #{hotel.country}
+ </s:decorate>
+
+ <s:decorate id="DecorateNightlyRate" template="display.xhtml">
+ <ui:define name="label">Nightly rate:</ui:define>
+ <h:outputText id="HotelPrice" value="#{hotel.price}">
+ <f:convertNumber type="currency" currencySymbol="$"/>
+ </h:outputText>
+ </s:decorate>
+
+</ui:composition>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/main.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/main.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/main.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -11,59 +11,60 @@
<ui:define name="content">
<div class="section">
- <h:form id="main">
<span class="errors">
<h:messages id="messages" globalOnly="true"/>
</span>
- <h1>Search Hotels</h1>
- <fieldset>
- <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
- <a:ajax event="keyup" listener="#{hotelSearch.find}" render="searchResults" />
- </h:inputText>
+ <h1>Search Hotels</h1>
+
+ <h:form id="searchCriteria">
+ <fieldset>
+ <h:inputText id="searchString" value="#{hotelSearch.searchString}" style="width: 165px;">
+ <a:ajax event="keyup" render="searchResults" listener="#{hotelSearch.find}"/>
+ </h:inputText>
 
- <a:commandButton id="findHotels" value="Find Hotels" action="#{hotelSearch.find}" reRender="searchResults"/>
+ <a:commandButton id="findHotels" value="Find Hotels" actionListener="#{hotelSearch.find}" render="searchResults"/>
 
- <a:status>
- <f:facet name="start">
- <h:graphicImage id="Spinner" value="/img/spinner.gif"/>
+ <a:status id="status">
+ <f:facet id="StartStatus" name="start">
+ <h:graphicImage id="SpinnerGif" value="/img/spinner.gif"/>
</f:facet>
</a:status>
<br/>
- <h:outputLabel for="pageSize">Maximum results:</h:outputLabel> 
- <h:selectOneMenu value="#{hotelSearch.pageSize}" id="pageSize">
- <f:selectItem itemLabel="5" itemValue="5"/>
- <f:selectItem itemLabel="10" itemValue="10"/>
- <f:selectItem itemLabel="20" itemValue="20"/>
+ <h:outputLabel id="MaximumResultsLabel" for="pageSize">Maximum results:</h:outputLabel> 
+ <h:selectOneMenu id="pageSize" value="#{hotelSearch.pageSize}">
+ <f:selectItem id="PageSize5" itemLabel="5" itemValue="5"/>
+ <f:selectItem id="PageSize10" itemLabel="10" itemValue="10"/>
+ <f:selectItem id="PageSize20" itemLabel="20" itemValue="20"/>
</h:selectOneMenu>
</fieldset>
+ </h:form>
- </h:form>
</div>
<a:outputPanel id="searchResults">
<div class="section">
<h:outputText id="NoHotelsFoundMessage" value="No Hotels Found" rendered="#{hotels != null and hotels.rowCount==0}"/>
<h:dataTable id="hotels" value="#{hotels}" var="hot" rendered="#{hotels.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
#{hot.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
#{hot.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
#{hot.city}, #{hot.state}, #{hot.country}
</h:column>
- <h:column>
- <f:facet name="header">Zip</f:facet>
+ <h:column id="column4">
+ <f:facet id="ZipFacet" name="header">Zip</f:facet>
#{hot.zip}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
+ <h:column id="column5">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
<s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}"/>
</h:column>
</h:dataTable>
@@ -76,34 +77,34 @@
</div>
<div class="section">
<h:form id="bookings">
- <h:outputText value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
+ <h:outputText id="NoBookingsFoundMessage" value="No Bookings Found" rendered="#{bookings.rowCount==0}"/>
<h:dataTable id="bookings" value="#{bookings}" var="book" rendered="#{bookings.rowCount>0}">
- <h:column>
- <f:facet name="header">Name</f:facet>
+ <h:column id="column1">
+ <f:facet id="NameFacet" name="header">Name</f:facet>
#{book.hotel.name}
</h:column>
- <h:column>
- <f:facet name="header">Address</f:facet>
+ <h:column id="column2">
+ <f:facet id="AddressFacet" name="header">Address</f:facet>
#{book.hotel.address}
</h:column>
- <h:column>
- <f:facet name="header">City, State</f:facet>
+ <h:column id="column3">
+ <f:facet id="CityStateFacet" name="header">City, State</f:facet>
#{book.hotel.city}, #{book.hotel.state}
</h:column>
- <h:column>
- <f:facet name="header">Check in date</f:facet>
- <h:outputText value="#{book.checkinDate}"/>
+ <h:column id="column4">
+ <f:facet id="CheckInDateFacet" name="header">Check in date</f:facet>
+ <h:outputText id="BookingCheckInDate" value="#{book.checkinDate}"/>
</h:column>
- <h:column>
- <f:facet name="header">Check out date</f:facet>
- <h:outputText value="#{book.checkoutDate}"/>
+ <h:column id="column5">
+ <f:facet id="CheckOutDateFacet" name="header">Check out date</f:facet>
+ <h:outputText id="BookingCheckOutDate" value="#{book.checkoutDate}"/>
</h:column>
- <h:column>
- <f:facet name="header">Confirmation number</f:facet>
+ <h:column id="column6">
+ <f:facet id="ConfNumberFacet" name="header">Confirmation number</f:facet>
#{book.id}
</h:column>
- <h:column>
- <f:facet name="header">Action</f:facet>
+ <h:column id="column7">
+ <f:facet id="ActionFacet" name="header">Action</f:facet>
<h:commandLink id="cancel" value="Cancel" action="#{bookingList.cancel}"/>
</h:column>
</h:dataTable>
@@ -114,6 +115,25 @@
<!-- sidebar -->
<ui:define name="sidebar">
+
+<h1>State management in Seam</h1>
+<p>
+ State in Seam is <em>contextual</em>. When you click "Find Hotels", the application
+ retrieves a list of hotels from the database and caches it in the session context. When you
+ navigate to one of the hotel records by clicking the "View Hotel" link, a <em>conversation</em>
+ begins. The conversation is attached to a particular tab, in a particular browser window. You can
+ navigate to multiple hotels using "open in new tab" or "open in new window" in your web browser.
+ Each window will execute in the context of a different conversation. The application keeps state
+ associated with your hotel booking in the conversation context, which ensures that the concurrent
+ conversations do not interfere with each other.
+</p>
+
+<p>
+ <a href="#" onclick="window.open('exp/mainExp.html','exp','width=752,height=500,scrollbars=yes');">
+ How does the search page work?
+ </a>
+</p>
+
</ui:define>
</ui:composition>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/password.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/password.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/password.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -8,60 +8,42 @@
<!-- content -->
<ui:define name="content">
+
<div class="section">
<h1>Change Your Password</h1>
</div>
+
<div class="section">
+
+ <div class="entry errors">
+ <h:messages id="messages" globalOnly="true"/>
+ </div>
+
<h:form id="setpassword">
- <f:facet name="aroundInvalidField">
- <s:span id="Error" styleClass="errors"/>
- </f:facet>
- <f:facet name="afterInvalidField">
- <s:div id="Message" styleClass="errors">
- <s:message/>
- </s:div>
- </f:facet>
-
<fieldset>
- <div class="entry">
- <div class="label"><h:outputLabel for="password">Password:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="PasswordDecorate">
- <h:inputSecret id="password" value="#{user.password}" required="true">
- <!--<s:validate/>-->
- <f:validator validatorId="org.jboss.seam.ui.ModelValidator"/>
- </h:inputSecret>
- </s:decorate>
- </div>
- </div>
+ <s:decorate id="PasswordDecorate" template="edit.xhtml">
+ <ui:define name="label">Password:</ui:define>
+ <h:inputSecret id="password" value="#{user.password}" required="true"/>
+ </s:decorate>
- <div class="entry">
- <div class="label"><h:outputLabel for="verify">Verify:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="VerifyDecorate">
- <h:inputSecret id="verify" value="#{changePassword.verify}" required="true"/>
- </s:decorate>
- </div>
- </div>
+ <s:decorate id="VerifyDecorate" template="edit.xhtml">
+ <ui:define name="label">Verify:</ui:define>
+ <h:inputSecret id="verify" value="#{changePassword.verify}" required="true"/>
+ </s:decorate>
- <div class="entry errors">
- <h:messages id="Messages" globalOnly="true"/>
+ <div class="buttonBox">
+ <h:commandButton id="change" value="Change" action="#{changePassword.changePassword}"/>
+  
+ <s:button id="cancel" value="Cancel" view="/main.xhtml"/>
</div>
- <div class="entry">
- <div class="label"> </div>
- <div class="input">
- <h:commandButton id="change" value="Change" action="#{changePassword.changePassword}"/> 
- <s:button id="cancel" value="Cancel" view="/main.xhtml"/>
- </div>
- </div>
-
</fieldset>
</h:form>
</div>
+
</ui:define>
<!-- sidebar -->
@@ -79,4 +61,4 @@
</p>
</ui:define>
-</ui:composition>
+</ui:composition>
\ No newline at end of file
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/register.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/register.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/register.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<h:html xmlns="http://www.w3.org/1999/xhtml"
+<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
@@ -10,93 +10,93 @@
<title>JBoss Suites: Seam Framework</title>
<link href="css/screen.css" rel="stylesheet" type="text/css" />
</h:head>
-<h:body id="pgHome">
+
+<body id="pgHome">
+
<div id="document">
+
<div id="header">
<div id="title"><img src="img/hdr.title.gif" alt="JBoss Suites: seam framework demo"/></div>
</div>
+
<div id="container">
+
+ <div id="sidebar">
+ <h1>Integrated multi-layer validation</h1>
+ <p>
+ Robust applications need data validation in several different places. Seam integrates Hibernate Validator,
+ a set of annotations for expressing data model constraints in your domain model classes. Then, these
+ constraints are applied almost completely transparently at three levels of the application: by Seam when
+ the user first enters data, by EJB before persisting data to the database, and, if you use Hibernate to
+ generate your database schema, by the database constraints themselves. Multi-layer validation hardens
+ your application and protects your data. Even better, it's self-documenting, and easy to change when
+ your business rules change.
+ </p>
+ <p>
+ <a href="#" onclick="window.open('exp/registerExp.html','exp','width=752,height=500,scrollbars=yes');">
+ What happens when I register?
+ </a>
+ </p>
+ </div>
+
<div id="content">
+
<div class="section">
<h1>Register</h1>
</div>
+
<div class="section">
- <h:form id="register">
+ <div class="entry errors">
+ <h:messages id="messages" globalOnly="true"/>
+ </div>
+
+ <h:form id="registration">
<fieldset>
- <s:validateAll>
-
- <f:facet name="aroundInvalidField">
- <s:span styleClass="errors"/>
- </f:facet>
- <f:facet name="afterInvalidField">
- <s:div styleClass="errors">
- <s:message/>
- </s:div>
- </f:facet>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="username">Username:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="usernameDecorate">
- <h:inputText id="username" value="#{user.username}" required="true">
- <a:ajax event="blur" render="usernameDecorate"/>
- </h:inputText>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="name">Real Name:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="nameDecorate">
- <h:inputText id="name" value="#{user.name}" required="true">
- <a:ajax event="blur" render="nameDecorate"/>
- </h:inputText>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="password">Password:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="passwordDecorate">
- <h:inputSecret id="password" value="#{user.password}" required="true"/>
- </s:decorate>
- </div>
- </div>
-
- <div class="entry">
- <div class="label"><h:outputLabel for="verify">Verify Password:</h:outputLabel></div>
- <div class="input">
- <s:decorate id="verifyDecorate">
- <h:inputSecret id="verify" value="#{register.verify}" required="true"/>
- </s:decorate>
- </div>
- </div>
-
- </s:validateAll>
+ <s:decorate id="usernameDecorate" template="edit.xhtml">
+ <ui:define name="label">Username:</ui:define>
+ <h:inputText id="username" value="#{user.username}" required="true">
+ <a:ajax event="blur" render="usernameDecorate"/>
+ </h:inputText>
+ </s:decorate>
- <div class="entry errors">
- <h:messages id="messages" globalOnly="true"/>
- </div>
+ <s:decorate id="nameDecorate" template="edit.xhtml">
+ <ui:define name="label">Real Name:</ui:define>
+ <h:inputText id="name" value="#{user.name}" required="true">
+ <a:ajax event="blur" render="nameDecorate"/>
+ </h:inputText>
+ </s:decorate>
- <div class="entry">
- <div class="label"> </div>
- <div class="input">
- <h:commandButton id="register" value="Register" action="#{register.register}"/> 
- <s:button id="cancel" value="Cancel" view="/home.xhtml"/>
- </div>
+ <s:decorate id="passwordDecorate" template="edit.xhtml">
+ <ui:define name="label">Password:</ui:define>
+ <h:inputSecret id="password" value="#{user.password}" required="true"/>
+ </s:decorate>
+
+ <s:decorate id="verifyDecorate" template="edit.xhtml">
+ <ui:define name="label">Verify Password:</ui:define>
+ <h:inputSecret id="verify" value="#{register.verify}" required="true"/>
+ </s:decorate>
+
+ <div class="buttonBox">
+ <h:commandButton id="register" value="Register" action="#{register.register}"/>
+  
+ <s:button id="cancel" value="Cancel" view="/home.xhtml"/>
</div>
-
+
</fieldset>
</h:form>
- </div>
+ </div>
+
</div>
+
</div>
- <div id="footer">Created with JBoss EJB 3.0, Seam, JSF (Mojarra), and Facelets</div>
+
+ <div id="footer">Created with JBoss EJB 3.0, Seam, JSF (Mojarra) and Facelets</div>
+
</div>
-</h:body>
-</h:html>
+
+</body>
+
+</html>
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/template.xhtml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/template.xhtml 2012-08-15 12:53:43 UTC (rev 15047)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/webapp/template.xhtml 2012-08-15 14:28:58 UTC (rev 15048)
@@ -1,14 +1,19 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<h:html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:s="http://jboss.org/schema/seam/taglib">
+<f:view contentType="text/html"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.org/schema/seam/taglib">
+
+<html>
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JBoss Suites: Seam Framework</title>
<link href="css/screen.css" rel="stylesheet" type="text/css" />
+ <ui:insert name="head"/>
</h:head>
-<h:body>
+<body>
<div id="document">
<div id="header">
@@ -29,7 +34,8 @@
<ui:include src="conversations.xhtml" />
</div>
</div>
- <div id="footer">Created with Groovy, JBoss Seam, and Facelets</div>
+ <div id="footer">Created with JBoss Seam, EJB 3, JSF 2 and Hibernate 4</div>
</div>
-</h:body>
-</h:html>
+</body>
+</html>
+</f:view>
12 years, 4 months
Seam SVN: r15047 - in branches/community/Seam_2_3/examples-ee6: icefaces/icefaces-web/src/main/webapp/WEB-INF and 5 other directories.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-15 08:53:43 -0400 (Wed, 15 Aug 2012)
New Revision: 15047
Modified:
branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/icefaces/icefaces-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/metawidget/booking/booking-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/metawidget/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/rss/rss-web/src/main/webapp/WEB-INF/components.xml
branches/community/Seam_2_3/examples-ee6/wicket/wicket-web/src/main/webapp/WEB-INF/components.xml
Log:
JBSEAM-4957
Modified: branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/dvdstore/dvdstore-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -16,7 +16,7 @@
http://jboss.org/schema/seam/framework http://jboss.org/schema/seam/framework-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
- <core:init debug="true" jndi-pattern="@jndiPattern@"/>
+ <core:init debug="true" jndi-pattern="${jndiPattern}"/>
<transaction:ejb-transaction/>
<component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
<component class="org.jboss.seam.async.TimerServiceDispatcher" jndi-name="java:app/jboss-seam/TimerServiceDispatcher"/>
Modified: branches/community/Seam_2_3/examples-ee6/icefaces/icefaces-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/icefaces/icefaces-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/icefaces/icefaces-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -10,7 +10,7 @@
http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
- <core:init jndi-pattern="@jndiPattern@" debug="true"/>
+ <core:init jndi-pattern="${jndiPattern}" debug="true"/>
<core:manager conversation-timeout="120000"
concurrent-request-timeout="500"
Modified: branches/community/Seam_2_3/examples-ee6/metawidget/booking/booking-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/metawidget/booking/booking-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/metawidget/booking/booking-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -10,7 +10,7 @@
http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
- <core:init jndi-pattern="@jndiPattern@" debug="true" distributable="@distributable@"/>
+ <core:init jndi-pattern="${jndiPattern}" debug="true" distributable="${distributable}"/>
<core:manager conversation-timeout="120000"
concurrent-request-timeout="500"
Modified: branches/community/Seam_2_3/examples-ee6/metawidget/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/metawidget/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/metawidget/groovybooking/groovybooking-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -14,7 +14,7 @@
http://jboss.org/schema/seam/mail http://jboss.org/schema/seam/mail-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
- <core:init debug="true" jndi-pattern="@jndiPattern@"/>
+ <core:init debug="true" jndi-pattern="${jndiPattern}"/>
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000"
Modified: branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/remoting/progressbar/progressbar-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -1,7 +1,7 @@
<components xmlns="http://jboss.org/schema/seam/components">
<component name="org.jboss.seam.core.init">
- <property name="jndiPattern">@jndiPattern@</property>
+ <property name="jndiPattern">${jndiPattern}</property>
</component>
<component name="org.jboss.seam.core.manager">
Modified: branches/community/Seam_2_3/examples-ee6/rss/rss-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/rss/rss-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/rss/rss-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -11,6 +11,6 @@
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
- <core:init debug="true" jndi-pattern="@jndiPattern@" />
+ <core:init debug="true" jndi-pattern="${jndiPattern}" />
</components>
Modified: branches/community/Seam_2_3/examples-ee6/wicket/wicket-web/src/main/webapp/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/wicket/wicket-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:26:10 UTC (rev 15046)
+++ branches/community/Seam_2_3/examples-ee6/wicket/wicket-web/src/main/webapp/WEB-INF/components.xml 2012-08-15 12:53:43 UTC (rev 15047)
@@ -14,7 +14,7 @@
http://jboss.org/schema/seam/security http://jboss.org/schema/seam/security-2.3.xsd
http://jboss.org/schema/seam/components http://jboss.org/schema/seam/components-2.3.xsd">
- <core:init jndi-pattern="@jndiPattern@" debug="true"/>
+ <core:init jndi-pattern="${jndiPattern}" debug="true"/>
<core:manager conversation-timeout="120000"
concurrent-request-timeout="500"
12 years, 4 months
Seam SVN: r15046 - tags.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2012-08-15 08:26:10 -0400 (Wed, 15 Aug 2012)
New Revision: 15046
Added:
tags/JBPAPP_5_2_0_ER1/
Log:
tagging Seam 2.2.6.EAP5 for EAP 5.2.0.ER1
12 years, 4 months
Seam SVN: r15045 - branches/enterprise/JBPAPP_5_0/build.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2012-08-15 08:20:56 -0400 (Wed, 15 Aug 2012)
New Revision: 15045
Modified:
branches/enterprise/JBPAPP_5_0/build/resteasy.pom.xml
branches/enterprise/JBPAPP_5_0/build/root.pom.xml
Log:
fixed resteasy-jettison-provider wrong dependency hierarchy by adding jettison into resteasy module
Modified: branches/enterprise/JBPAPP_5_0/build/resteasy.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/resteasy.pom.xml 2012-08-15 11:37:04 UTC (rev 15044)
+++ branches/enterprise/JBPAPP_5_0/build/resteasy.pom.xml 2012-08-15 12:20:56 UTC (rev 15045)
@@ -37,6 +37,17 @@
</dependency>
<dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-atom-provider</artifactId>
</dependency>
Modified: branches/enterprise/JBPAPP_5_0/build/root.pom.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2012-08-15 11:37:04 UTC (rev 15044)
+++ branches/enterprise/JBPAPP_5_0/build/root.pom.xml 2012-08-15 12:20:56 UTC (rev 15045)
@@ -341,7 +341,13 @@
<artifactId>resteasy-jettison-provider</artifactId>
<version>${version.resteasy}</version>
</dependency>
-
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.2</version>
+ </dependency>
+
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-atom-provider</artifactId>
12 years, 4 months
Seam SVN: r15044 - in branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web: src/main/groovy/org/jboss/seam/example/groovy and 4 other directories.
by seam-commits@lists.jboss.org
Author: vdedik
Date: 2012-08-15 07:37:04 -0400 (Wed, 15 Aug 2012)
New Revision: 15044
Added:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/Random.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/RegisterAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Booking.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Hotel.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/User.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/AuthenticatorAction.java
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/ChangePasswordAction.java
Removed:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Booking.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/BookingListAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Hotel.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelBookingAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelSearchingAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Random.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/RegisterAction.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/User.groovy
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/AuthenticatorAction.java
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/ChangePasswordAction.java
Modified:
branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/pom.xml
Log:
JBSEAM-5014
Modified: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/pom.xml
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/pom.xml 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/pom.xml 2012-08-15 11:37:04 UTC (rev 15044)
@@ -128,19 +128,57 @@
<build>
<finalName>jboss-seam-groovybooking</finalName>
<plugins>
+ <!-- Can't use gmaven-plugin because hot deployment won't work otherwise -->
<plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.4</version>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
+ <id>compile-groovy-files</id>
+ <phase>generate-resources</phase>
+ <configuration>
+ <tasks>
+ <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
+ <classpath refid="maven.compile.classpath"/>
+ </taskdef>
+ <mkdir dir="${project.build.outputDirectory}"/>
+ <groovyc destdir="${project.build.outputDirectory}"
+ srcdir="${basedir}/src/main/groovy/"
+ listfiles="true">
+ <classpath refid="maven.compile.classpath"/>
+ <include name="**/model/**"/>
+ </groovyc>
+ </tasks>
+ </configuration>
<goals>
- <goal>generateStubs</goal>
- <goal>compile</goal>
- <goal>generateTestStubs</goal>
- <goal>testCompile</goal>
+ <goal>run</goal>
</goals>
</execution>
+ <execution>
+ <id>copy-class-files</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <tasks>
+ <property name="dev.dir"
+ value="${project.build.directory}/${project.build.finalName}/WEB-INF/dev"/>
+ <mkdir dir="${dev.dir}"/>
+ <copy todir="${dev.dir}">
+ <fileset dir="${basedir}/src/main/groovy/">
+ <include name="**/action/**"/>
+ </fileset>
+ </copy>
+ <move todir="${dev.dir}">
+ <fileset dir="${project.build.outputDirectory}">
+ <include name="**/AuthenticatorAction.class"/>
+ <include name="**/ChangePasswordAction.class"/>
+ </fileset>
+ </move>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
</executions>
</plugin>
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Booking.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Booking.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Booking.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,92 +0,0 @@
-//$Id: Booking.groovy 4698 2007-04-18 06:40:06Z ebernard $
-package org.jboss.seam.example.groovy
-
-import java.text.DateFormat
-import javax.persistence.Basic
-import javax.persistence.Entity
-import javax.persistence.GeneratedValue
-import javax.persistence.Id
-import javax.persistence.ManyToOne
-import javax.persistence.Temporal
-import javax.persistence.TemporalType
-import javax.persistence.Transient
-
-import org.jboss.seam.annotations.Name
-import javax.validation.constraints.NotNull
-import javax.validation.constraints.Pattern
-import javax.validation.constraints.Size
-
-@Entity
-@Name("booking")
-class Booking implements Serializable
-{
- @Id @GeneratedValue
- Long id
-
- @ManyToOne @NotNull
- User user
-
- @ManyToOne @NotNull
- Hotel hotel
-
- @NotNull
- @Basic @Temporal(TemporalType.DATE)
- Date checkinDate
-
- @Basic @Temporal(TemporalType.DATE)
- @NotNull
- Date checkoutDate
-
- @NotNull(message="Credit card number is required")
- @Size(min=16, max=16, message="Credit card number must 16 digits long")
- @Pattern(regexp=/^\d*$/, message="Credit card number must be numeric")
- String creditCard
-
- @NotNull(message="Credit card name is required")
- @Size(min=3, max=70, message="Credit card name is required")
- String creditCardName
-
- int creditCardExpiryMonth
-
- int creditCardExpiryYear
-
- boolean smoking
-
- int beds
-
- Booking() {}
-
- Booking(Hotel hotel, User user)
- {
- this.hotel = hotel
- this.user = user
- }
-
- @Transient
- BigDecimal getTotal()
- {
- return hotel.price * getNights()
- }
-
- @Transient
- int getNights()
- {
- return (int) ( ( checkoutDate.time - checkinDate.time ) / 1000 / 60 / 60 / 24 )
- }
-
- @Transient
- String getDescription()
- {
- DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM)
- return hotel ?
- "${hotel.name}, ${df.format( checkinDate )} to ${df.format(checkoutDate)}" :
- null
- }
-
- @Override
- String toString()
- {
- return "Booking(" + user + ","+ hotel + ")"
- }
-
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/BookingListAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/BookingListAction.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/BookingListAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,57 +0,0 @@
-//$Id: BookingListAction.groovy 8748 2008-08-20 12:08:30Z pete.muir(a)jboss.org $
-package org.jboss.seam.example.groovy
-
-import javax.persistence.EntityManager
-
-import org.jboss.seam.ScopeType
-import org.jboss.seam.annotations.Factory
-import org.jboss.seam.annotations.In
-import org.jboss.seam.annotations.Logger
-import org.jboss.seam.annotations.Name
-import org.jboss.seam.annotations.Scope
-import org.jboss.seam.annotations.datamodel.DataModel
-import org.jboss.seam.annotations.datamodel.DataModelSelection
-import org.jboss.seam.faces.FacesMessages
-import org.jboss.seam.log.Log
-
-(a)Scope(ScopeType.SESSION)
-@Name("bookingList")
-class BookingListAction implements Serializable
-{
-
- @In
- EntityManager em
-
- @In
- User user
-
- @DataModel
- private List<Booking> bookings
-
- @DataModelSelection
- Booking booking
-
- @Logger
- Log log
-
- @Factory
- public void getBookings()
- {
- bookings = em.createQuery('''
- select b from Booking b
- where b.user.username = :username
- order by b.checkinDate''')
- .setParameter("username", user.username)
- .getResultList()
- }
-
- public void cancel()
- {
- log.info("Cancel booking: #{bookingList.booking.id} for #{user.username}")
- Booking cancelled = em.find(Booking.class, booking.id)
- if (cancelled != null) em.remove( cancelled )
- getBookings()
- FacesMessages.instance().add("Booking cancelled for confirmation number #0", booking.getId())
- }
-
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Hotel.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Hotel.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Hotel.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,47 +0,0 @@
-//$Id: Hotel.groovy 4698 2007-04-18 06:40:06Z ebernard $
-package org.jboss.seam.example.groovy
-
-import javax.persistence.Column
-import javax.persistence.Entity
-import javax.persistence.GeneratedValue
-import javax.persistence.Id
-
-import org.jboss.seam.annotations.Name
-import javax.validation.constraints.NotNull
-import javax.validation.constraints.Size
-
-
-@Entity
-@Name("hotel")
-class Hotel implements Serializable
-{
- @Id @GeneratedValue
- Long id
-
- @Size(max=50) @NotNull
- String name
-
- @Size(max=100) @NotNull
- String address
-
- @Size(max=40) @NotNull
- String city
-
- @Size(min=2, max=10) @NotNull
- String state
-
- @Size(min=4, max=6) @NotNull
- String zip
-
- @Size(min=2, max=40) @NotNull
- String country
-
- @Column(precision=6, scale=2)
- BigDecimal price
-
- @Override
- String toString()
- {
- return "Hotel(${name},${address},${city},${zip})"
- }
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelBookingAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelBookingAction.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelBookingAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,98 +0,0 @@
-//$Id: HotelBookingAction.groovy 5563 2007-06-26 22:20:03Z gavin $
-package org.jboss.seam.example.groovy
-
-import javax.persistence.EntityManager
-
-import org.jboss.seam.ScopeType
-import org.jboss.seam.annotations.Begin
-import org.jboss.seam.annotations.End
-import org.jboss.seam.annotations.In
-import org.jboss.seam.annotations.Logger
-import org.jboss.seam.annotations.Name
-import org.jboss.seam.annotations.Out
-import org.jboss.seam.core.Events
-import org.jboss.seam.faces.FacesMessages
-import org.jboss.seam.log.Log
-
-@Name("hotelBooking")
-class HotelBookingAction
-{
-
- @In
- EntityManager em
-
- @In
- User user
-
- @In(required=false) @Out
- Hotel hotel
-
- @In(required=false)
- @Out(required=false)
- Booking booking
-
- @In
- FacesMessages facesMessages
-
- @In
- Events events
-
- @Logger
- Log log
-
- boolean bookingValid
-
- @Begin
- void selectHotel(Hotel selectedHotel)
- {
- hotel = em.merge(selectedHotel)
- }
-
- void bookHotel()
- {
- booking = new Booking(hotel, user)
- Calendar calendar = Calendar.getInstance()
- booking.checkinDate = calendar.time
- calendar.add Calendar.DAY_OF_MONTH, 1
- booking.checkoutDate = calendar.time
- }
-
- void setBookingDetails()
- {
- Calendar calendar = Calendar.getInstance()
- calendar.add Calendar.DAY_OF_MONTH, -1
- if ( booking.checkinDate < calendar.time )
- {
- facesMessages.addToControl "checkinDate", "Check in date must be a future date"
- bookingValid=false
- }
- else if ( booking.checkinDate >= booking.checkoutDate )
- {
- facesMessages.addToControl "checkoutDate", "Check out date must be later than check in date"
- bookingValid=false
- }
- else
- {
- bookingValid=true
- }
- }
-
- @Out (required=false, scope=ScopeType.SESSION)
- List <Booking> bookings
-
- @End
- void confirm()
- {
- em.persist(booking)
- facesMessages.add "Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}", new Object[0]
- log.info("New booking: #{booking.id} for #{user.username}")
- // events.raiseTransactionSuccessEvent("bookingConfirmed")
-
- // force refresh in main.xhtml
- bookings = null
- }
-
- @End
- void cancel() {}
-
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelSearchingAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelSearchingAction.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelSearchingAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,70 +0,0 @@
-//$Id: HotelSearchingAction.groovy 4933 2007-05-27 03:13:24Z ebernard $
-package org.jboss.seam.example.groovy
-
-import javax.persistence.EntityManager
-import javax.persistence.PersistenceContext
-
-import org.jboss.seam.ScopeType
-import org.jboss.seam.annotations.Destroy
-import org.jboss.seam.annotations.Name
-import org.jboss.seam.annotations.Scope
-import org.jboss.seam.annotations.datamodel.DataModel
-
-import org.jboss.seam.annotations.In
-
-import org.jboss.seam.annotations.Factory
-
-@Name("hotelSearch")
-(a)Scope(ScopeType.SESSION)
-class HotelSearchingAction
-{
-
- @In
- private EntityManager em
-
- String searchString
- int pageSize = 10
- int page
-
- @DataModel
- List<Hotel> hotels
-
- void find()
- {
- page = 0
- queryHotels()
- }
-
- void nextPage()
- {
- page++
- queryHotels()
- }
-
- private void queryHotels()
- {
- def query = em.createQuery('''
- select h from Hotel h where
- lower(h.name) like #{pattern}
- or lower(h.city) like #{pattern}
- or lower(h.zip) like #{pattern}
- or lower(h.address) like #{pattern}
- ''')
- query.maxResults = pageSize
- query.firstResult = page * pageSize
- hotels = query.getResultList()
- }
-
- @Factory(value="pattern", scope=ScopeType.EVENT)
- String getSearchPattern()
- {
- return searchString ?
- "%${searchString.toLowerCase().replace('*', '%')}%" :
- "%";
- }
-
- boolean isNextPageAvailable()
- {
- return hotels && hotels.size()==pageSize
- }
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Random.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Random.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Random.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,10 +0,0 @@
-//$Id: Random.groovy 4698 2007-04-18 06:40:06Z ebernard $
-package org.jboss.seam.example.groovy;
-
-/**
- * Not used in the application but a non Seam component is also hot deployable
- */
-class Random
-{
-
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/RegisterAction.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/RegisterAction.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/RegisterAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,63 +0,0 @@
-//$Id: RegisterAction.groovy 5563 2007-06-26 22:20:03Z gavin $
-package org.jboss.seam.example.groovy;
-
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-
-import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.faces.FacesMessages;
-import static org.jboss.seam.ScopeType.EVENT;
-
-@Scope(EVENT)
-@Name("register")
-class RegisterAction
-{
-
- @In
- User user;
-
- @In
- EntityManager em;
-
- @In
- FacesMessages facesMessages;
-
- String verify;
-
- boolean registered;
-
- void register()
- {
- if ( user.password == verify ) {
- List existing = em.createQuery(
- '''select u.username
- from User u
- where u.username=#{user.username}
- ''').getResultList()
-
- if (!existing.size())
- {
- em.persist(user)
- facesMessages.add("Successfully registered as #{user.username}", new Object[0]);
- registered = true
- }
- else
- {
- facesMessages.addToControl("username", "Username #{user.username} already exists")
- }
- }
- else
- {
- facesMessages.add("verify", "Re-enter your password")
- verify=null
- }
- }
-
- void invalid()
- {
- facesMessages.add("Please try again", new Object[0])
- }
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/User.groovy
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/User.groovy 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/User.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,49 +0,0 @@
-//$Id: User.groovy 4698 2007-04-18 06:40:06Z ebernard $
-package org.jboss.seam.example.groovy
-
-import javax.persistence.Entity
-import javax.persistence.Id
-import javax.persistence.Table
-
-
-import org.jboss.seam.ScopeType
-import org.jboss.seam.annotations.Name
-import org.jboss.seam.annotations.Scope
-import javax.validation.constraints.Pattern
-import javax.validation.constraints.NotNull
-import javax.validation.constraints.Size
-
-@Entity
-@Name("user")
-(a)Scope(ScopeType.SESSION)
-@Table(name="Customer")
-class User implements Serializable
-{
- @Id
- @Size(min=5, max=15)
- @Pattern(regexp=/^\w*$/, message="not a valid username")
- String username
-
- @NotNull
- @Size(min=5, max=15)
- String password
-
- @NotNull
- @Size(max=100)
- String name
-
- User(String name, String password, String username)
- {
- this.name = name
- this.password = password
- this.username = username
- }
-
- User() {}
-
- @Override
- String toString()
- {
- return "User(${username})"
- }
-}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/BookingListAction.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/BookingListAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,59 @@
+//$Id: BookingListAction.groovy 8748 2008-08-20 12:08:30Z pete.muir(a)jboss.org $
+package org.jboss.seam.example.groovy.action
+
+import javax.persistence.EntityManager
+
+import org.jboss.seam.ScopeType
+import org.jboss.seam.annotations.Factory
+import org.jboss.seam.annotations.In
+import org.jboss.seam.annotations.Logger
+import org.jboss.seam.annotations.Name
+import org.jboss.seam.annotations.Scope
+import org.jboss.seam.annotations.datamodel.DataModel
+import org.jboss.seam.annotations.datamodel.DataModelSelection
+import org.jboss.seam.faces.FacesMessages
+import org.jboss.seam.log.Log
+import org.jboss.seam.example.groovy.model.Booking
+import org.jboss.seam.example.groovy.model.User
+
+(a)Scope(ScopeType.SESSION)
+@Name("bookingList")
+class BookingListAction implements Serializable
+{
+
+ @In
+ EntityManager em
+
+ @In
+ User user
+
+ @DataModel
+ private List<Booking> bookings
+
+ @DataModelSelection
+ Booking booking
+
+ @Logger
+ Log log
+
+ @Factory
+ public void getBookings()
+ {
+ bookings = em.createQuery('''
+ select b from Booking b
+ where b.user.username = :username
+ order by b.checkinDate''')
+ .setParameter("username", user.username)
+ .getResultList()
+ }
+
+ public void cancel()
+ {
+ log.info("Cancel booking: #{bookingList.booking.id} for #{user.username}")
+ Booking cancelled = em.find(Booking.class, booking.id)
+ if (cancelled != null) em.remove( cancelled )
+ getBookings()
+ FacesMessages.instance().add("Booking cancelled for confirmation number #0", booking.getId())
+ }
+
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelBookingAction.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelBookingAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,101 @@
+//$Id: HotelBookingAction.groovy 5563 2007-06-26 22:20:03Z gavin $
+package org.jboss.seam.example.groovy.action
+
+import javax.persistence.EntityManager
+
+import org.jboss.seam.ScopeType
+import org.jboss.seam.annotations.Begin
+import org.jboss.seam.annotations.End
+import org.jboss.seam.annotations.In
+import org.jboss.seam.annotations.Logger
+import org.jboss.seam.annotations.Name
+import org.jboss.seam.annotations.Out
+import org.jboss.seam.core.Events
+import org.jboss.seam.faces.FacesMessages
+import org.jboss.seam.log.Log
+import org.jboss.seam.example.groovy.model.Booking
+import org.jboss.seam.example.groovy.model.Hotel
+import org.jboss.seam.example.groovy.model.User
+
+@Name("hotelBooking")
+class HotelBookingAction
+{
+
+ @In
+ EntityManager em
+
+ @In
+ User user
+
+ @In(required=false) @Out
+ Hotel hotel
+
+ @In(required=false)
+ @Out(required=false)
+ Booking booking
+
+ @In
+ FacesMessages facesMessages
+
+ @In
+ Events events
+
+ @Logger
+ Log log
+
+ boolean bookingValid
+
+ @Begin
+ void selectHotel(Hotel selectedHotel)
+ {
+ hotel = em.merge(selectedHotel)
+ }
+
+ void bookHotel()
+ {
+ booking = new Booking(hotel, user)
+ Calendar calendar = Calendar.getInstance()
+ booking.checkinDate = calendar.time
+ calendar.add Calendar.DAY_OF_MONTH, 1
+ booking.checkoutDate = calendar.time
+ }
+
+ void setBookingDetails()
+ {
+ Calendar calendar = Calendar.getInstance()
+ calendar.add Calendar.DAY_OF_MONTH, -1
+ if ( booking.checkinDate < calendar.time )
+ {
+ facesMessages.addToControl "checkinDate", "Check in date must be a future date"
+ bookingValid=false
+ }
+ else if ( booking.checkinDate >= booking.checkoutDate )
+ {
+ facesMessages.addToControl "checkoutDate", "Check out date must be later than check in date"
+ bookingValid=false
+ }
+ else
+ {
+ bookingValid=true
+ }
+ }
+
+ @Out (required=false, scope=ScopeType.SESSION)
+ List <Booking> bookings
+
+ @End
+ void confirm()
+ {
+ em.persist(booking)
+ facesMessages.add "Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}", new Object[0]
+ log.info("New booking: #{booking.id} for #{user.username}")
+ // events.raiseTransactionSuccessEvent("bookingConfirmed")
+
+ // force refresh in main.xhtml
+ bookings = null
+ }
+
+ @End
+ void cancel() {}
+
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/HotelSearchingAction.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/HotelSearchingAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,70 @@
+//$Id: HotelSearchingAction.groovy 4933 2007-05-27 03:13:24Z ebernard $
+package org.jboss.seam.example.groovy.action
+
+import javax.persistence.EntityManager
+
+import org.jboss.seam.ScopeType
+
+import org.jboss.seam.annotations.Name
+import org.jboss.seam.annotations.Scope
+import org.jboss.seam.annotations.datamodel.DataModel
+
+import org.jboss.seam.annotations.In
+
+import org.jboss.seam.annotations.Factory
+import org.jboss.seam.example.groovy.model.Hotel
+
+@Name("hotelSearch")
+(a)Scope(ScopeType.SESSION)
+class HotelSearchingAction
+{
+
+ @In
+ private EntityManager em
+
+ String searchString
+ int pageSize = 10
+ int page
+
+ @DataModel
+ List<Hotel> hotels
+
+ void find()
+ {
+ page = 0
+ queryHotels()
+ }
+
+ void nextPage()
+ {
+ page++
+ queryHotels()
+ }
+
+ private void queryHotels()
+ {
+ def query = em.createQuery('''
+ select h from Hotel h where
+ lower(h.name) like #{pattern}
+ or lower(h.city) like #{pattern}
+ or lower(h.zip) like #{pattern}
+ or lower(h.address) like #{pattern}
+ ''')
+ query.maxResults = pageSize
+ query.firstResult = page * pageSize
+ hotels = query.getResultList()
+ }
+
+ @Factory(value="pattern", scope=ScopeType.EVENT)
+ String getSearchPattern()
+ {
+ return searchString ?
+ "%${searchString.toLowerCase().replace('*', '%')}%" :
+ "%";
+ }
+
+ boolean isNextPageAvailable()
+ {
+ return hotels && hotels.size()==pageSize
+ }
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/Random.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Random.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/Random.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/Random.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,10 @@
+//$Id: Random.groovy 4698 2007-04-18 06:40:06Z ebernard $
+package org.jboss.seam.example.groovy.action;
+
+/**
+ * Not used in the application but a non Seam component is also hot deployable
+ */
+class Random
+{
+
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/RegisterAction.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/RegisterAction.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/RegisterAction.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/action/RegisterAction.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,63 @@
+//$Id: RegisterAction.groovy 5563 2007-06-26 22:20:03Z gavin $
+package org.jboss.seam.example.groovy.action;
+
+import javax.persistence.EntityManager;
+
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.faces.FacesMessages;
+import static org.jboss.seam.ScopeType.EVENT
+import org.jboss.seam.example.groovy.model.User;
+
+@Scope(EVENT)
+@Name("register")
+class RegisterAction
+{
+
+ @In
+ User user;
+
+ @In
+ EntityManager em;
+
+ @In
+ FacesMessages facesMessages;
+
+ String verify;
+
+ boolean registered;
+
+ void register()
+ {
+ if ( user.password == verify ) {
+ List existing = em.createQuery(
+ '''select u.username
+ from User u
+ where u.username=#{user.username}
+ ''').getResultList()
+
+ if (!existing.size())
+ {
+ em.persist(user)
+ facesMessages.add("Successfully registered as #{user.username}", new Object[0]);
+ registered = true
+ }
+ else
+ {
+ facesMessages.addToControl("username", "Username #{user.username} already exists")
+ }
+ }
+ else
+ {
+ facesMessages.add("verify", "Re-enter your password")
+ verify=null
+ }
+ }
+
+ void invalid()
+ {
+ facesMessages.add("Please try again", new Object[0])
+ }
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Booking.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Booking.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Booking.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Booking.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,92 @@
+//$Id: Booking.groovy 4698 2007-04-18 06:40:06Z ebernard $
+package org.jboss.seam.example.groovy.model
+
+import java.text.DateFormat
+import javax.persistence.Basic
+import javax.persistence.Entity
+import javax.persistence.GeneratedValue
+import javax.persistence.Id
+import javax.persistence.ManyToOne
+import javax.persistence.Temporal
+import javax.persistence.TemporalType
+import javax.persistence.Transient
+
+import org.jboss.seam.annotations.Name
+import javax.validation.constraints.NotNull
+import javax.validation.constraints.Pattern
+import javax.validation.constraints.Size
+
+@Entity
+@Name("booking")
+class Booking implements Serializable
+{
+ @Id @GeneratedValue
+ Long id
+
+ @ManyToOne @NotNull
+ User user
+
+ @ManyToOne @NotNull
+ Hotel hotel
+
+ @NotNull
+ @Basic @Temporal(TemporalType.DATE)
+ Date checkinDate
+
+ @Basic @Temporal(TemporalType.DATE)
+ @NotNull
+ Date checkoutDate
+
+ @NotNull(message="Credit card number is required")
+ @Size(min=16, max=16, message="Credit card number must 16 digits long")
+ @Pattern(regexp=/^\d*$/, message="Credit card number must be numeric")
+ String creditCard
+
+ @NotNull(message="Credit card name is required")
+ @Size(min=3, max=70, message="Credit card name is required")
+ String creditCardName
+
+ int creditCardExpiryMonth
+
+ int creditCardExpiryYear
+
+ boolean smoking
+
+ int beds
+
+ Booking() {}
+
+ Booking(Hotel hotel, User user)
+ {
+ this.hotel = hotel
+ this.user = user
+ }
+
+ @Transient
+ BigDecimal getTotal()
+ {
+ return hotel.price * getNights()
+ }
+
+ @Transient
+ int getNights()
+ {
+ return (int) ( ( checkoutDate.time - checkinDate.time ) / 1000 / 60 / 60 / 24 )
+ }
+
+ @Transient
+ String getDescription()
+ {
+ DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM)
+ return hotel ?
+ "${hotel.name}, ${df.format( checkinDate )} to ${df.format(checkoutDate)}" :
+ null
+ }
+
+ @Override
+ String toString()
+ {
+ return "Booking(" + user + ","+ hotel + ")"
+ }
+
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Hotel.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/Hotel.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Hotel.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/Hotel.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,47 @@
+//$Id: Hotel.groovy 4698 2007-04-18 06:40:06Z ebernard $
+package org.jboss.seam.example.groovy.model
+
+import javax.persistence.Column
+import javax.persistence.Entity
+import javax.persistence.GeneratedValue
+import javax.persistence.Id
+
+import org.jboss.seam.annotations.Name
+import javax.validation.constraints.NotNull
+import javax.validation.constraints.Size
+
+
+@Entity
+@Name("hotel")
+class Hotel implements Serializable
+{
+ @Id @GeneratedValue
+ Long id
+
+ @Size(max=50) @NotNull
+ String name
+
+ @Size(max=100) @NotNull
+ String address
+
+ @Size(max=40) @NotNull
+ String city
+
+ @Size(min=2, max=10) @NotNull
+ String state
+
+ @Size(min=4, max=6) @NotNull
+ String zip
+
+ @Size(min=2, max=40) @NotNull
+ String country
+
+ @Column(precision=6, scale=2)
+ BigDecimal price
+
+ @Override
+ String toString()
+ {
+ return "Hotel(${name},${address},${city},${zip})"
+ }
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/User.groovy (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/User.groovy)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/User.groovy (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/groovy/org/jboss/seam/example/groovy/model/User.groovy 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,49 @@
+//$Id: User.groovy 4698 2007-04-18 06:40:06Z ebernard $
+package org.jboss.seam.example.groovy.model
+
+import javax.persistence.Entity
+import javax.persistence.Id
+import javax.persistence.Table
+
+
+import org.jboss.seam.ScopeType
+import org.jboss.seam.annotations.Name
+import org.jboss.seam.annotations.Scope
+import javax.validation.constraints.Pattern
+import javax.validation.constraints.NotNull
+import javax.validation.constraints.Size
+
+@Entity
+@Name("user")
+(a)Scope(ScopeType.SESSION)
+@Table(name="Customer")
+class User implements Serializable
+{
+ @Id
+ @Size(min=5, max=15)
+ @Pattern(regexp=/^\w*$/, message="not a valid username")
+ String username
+
+ @NotNull
+ @Size(min=5, max=15)
+ String password
+
+ @NotNull
+ @Size(max=100)
+ String name
+
+ User(String name, String password, String username)
+ {
+ this.name = name
+ this.password = password
+ this.username = username
+ }
+
+ User() {}
+
+ @Override
+ String toString()
+ {
+ return "User(${username})"
+ }
+}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/AuthenticatorAction.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/AuthenticatorAction.java 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/AuthenticatorAction.java 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,35 +0,0 @@
-package org.jboss.seam.example.groovy;
-
-import java.util.List;
-import javax.persistence.EntityManager;
-
-import static org.jboss.seam.ScopeType.SESSION;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-
-@Name("authenticator")
-public class AuthenticatorAction
-{
- @In EntityManager em;
-
- @Out(required=false, scope = SESSION)
- private User user;
-
- public boolean authenticate()
- {
- List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.password=#{identity.password}")
- .getResultList();
-
- if ( results.size()==0 )
- {
- return false;
- }
- else
- {
- user = (User) results.get(0);
- return true;
- }
- }
-
-}
Deleted: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/ChangePasswordAction.java
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/ChangePasswordAction.java 2012-08-14 19:38:58 UTC (rev 15043)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/ChangePasswordAction.java 2012-08-15 11:37:04 UTC (rev 15044)
@@ -1,64 +0,0 @@
-//$Id: ChangePasswordAction.java 5305 2007-06-20 01:30:37Z gavin $
-package org.jboss.seam.example.groovy;
-
-import javax.persistence.EntityManager;
-
-import static org.jboss.seam.ScopeType.EVENT;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.faces.FacesMessages;
-
-@Scope(EVENT)
-@Name("changePassword")
-public class ChangePasswordAction
-{
-
- @In @Out
- private User user;
-
- @In
- private EntityManager em;
-
- private String verify;
-
- private boolean changed;
-
- public void changePassword()
- {
- if ( user.getPassword().equals(verify) )
- {
- user = em.merge(user);
- FacesMessages.instance().add("Password updated");
- changed = true;
- }
- else
- {
- FacesMessages.instance().add("verify", "Re-enter new password");
- revertUser();
- verify=null;
- }
- }
-
- public boolean isChanged()
- {
- return changed;
- }
-
- private void revertUser()
- {
- user = em.find(User.class, user.getUsername());
- }
-
- public String getVerify()
- {
- return verify;
- }
-
- public void setVerify(String verify)
- {
- this.verify = verify;
- }
-
-}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/AuthenticatorAction.java (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/AuthenticatorAction.java)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/AuthenticatorAction.java (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/AuthenticatorAction.java 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,36 @@
+package org.jboss.seam.example.groovy.action;
+
+import java.util.List;
+import javax.persistence.EntityManager;
+
+import static org.jboss.seam.ScopeType.SESSION;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.example.groovy.model.User;
+
+@Name("authenticator")
+public class AuthenticatorAction
+{
+ @In EntityManager em;
+
+ @Out(required=false, scope = SESSION)
+ private User user;
+
+ public boolean authenticate()
+ {
+ List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.password=#{identity.password}")
+ .getResultList();
+
+ if ( results.size()==0 )
+ {
+ return false;
+ }
+ else
+ {
+ user = (User) results.get(0);
+ return true;
+ }
+ }
+
+}
Copied: branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/ChangePasswordAction.java (from rev 15033, branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/ChangePasswordAction.java)
===================================================================
--- branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/ChangePasswordAction.java (rev 0)
+++ branches/community/Seam_2_3/examples-ee6/groovybooking/groovybooking-web/src/main/java/org/jboss/seam/example/groovy/action/ChangePasswordAction.java 2012-08-15 11:37:04 UTC (rev 15044)
@@ -0,0 +1,65 @@
+//$Id: ChangePasswordAction.java 5305 2007-06-20 01:30:37Z gavin $
+package org.jboss.seam.example.groovy.action;
+
+import javax.persistence.EntityManager;
+
+import static org.jboss.seam.ScopeType.EVENT;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.example.groovy.model.User;
+import org.jboss.seam.faces.FacesMessages;
+
+@Scope(EVENT)
+@Name("changePassword")
+public class ChangePasswordAction
+{
+
+ @In @Out
+ private User user;
+
+ @In
+ private EntityManager em;
+
+ private String verify;
+
+ private boolean changed;
+
+ public void changePassword()
+ {
+ if ( user.getPassword().equals(verify) )
+ {
+ user = em.merge(user);
+ FacesMessages.instance().add("Password updated");
+ changed = true;
+ }
+ else
+ {
+ FacesMessages.instance().add("verify", "Re-enter new password");
+ revertUser();
+ verify=null;
+ }
+ }
+
+ public boolean isChanged()
+ {
+ return changed;
+ }
+
+ private void revertUser()
+ {
+ user = em.find(User.class, user.getUsername());
+ }
+
+ public String getVerify()
+ {
+ return verify;
+ }
+
+ public void setVerify(String verify)
+ {
+ this.verify = verify;
+ }
+
+}
12 years, 4 months