Reference » TaglibShept

TaglibShept

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

Selection014.png

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">
<h1>${formTitle}</h1>
<shept:error />
<shept:page childIndex="0" >
<jsp:attribute name="segment" >
   <segments:segments />
</jsp:attribute>
</shept:page>
</div>
   </form:form>
<app:footer />

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

</div>
</body>

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

confirmDialog

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

debug

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

error

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

errors

Exposes all error messages
see Source pagecode.png

filter

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 />
</shept:filter>

see Source pagecode.png

form

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

includeJavaScript

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

page

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 />
 </jsp:attribute>
</shept:page>

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

subform

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

Selection017.png

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

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

see Source pagecode.png

submission

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

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

variables

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

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

© 2011 shept.org - Andreas Hahn