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.
  • 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).


Dependencies (All needed jar is under the lib directory)


Download
  • Here you can download the project.


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.


ToDo
  • ???


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


Licensing
  • SteelsquidSpringUtils GNU Lesser General Public License
  • SteelsquidClassCollection GNU Lesser General Public License
  • Spring Framework Apache License Version 2
  • Spring Security Apache License, Version 2.0
  • Servlet-api Apache License, Version 2.0
  • Jsp-api Apache License, Version 2.0