記事をすぐ編集 ふるいむかし
<div class="entry-footer">
<A href="/sb/admin.cgi?__mode=edit&eid={entry_id}" target="_blank">lightbox</A>
Category: {category_name}
</div>
|
<div class="entry-footer">
<A href="/sb/admin.cgi?__mode=edit&eid={entry_id}" target="_blank">lightbox</A>
Category: {category_name}
</div>
<%@ page language="java" import="java.io.*" import="java.text.*" import="java.util.*" import="java.sql.*" contentType="text/html;charset=Windows-31J" %> <HTML> <BODY> <% // ********************************************************* // Shift_JIS の特殊文字を正しく表示する為の Windows-31J // ( ※ 7 行目に注目 ) // ********************************************************* Connection cn = null; Statement st = null; ResultSet rs = null; int nCnt = 0; // ********************************************************* // ドライバの準備 // ********************************************************* Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ); // ********************************************************* // 接続 // ********************************************************* cn = DriverManager.getConnection( "jdbc:odbc:jspMDBlightbox", "", "" ); // ********************************************************* // SQL 処理準備 // ********************************************************* st = cn.createStatement(); // ********************************************************* // 行を返す SQL を実行 // ********************************************************* rs = st.executeQuery( "select * from [商品マスタ]" ); while( rs.next() ) { nCnt++; out.print( nCnt + ", " + rs.getString( 1 ) ); out.println( "," + rs.getString( 2 ) + "<br>" ); } rs.close(); st.close(); // ********************************************************* // 接続解除 // ********************************************************* cn.close(); %> </BODY> </HTML>
<%@ page
language="java"
import="java.io.*"
import="java.text.*"
import="java.util.*"
contentType="text/html;charset=shift_jis" %>
<%
// *********************************************************
// web.xml のデータ取得
// *********************************************************
Enumeration enumInit = application.getInitParameterNames();
String strData = "";
String strKey = null;
while( enumInit.hasMoreElements() ) {
strKey = enumInit.nextElement().toString();
strData += strKey;
strData += " => ";
strData += application.getInitParameter(strKey);
strData += "\n";
}
%>
<HTML>
<BODY>
<!-- 埋め込みで出力 -->
<PRE>
<%= strData %>
</PRE>
</BODY>
</HTML>
<%@ page language="java" import="java.io.*" import="java.text.*" import="java.util.*" contentType="text/html;charset=shift_jis" %> <%! int nCount = 0; // ********************************************************* // 物理パス取得 // ※ このページで有効なローカル関数です ( 7行目に注目 ) // ********************************************************* public String getRealPath( ServletContext app, String strUrl ) { String strPath = null; strPath = app.getRealPath( strUrl ); return strPath; } %> <% // getRealPath は、上記関数を読んでいます String strPath = getRealPath( application, "" ); out.print( strPath + "<br>" ); // nCount は、このページで保持される変数です // 他のページへ移動しても残っています nCount++; out.print( nCount ); %>
|