Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

 

 

Wiki Markup
{rate:title=Rating|theme=dynamic}

Overview

A Plugin for simple Bootstrap integration into Struts2.

Simple and flexible HTML, CSS, and Javascript for popular user interface components and interactions.

Installation

Manual

Copy the struts2-bootstrap-plugin.jar into your WEB-INF/lib path.

Maven

Code Block
languagexml
titleMaven Configuration
<dependencies>
    ...
    <dependency>
        <groupId>com.jgeppert.struts2.bootstrap</groupId>
        <artifactId>struts2-bootstrap-plugin</artifactId>
        <version>2.0.3</version>
    </dependency>
    ...
</dependencies>

Usage

Prepare your JSP

Include the Taglib and use the HeadTag to load necessary resources.

Code Block
languagexml
titleHeader / Setup
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
    ...
    <!-- 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>

Use the Bootstrap Form Theme

Code Block
languagexml
titleForm Elements
            <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:checkboxlist
                        tooltip="Checkboxes with inline position"
                        labelposition="inline"
                        label="Friends Inline"
                        list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                        name="friendsInline"/>

                <s:radio
                        tooltip="Choose your Best Friend"
                        label="Best Friend"
                        list="{'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}"
                        name="bestFriend"
                        cssErrorClass="foo"/>

                <s:radio
                        tooltip="Radio Buttons with inline position"
                        label="Best Friend Inline"
                        labelposition="inline"
                        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:doubleselect
                        tooltip="Choose Your State"
                        label="State"
                        name="region" list="{'North', 'South'}"
                        value="'South'"
                        doubleValue="'Florida'"
                        doubleList="top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}"
                        doubleName="state"
                        headerKey="-1"
                        headerValue="---------- Please Select ----------"
                        emptyOption="true"/>

                <s:file
                        tooltip="Upload Your Picture"
                        label="Picture"
                        name="picture"/>

                <s:optiontransferselect
                        tooltip="Select Your Favourite Cartoon Characters"
                        label="Favourite Cartoons Characters"
                        name="leftSideCartoonCharacters"
                        leftTitle="Left Title"
                        rightTitle="Right Title"
                        list="{'Popeye', 'He-Man', 'Spiderman'}"
                        multiple="true"
                        headerKey="headerKey"
                        headerValue="--- Please Select ---"
                        emptyOption="true"
                        doubleList="{'Superman', 'Mickey Mouse', 'Donald Duck'}"
                        doubleName="rightSideCartoonCharacters"
                        doubleHeaderKey="doubleHeaderKey"
                        doubleHeaderValue="--- Please Select ---"
                        doubleEmptyOption="true"
                        doubleMultiple="true"/>

                <s:textarea
                        label="Your Thougths"
                        name="thoughts"
                        tooltip="Enter your thoughts here"/>

                <s:submit cssClass="btn"/>
            </s:form>

Resources

Version History

Version

Date

Author

Notes

2.0.3Jul 17, 2015Johannes GeppertVersion 2.0.3
2.0.1Jan 22, 2015Johannes GeppertVersion 2.0.1
2.0.0Mai 20, 2014Johannes GeppertVersion 2.0.0

1.5.2

Nov 10, 2012

Johannes Geppert

Version 1.5.2

1.5.1

Sep 17, 2012

Johannes Geppert

Version 1.5.1

1.5.0

Aug 23, 2012

Johannes Geppert

Version 1.5.0

1.4.3

Mai 13, 2012

Johannes Geppert

Version 1.4.3

1.4.2

Apr 2, 2012

Johannes Geppert

Version 1.4.2

1.4.1

Mar 29, 2012

Johannes Geppert

Version 1.4.1

1.4.0

Mar 26, 2012

Johannes Geppert

Version 1.4.0

1.3.0

Feb 22, 2012

Johannes Geppert

Version 1.3.0

1.2.1

Feb 17, 2012

Johannes Geppert

Version 1.2.1

1.2.0

Feb 4, 2012

Johannes Geppert

Version 1.2.0