<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld" 
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<jsp:directive.page import="org.opengion.hayabusa.common.*,org.opengion.hayabusa.resource.*,org.opengion.hayabusa.db.*" />
<og:head headType="query" />
<jsp:directive.include file="/jsp/custom/query_info.jsp" />
<og:comment
	system	= "GF:エンジンサンプル"
	pgid	= "GF6240"
	title	= "EXCEL出力"
	date	= "2008/10/27"
	author	= "Hiroki.Nakamura"
	text	= ""
	version	= "001"
/>

<og:userInfo command="SQL">
	<jsp:text>select count(*) CNT from ( {@USER.LASTSQL} )</jsp:text>
</og:userInfo>

<pre><jsp:scriptlet>
	UserInfo userInfo = (UserInfo)session.getAttribute( HybsSystem.USERINFO_KEY );
	int cnt = Integer.parseInt( userInfo.getAttribute( "CNT" ) );
	String maxCnt = request.getParameter( "maxRowCount" );
	int maxRowCount  = ( maxCnt == null ) ? HybsSystem.sysInt( "DB_MAX_ROW_COUNT" ) : Integer.parseInt( maxCnt );
	int skipRowCount = 0;
	int fcnt = 1;

	for( int i=0; i&lt;cnt; i+=maxRowCount ) {
		int max = ( i+maxRowCount &lt; cnt ) ? i+maxRowCount : cnt ;
		out.print( "&lt;a href=\"result.jsp?skipRowCount=" );
		out.print( skipRowCount );
		out.print( "&amp;maxRowCount=" );
		out.print( maxRowCount );
		out.print( "&amp;command=NEW" );
		out.print( "&amp;filename=FileOut" );
		out.print( fcnt );
		out.print( ".xls\" " );
		out.print( "target=\"_blank\" &gt;" );
		out.print( "[" );
		out.print( skipRowCount + 1 );
		out.print( "-" );
		out.print( max );
		out.print( "]&lt;/a&gt;    \t" );
		skipRowCount += maxRowCount;
		if( (fcnt % 5) == 0 ) {
			out.print( "&lt;br /&gt;" );
		}
		fcnt ++ ;
	}
</jsp:scriptlet></pre>

<!-- history.back() で戻るボタンを表示します。	-->
<jsp:directive.include file="/jsp/common/history_back.jsp" />

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
