,ch14.9433 Page 448 Monday, February 14, 2005 12:55 PM
Example 14 7. Tiles tabbed layout (continued)
classname="java.lang.String" />
<%
String selectedColor="#98ABC7";
String notSelectedColor="#C0C0C0";
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 = request.getRequestURI( ) + "?"+parameterName + "=" + index;
// Don t add request URI prefix , but let the client compute the original URL
// This allows to use a Struts action as page URL, and perform a forward.
// Bug reported by Don Peterkofsky
//String href = "" + "?"+parameterName + "=" + index;
String color = notSelectedColor;
if( index == selectedIndex )
{
selectedBody = tab.getLink( );
color = selectedColor;
} // enf if
index++;
%>
<%=tab.getValue( )%>
|
|
448 | Chapter 14: Tiles and Other Presentation Approaches
This is the Title of the Book, eMatter Edition
Copyright 2005 O'Reilly & Associates, Inc. All rights reserved.
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved
|