-
Notifications
You must be signed in to change notification settings - Fork 30
Using Components
If you have installed Bootstrap.jsp successfully, you should be able to import the taglib into your JSP page and reference the components. The taglib uri for Bootstrap.jsp is 'http://bootstrapjsp.org/':
<%@ taglib uri="http://bootstrapjsp.org/" prefix="b" %>
<b:container>
<b:panel>I am a Panel</b:panel>
</b:container>
This will only give you an HTML fragment for a Bootstrap panel though. It is up to you to build a complete HTML document and import the Bootstrap CSS and JavaScript.
For testing and training purposes, Bootstrap.jsp comes with a handy tag for building a complete HTML page called kickstart
:
<%@ taglib uri="http://bootstrapjsp.org/" prefix="b" %>
<b:kickstart>
<b:container>
<b:panel>I am a Panel</b:panel>
</b:container>
</b:kickstart>
Kickstart references the Bootstrap CSS and JavaScript files that are bundled with Bootstrap.jsp. If you have installed Bootstrap.jsp correctly, they should be found, and you can also use them without the using the kickstart
tag. They are available at the 'bootstrapjsp/bootstrap/' mount point relative to your context path.
You may also want to import the Bootstrap.jsp JavaScript Extensions script for additional functionality (it is currently very light but further features are likely to be added):
/<context path>/bootstrapjsp/bootstrap/css/css/bootstrap.min.css
/<context path>/bootstrapjsp/bootstrap/js/bootstrap.min.js
/<context path>/bootstrapjsp/bootstrap.jsp.js
There are 3 classes of attributes in Bootstrap.jsp. First class static attributes are those documented in the taglib, have corresponding setXXX() methods in the Component classes, serve a specific purpose used by the Component, and should (if you're using a decent IDE) show in your contextual help.
Second class dynamic attributes are facet attributes. As dynamic attributes, these are not documented as attributes in the taglib, and will not show in your contextual help. Currently documentation on them is light but will probably be available soon in either the API or the Tldgen docs, and definitely in the Component reference when that materializes. Facet attributes are so called because they apply the same functionality to a number of different Components. Making this functionality available as a dynamic attribute by applying a Facet class to the Component was a design decision to ease and speed development of the library. The mold
attribute is an example of a facet attribute and is implemented by the org.bootstrapjsp.facet.MoldFacet
class.
Third class dynamic attributes are not processed but passed directly to the output. They are not defined anywhere - any attribute not recognised as either a 1st or 2nd class attribute is a 3rd class attribute.
The element type of all Components can be set with the element
attribute:
<b:carousel>
...
</b:carousel>
<b:carousel element="section">
...
</b:carousel>
<div id="3fe9" class="carousel slide">
<div class="carousel-inner">...</div>
</div>
<section id="3f85" class="carousel slide">
<div class="carousel-inner">...</div>
</section>