jsp读取foxpro的dbf文件
<%@page contentType="text/html"%>
<%@page pageEncoding="GBK"%>
<%@page import="java.sql.*;" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>JSP+DBF</title>
</head>
<body>
<h2 align="center">JSP连接DBF</h2><hr>
<%!
Connection con = null;
Statement st = null;
ResultSet rs = null;
%>
<%
String path = "";
request.setCharacterEncoding("GBK");
path = request.getRealPath("").replace('\\', '/');
out.println(path); /**/
int i = 1;
String url = "jdbc:odbc:driver={Microsoft Visual FoxPro Driver};" +
"SourceType=DBF;SourceDB=" + path + "/";
con = DriverManager.getConnection(url);
String Showsql = "select * from inform";
st = con.createStatement();
rs = st.executeQuery(Showsql);
while (rs.next()) {
String str = i +
相关文档:
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......
以前有提到过乱码问题,最近在使用window.open时又出现此类问题,现解决如下:
1:使用encodeURIComponent函数对参数进行处理,例如:window.open("html.jsp?name=" + encodeUrlComponent(value)));
2:修改tomcat服务器的server.xml文件添加:useBodyEncodingForURI="true"或者
URIEncoding=" ......
JSP共有以下6种基本动作:
1.jsp:include:在页面被请求的时候引入一个文件。
2.jsp:useBean:寻找或者实例化一个JavaBean。
3.jsp:setProperty:设置JavaBean的属性。
4.jsp:getProperty:输出某个JavaBean的属性。
5.jsp:forward:把请求转到 ......