Reference » TaglibShept


Last modified by Andreas Hahn on 2011/06/01 11:31


Taglib Shept

The shept taglib contains common tags to build a shept webapp.
The body of a shept webapp might look like this snippet (typically) from WEB-INF/jspx/defaultForm.jspx

<body >
<div id="main">
<app:header />
<app:menu />
<app:locale />
<form:form id="main" method="post" >
<div id="content">
<shept:error />
<shept:page childIndex="0" >
<jsp:attribute name="segment" >
   <segments:segments />
<app:footer />

<spring:message var="msg" code="Persist.confirmDeletion" />
<shept:confirmDialog message="${msg}" />


The app: prefixes (header / menu / locale / footer) are defined by the application.


Includes a jQuery dialog confirmation template.
see Source pagecode.png


Retrieves information from the context useful for debugging.
see Source pagecode.png


Exposes the top level error message.
see Source pagecode.png


Exposes all error messages
see Source pagecode.png


For use with default filter implementations.
Binds the filter to the current segment using 'filter' as the local path.
In the filters body path definition you just need to specify the local path.

Usage example:

<shept:filter >
  Name: <form:input path="name" cssErrorClass="sheptFieldError" />
  Firstname: <form:input path="firstName" cssErrorClass="sheptFieldError" />
 <shept:submitSearch />

see Source pagecode.png


The form tag binds the current segement.
In the forms body path definition its just necessary to specify the local path.
see Source pagecode.png


Includes the default javascript just once.
see Source pagecode.png


This is the main tag to include all segments of a page.
Snippet from WEB-INF/jspx/defaultForm.jspx

<shept:page childIndex="0" >
 <jsp:attribute name="segment" >
   <segments:segments />

This snippet includes the first segment of a page which will recursively include all subsequent segments.
see Source pagecode.png


The subForm wraps a segment into a window-like frame that allows folding or closing the segment.


Code example from your projects WEB-INF/tags/segments/segments.tagx

<c:when test="${subFormName eq 'orders'}">
<shept:subForm headerCode="order" >
  <tables:orders />

see Source pagecode.png


Submission can be applied to a segment and adds a default 'Save' 'Cancel' behavior with the option to disable 'Save'
see Source pagecode.png


SubmitSearch adds a 'Search' 'Cancel' behavior when applied to a filterable segment.
see Source pagecode.png


Variables exposes segment variables most notably:

 var  description
commandNameThe name of the current form (default='command')
commandRootThe name of the command root (default='children')
isChildIndexValidReturn true when within a valid segment
commandPathThe name of the current segments commandPath (e.g. default 1st segment is 'children[0].command') for use in html input "name" parameters.
commandPathIdThe name of the current segments commandPath id (e.g. default 1st segment is 'children0' ) for use in html "id" parameters.
subFormNameThe (unique) name of the subform (= the name of the segment)
componentPropertiesA set of optional properties to allow additional control of the segments behavior
subCommandThe commandBacking object of the current segment

variables.tagx will be called recursively within the page.tagx so that the context is prepared for each segment by default.
see Source pagecode.png

Created by Andreas Hahn on 2011/05/22 17:12

© 2011 - Andreas Hahn