Dear Wiki user, You have subscribed to a wiki page or wiki category on "Shale Wiki" for change notification.
The following page has been changed by RyanWynn: http://wiki.apache.org/shale/ReusableClayJars ------------------------------------------------------------------------------ ClayAndTiles shows how Clays supports virtual entry points to pages in the form of full XML views. Full XML views allow you to reference a clay component which in turn references a physical file. This indirection is a nice way to abstract resources. You can use a simple name like /foo.xml to represent something that is really living in a location on the classpath, classpath*:org/bar/baz/foo.html, or under the web context, /pages/bar/baz/foo.html. - Unfortunately, if you like using the Tapestry-like full HTML views then you will soon find that mixing full HTML and full XML entry points can be troublesome. This example shows how one could package a Login Module as a self contained jar file using Clay full HTML views only. Then it shows how one could easily drop this jar into any JSF web application. + Unfortunately, if you like using the Tapestry-like full HTML views then you will soon find that mixing full HTML and full XML entry points can be troublesome. This example shows how one could package a Login Module as a self contained jar file using Clay full HTML views only. Then it shows how one could easily drop this jar into any JSF web application. - (1) First create a Java Project for the Login Module + (1) First create a Java Project for the Login Module (2) Create a package inside the project called loginmodule.pages @@ -36, +36 @@ <td><input jsfid="lm:loginButton" type="submit" value="Login"/></td> <td><input jsfid="lm:cancelButton" type="submit" value="Cancel"/></td> </tr> - + </table> </form> </body> @@ -83, +83 @@ <set name="value" value="#{userCredential.secret}"/> </attributes> </component> - + <component jsfid="lm:loginButton" extends="commandButton"> <attributes> <set name="value" value="Login"/> <set name="action" value="#{login.doLogin}"/> </attributes> </component> - + <component jsfid="lm:cancelButton" extends="commandButton"> <attributes> <set name="value" value="Cancel"/> <set name="action" value="loginmodule.cancel"/> </attributes> </component> - + <component jsfid="lm:continueLink" extends="commandLink"> <attributes> <set name="action" value="loginmodule.done"/> @@ -139, +139 @@ <to-view-id>/classpath*:loginmodule/pages/login_success.html</to-view-id> </navigation-case> </navigation-rule> - + <lifecycle> <phase-listener>loginmodule.SecurityPhaseListener</phase-listener> </lifecycle> @@ -155, +155 @@ package loginmodule; public class UserCredential { - + private String username; - + private String secret; public String getSecret() { @@ -212, +212 @@ else { setLoggedIn(false); - + FacesMessage msg = new FacesMessage("Invalid Login", "You are not authorized"); ctx.addMessage(null, msg); @@ -284, +284 @@ (10) Add login.jar to any JSF web project by including it in the WEB-INF/lib directory. (11) Add this snippet to the faces-config file in the web project - + {{{ <navigation-rule> <from-view-id>/classpath*:loginmodule/pages/*</from-view-id> @@ -311, +311 @@ </servlet-mapping> }}} - (13) This approach shows that you can configure Clay Full HTML views as entry points, evening going so far as having jarred html views referenced in viewIds. Admittedly, the viewId looks kind of strange but it works. This approach can be very useful for portal applications. For example, in the case where there are multiple portlets with some piece of overlapping functionality. + (13) This approach shows that you can configure Clay Full HTML views as entry points, evening going so far as having jarred html views referenced in viewIds. Admittedly, the viewId looks kind of strange but it works. This approach can be very useful for portal applications. For example, in the case where there are multiple portlets with some piece of overlapping functionality. - + === References === - * - http://mail-archives.apache.org/mod_mbox/shale-user/200609.mbox/[EMAIL PROTECTED] + [http://mail-archives.apache.org/mod_mbox/shale-user/200609.mbox/[EMAIL PROTECTED] 20060921 [EMAIL PROTECTED] post] - - - -
