I have just released my first GIT based Project at Google Code. Thanks to IntelliJ IDEA for the great GIT Integration.

This Struts2 Bootstrap Plugin is for an easy Integration of Twitter Bootstrap into an Bootstrap based Struts2 Webapp. It provides a Head Tag which loads necessary resources and a new theme for Struts2 Tags. A new Struts2 Bootstrap Plugin Showcase provides a short introduction how to use this Plugin.

Steps to use it in your Project:

1. Add the jar

To use this plugin you need to copy the struts2-bootstrap-plugin.jar into your WEB-INF/lib path. A maven Integration is following soon.

2. Add the Head Tag to your JSP

To load the required CSS Styles and JavaScript Resources you need to add the Head Tag to your html head area like following Example.

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>MyApp Title</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 
    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
 
    <sb:head/>
</head>
<body>
...
</body>
</html>

3. Using the Form Tags

Now you are able to use the form theme, simple by adding the theme="bootstrap" attribute to your tag.

    <s:actionerror theme="bootstrap"/>
    <s:actionmessage theme="bootstrap"/>
    <s:fielderror theme="bootstrap"/>
 
 
    <s:form action="index" enctype="multipart/form-data" theme="bootstrap" cssClass="form-horizontal"
            label="A sample horizontal Form">
        <s:textfield
                label="Name"
                name="name"
                tooltip="Enter your Name here"/>
 
        <s:textfield
                label="Textfield with Error"
                name="error"/>
 
        <s:textarea
                tooltip="Enter your Biography"
                label="Biography"
                name="bio"
                cols="20"
                rows="3"/>
 
        <s:select
                tooltip="Choose Your Favourite Color"
                label="Favorite Color"
                list="{'Red', 'Blue', 'Green'}"
                name="favouriteColor"
                emptyOption="true"
                headerKey="None"
                headerValue="None"/>
 
        <s:checkboxlist
                tooltip="Choose your Friends"
                label="Friends"
                list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                name="friends"/>
 
        <s:radio
                tooltip="Choose your Best Friend"
                label="Best Friend"
                list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                name="bestFriend"
                cssErrorClass="foo"/>
 
        <s:checkbox
                tooltip="Confirmed that your are Over 18"
                label="Age 18+"
                name="legalAge"/>
 
        <s:submit cssClass="btn"/>
    </s:form>

Download: http://code.google.com/p/struts2-bootstrap/downloads/list
Showcase: http://struts.jgeppert.com/struts2-bootstrap-showcase/
Issues: http://code.google.com/p/struts2-bootstrap/issues/list