jsp·ÖÒ³£¨oracle+jsp+apache£©
Ò» ǰÌá
Ï£Íû×îеļͼÔÚ¿ªÍ·¸øÄãµÄ±í½¨Á¢²éѯ£º
񡜧mytable
²éѯ£ºcreate or replace view as mytable_view from mytable order by id desc ÆäÖУ¬×îºÃʹÓÃÐòÁкÅcreate sequence mytable_sequence À´×Ô¶¯Ôö¼ÓÄãµÄ¼Í¼idºÅ
¶þ Ô´³ÌÐò
<%String sConn="ÄãµÄÁ¬½Ó"
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection(sConn,"ÄãµÄÓû§Ãû","ÃÜÂë");
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
Statement stmtcount=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select * from mytable_view");
String sqlcount="select count(*) from mytable_view";
ResultSet rscount=stmtcount.executeQuery(sqlcount);
int pageSize=ÄãµÄÿҳÏÔʾ¼Í¼Êý£»
int rowCount=0; //×ܵļǼÊý
while (rscount
int pageCount; //×ܵÄÒ³Êý
int currPage; //µ±Ç°Ò³Êý
String strPage;
strPage=request.getParameter("page");
if (strPage==null){
currPage=1;
}
else{
currPage=Integer.parseInt(strPage);
if (currPage<1) currPage=1;
}
pageCount=(rowCount+pageSize-1)/pageSize;
if (currPage>;pageCount) currPage=pageCount;
int thepage=(currPage-1)*pageSize;
int n=0;
rs.absolute(thepage+1);
while (n<(pageSize)&&!rs
%>;
<%rs.close();
rscount.close();
stmt.close();
stmtcount.close();
conn.close();
%>;
//ÏÂÃæÊÇ µÚ¼¸Ò³µÈ
<form name="sinfo" method="post" action="sbinfo_index.jsp?condition=<%=condition%
Ïà¹ØÎĵµ£º
£¨1£©oracleÊý¾Ý¿â±¸·ÝµÄµ¼Èë¶ÔÊý¾Ý¿âµÄ°æ±¾ÓÐÒªÇó£¬Ò²¼´Ô´Êý¾Ý¿â£¨µ¼³ö²úÉú±¸·ÝµÄÊý¾Ý¿â£©µÄ°æ±¾ÒªºÍÄ¿±êÊý¾Ý¿â£¨µ¼ÈëÊý¾Ý¿â£©µÄ°æ±¾Ò»Ö£¬·ñÔò¿ÉÄܵ¼Öµ¼Èëʧ°Ü¡£
£¨2£©±¸·ÝÖеÄÓû§Ãû£¨Êý¾Ý¿âµ¼³öʱËùʹÓõÄÓû§£©ºÍµ¼ÈëÊý¾Ý¿âµÄÓû§Ãû×îºÃÒ»Ñù£¬ÒòΪÓû§ÃûºÍ±í¿Õ¼äÃüÃûÓйØÏµ£¬Èç¹û²»Ò»Ñù£¬µ¼Èë¾Í²»ÄÜÒ»´ÎÍê³É¡£Ò²¾ÍÊÇ ......
¡¡
¡¡¡¡1. ʹÓÃ%TYPE
¡¡¡¡ÔÚÐí¶àÇé¿öÏ£¬PL/SQL±äÁ¿¿ÉÒÔÓÃÀ´´æ´¢ÔÚÊý¾Ý¿â±íÖеÄÊý¾Ý¡£ÔÚÕâÖÖÇé¿öÏ£¬±äÁ¿Ó¦¸ÃÓµÓÐÓë±íÁÐÏàͬµÄÀàÐÍ¡£ÀýÈ磬students±íµÄfirst_nameÁеÄÀàÐÍΪVARCHAR2(20),ÎÒÃÇ¿ÉÒÔ°´ÕÕÏÂÊö·½Ê½ÉùÃ÷Ò»¸ö±äÁ¿£º
¡¡¡¡DECLARE
¡¡¡¡ v_FirstName VARCHAR2(20);
¡¡
¡¡µ«ÊÇÈç¹ûfirst_nameÁе͍Òå¸Ä±äÁ ......
1¡¢´´½¨±í
create table stud(
sid int,
sname varchar2(50),
age number,
score number(4,2))
²¢²åÈëһЩÊý¾Ý£¨×Ô¼ºÊÖ¶¯²åÈëһЩ°É£©
2¡¢´´½¨º¯Êý
create or replace function fun_getScores(
v_age in stud.age%type
)
return number
is ......
1.request¶ÔÏó
¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£ËüÊÇHttpServletRequestÀàµÄʵÀý¡£
ÐòºÅ ·½ ·¨ ˵ Ã÷
1 object getAttribute(String name) ·µ»ØÖ¸¶¨ÊôÐÔµÄÊôÐÔÖµ
2 Enumeration getAttributeNames() ·µ»ØËùÓпÉÓÃÊôÐÔÃûµÄö¾Ù
3 String getCharacterEncoding( ......