struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Jouravlev <jmi...@gmail.com>
Subject [ANN] Tabbed notebooks in Struts/JSP or in pure JSP with new release of JSP Controls Tag Library
Date Mon, 30 Jan 2006 00:13:53 GMT
Well, finally I found time to encapsulate HTML into some tags. Wendy,
roles work too :-)

To build your own tabbed notebook you need to download tag library
version 0.4 from here:
http://sourceforge.net/project/showfiles.php?group_id=154342&package_id=171420&release_id=389310

Please, download samples and examine /tabs directory, it contains the
samples you need. You MUST create a separate JSP file for your tabbed
notebook. This JSP will be used as target for requests. You MUST
process tab change events on input phase, and set/obtain view name on
render phase.

The simplest three-tab notebook looks like this:

<%@ page import="net.jspcontrols.util.Constants"%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://jspcontrols.net/tags/core" prefix="jc" %>
<%@ taglib uri="http://jspcontrols.net/tags/tabcontrol" prefix="jc-tab" %>

<span id="TigrisTabComponent_def">

<%-- Accept phase, either postback or regular link containing an event --%>

  <jc:accept>
    <jc:handler event="tab1event">
      <% session.setAttribute("tabsetOneCurrentTab", "tab1"); %>
    </jc:handler>
    <jc:handler event="tab2event">
      <% session.setAttribute("tabsetOneCurrentTab", "tab2"); %>
    </jc:handler>
    <jc:handler event="tab3event">
      <% session.setAttribute("tabsetOneCurrentTab", "tab3"); %>
    </jc:handler>
  </jc:accept>

<%-- Prerender phase: store reload address; fixup response header --%>

  <jc:prerender/>

<%-- Render Phase: render tabs --%>

  <jc-tab:tabcontrol styleClass="tigristabs">
    <jc-tab:tabpage default="true" viewKey="tabsetOneCurrentTab" view="tab1">
      <jc-tab:tabgrip event="tab1event" value="Tab1"/>
      <jc-tab:tabpanel>
          <p>Content of the first tab panel goes here.</p>
      </jc-tab:tabpanel>
    </jc-tab:tabpage>
    <jc-tab:tabpage viewKey="tabsetOneCurrentTab" view="tab2">
      <jc-tab:tabgrip event="tab2event" value="Tab2"/>
      <jc-tab:tabpanel>
          <p>Content of the second tab panel goes here.</p>
      </jc-tab:tabpanel>
    </jc-tab:tabpage>
    <jc-tab:tabpage viewKey="tabsetOneCurrentTab" view="tab3"
roles="admin, manager, tabtest1">
      <jc-tab:tabgrip event="tab3event" value="Tab3"/>
      <jc-tab:tabpanel>
          <p>Content of the third tab panel goes here.</p>
      </jc-tab:tabpanel>
    </jc-tab:tabpage>
  </jc-tab:tabcontrol>

</span>

Then you include your component into composite page like this:

    <div id="TigrisTabComponent" style="width: 500px;">
      <jsp:include page="tigrisTabComponent.jsp"/>
    </div>

This is it. It works with Javascript turned off, or in Ajax mode with
Javascript turned on. See live demo here:
http://www.superinterface.com/jspcontrols/tabcontrol/index.jsp

--
Michael Jouravlev.
JSP Controls: http://jspcontrols.sourceforge.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message