Spring Utils

Some tags and methods I find useful.
Is not just Spring related stuff.
Not so much in this project, just some stuff broken out of Spring Template.

Have not done anything on this for a long time so it is kind of dead :-(

Get the current logged in user for Spring Security.
Check if current user has a role.
Generate the path to a application. Ex http://xxxx.org/[thePath]
Generate the base path to a application. Ex http://xxxx.org/yyyy
Generate a simple window with rounded corners, title and a body (Uses two images for the corners, See img/head.gif, img/body.gif).
Generate a section of the page (a border). Very simple...
Generate a simple workspace with links (8 links + logout link) and rounded corners (the body is a iframe).

Here you can download the code: Google Drive

Dependencies (All needed jar is under the lib directory)

Java 1.6
Apache Tomcat 6.0 (Servlet-api, Jsp-api) (http://tomcat.apache.org)
SteelsquidClassCollection
Spring Framework 3.0.3 (http://www.springsource.org)
Spring Security 3.0.3 (http://static.springsource.org/spring-security/site/index.html)

Usage

Add the dependencies jars to your claspath.
Copy the steelsquidSpringUtils.tld to your tld directory.
Copy /img/* and /img/head.gif to your web directory (must be found under /img).
Add taglib to jsp, Example: <%@ taglib prefix="steelsquid" uri="/WEB-INF/tld/steelsquidSpringUtils.tld" %>.
See example in project SteelsquidSpringTemplate for usage.

Short description of classes

org.steelsquid.springutils.UtilsSpring
Some static methods i think is usefull.
- Get the current logged in user for Spring Security.
- Check if current user has a role.
org.steelsquid.springutils.taglib.AbstractTemplateTagHandler
This is a abstract tag handler that can generate html from templates.
Loading two text files (header and footer) containing text with | (pipe).
This application replaces them | with parameters.
Between the header and footer the jsp/html from the base jsp page will be shown.
Se WorkspaceTagHandler.java for example.
org.steelsquid.springutils.taglib.BasePathTagHandler
Generate the base path to a application. Ex http://xxxx.org/yyy. steelsquidSpringUtils.tld is the tld file.
org.steelsquid.springutils.taglib.FormHasErrorTagHandler
Check if there is error in a form (Spring forms).
The body will be shown if there is a error in the form.
SteelsquidSpringUtils.tld is the tld file.
org.steelsquid.springutils.taglib.FormIsOkTagHandler
Check if there is error in a form (Spring forms).
The body will be shown if there is no error in the form.
steelsquidSpringUtils.tld is the tld file.
org.steelsquid.springutils.taglib.PathTagHandler
Generate the path to a application. Ex http://xxxx.org/[thePath].
steelsquidSpringUtils.tld is the tld file.
org.steelsquid.springutils.taglib.SectionTagHandler
Generate a section of the page (border).
steelsquidSpringUtils.tld is the tld file.
See project SteelsquidSpringTemplate for example.
org.steelsquid.springutils.taglib.TemplateHolder
Class that holds the loaded template for every type of TemplateTagHandler.
org.steelsquid.springutils.taglib.WindowTagHandler
Generate a simple window with rounded corners, title and a body (Uses two images to the corners, See img/head.gif, img/body.gif).
steelsquidSpringUtils.tld is the tld file.
See project SteelsquidSpringTemplate for example.
org.steelsquid.springutils.taglib.WorkspaceTagHandler
Generate a simple workspace width links (8 links + logout link) and rounded corners (this body is a iframe).
Uses img/head.gif, img/body.gif
steelsquidSpringUtils.tld is the tld file.
See project SteelsquidSpringTemplate for example.
org.steelsquid.springutils.template
All the default templates.
/web/img
Head and body images.
/web/WEB-INF/tld/steelsquidSpringUtils.tld
Tag descriptor.

Revision history

2010-09-22   0.3   Initial release
2011-04-06   0.4   Change the workspace colors (Gray)
2011-06-15   0.5   Nothing new in the code but using Netbeans 7