%@ include file="/includes/taglibs.jsp" %>
<%--
Tabs Layout .
This layout allows to render several Tiles in a tabs fashion.
@param tabList A list of available tabs.
We use MenuItem to carry data (name, body, icon, ...)
@param selectedIndex Index of default selected tab
@param parameterName Name of parameter carrying selected info in HTTP request.
--%>
<%--
Use Tiles attributes, and declare them as page variable.
These attribute must be passed to the Tile.
--%>
<%--
--%>
<%
String selectedTab = "selectedTab";
String notSelectedTab = "tab";
String qString = "";
//String qString = "customerId=" + customerId;
int index = 0;
// Loop index
int selectedIndex = 0;
// Check if selected come from request parameter
try {
selectedIndex = Integer.parseInt(selectedIndexStr);
selectedIndex = Integer.parseInt(request.getParameter(parameterName));
} catch(java.lang.NumberFormatException ex ) {
// do nothing
}
// Check selectedIndex bounds
if (selectedIndex < 0 || selectedIndex >= tabList.size()) selectedIndex = 0;
String selectedBody =
((org.apache.struts.tiles.beans.MenuItem)tabList.get(selectedIndex)).getLink();
// Selected body
%>
<%-- Draw tabs --%>
|
<%
// compute href
String href = actionName + "?" + parameterName + "=" + index ; //+ "&" + qString ;
String styleClass = notSelectedTab;
if (index == selectedIndex) {
selectedBody = tab.getLink() + "?" + qString;
styleClass = selectedTab;
}
// enf if
index++;
%>
<%=tab.getValue()%> |
|
|
|
|
<%-- Draw body --%>
|
|
|
|
<%--
<%= selectedBody %>
--%>