本文目錄一覽:
網上下的jsp源碼要怎麼用
需要部署到伺服器中
找到菜單 window → Show View → Servers,打開Servers視圖標籤,部署的Tomcat 服務
在這個服務上右擊,選擇「Add Deployment」
在新打開的對話框中,有一個Project項,選擇要部署的項目
點擊「Finish」完成部署
這樣項目就部署到Tomcat裡面去了
求一個簡易JSP網購系統的網站源碼
我有一個。連資料庫都沒有用,直接在頁面傳遞價格等信息。但jsp的技術都使用了,很適合學習的,我就用這個學習,而且還自己添加了很多功能。要的話給我留言。希望可以交流一下。
程序已經發送,注意查收。zhuiwen1987@126.com
jsp 中網站的首頁源代碼
這是最簡單的一個例子,資料庫要你自己建,用的是ACCESS
%@ page contentType=”text/html; charset=gb2312″ language=”java” import=”java.sql.*” errorPage=”” %
html
head
meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″
titleJSP連接Access資料庫/title
style type=”text/css”
!–
.style1 {
font-size: 20px;
font-weight: bold;
}
—
/style
/headbody
div align=”center” class=”style1″JSP連接Access資料庫/div
br
hr
p%
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”); //載入驅動程序類別
Connection con = DriverManager.getConnection(“jdbc:odbc:jspdata”); //建立資料庫鏈接,jspdata為ODBC數據源名稱
//建立Statement對象
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(“select * from lyb”); //建立ResultSet(結果集)對象,並執行SQL語句
%
/p
p align=”center”NUMB1數據表中記錄如下/p
table width=”640″ border=”1″ align=”center” bordercolor=”#7188e0″
tr bgcolor=”d1d1ff”
th width=”49″編號/th
th width=”90″姓名/th
th width=”126″E-mail/th
th width=”221″網站/th
th width=”80″QQ/th
/tr
%
while(rs.next())
{
%
tr bgcolor=”#f8f8f8″
th%= rs.getString(1) %/th
th%= rs.getString(2) %/th
th%= rs.getString(3) %/th
th bgcolor=”#f6f6f8″%= rs.getString(4) %/th
th%= rs.getString(5) %/th
/tr
%
}
rs.close();
stmt.close();
con.close();
%
/table
p align=”center”br
如果您能看到表格中的數據,說明連接資料庫成功!/p
/body
/html
求一個功能完整的jsp企業網站源碼
你去找找《JSP資料庫編程指南》這本書,書後附帶的光碟好像有好幾個例子
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/304970.html