jsp³£ÓÃÄÚÖöÔÏó
JSP ÄÚÖöÔÏó ÊÕ²Ø
ÄÚÖöÔÏóÊDz»ÐèÒªÉùÃ÷£¬Ö±½Ó¿ÉÒÔÔÚJSPÖÐʹÓõĶÔÏó£¬JSPÓÐÒÔϼ¸ÖÖÄÚÖöÔÏó£º
1.request¶ÔÏó
request±íʾHttpServletRequest¶ÔÏó¡£Ëü°üº¬ÁËÓйØä¯ÀÀÆ÷ÇëÇóµÄÐÅÏ¢£¬²¢ÇÒÌṩÁ˼¸¸öÓÃÓÚ»ñÈ¡cookie, header, ºÍsessionÊý¾ÝµÄÓÐÓõķ½·¨¡£¿Í»§¶ËµÄÇëÇóÐÅÏ¢±»·â×°ÔÚrequest¶ÔÏóÖУ¬Í¨¹ýËü²ÅÄÜÁ˽⵽¿Í»§µÄÐèÇó£¬È»ºó×ö³öÏìÓ¦¡£
1 Object getAttribute(String name) ·µ»ØÖ¸¶¨ÊôÐÔµÄÊôÐÔÖµ£¬¸ÃÊôÐÔ²»´æÔÚʱ·µ»Ønull¡£
2 Enumeration getAttributeNames() ·µ»ØËùÓпÉÓÃÊôÐÔÃûµÄö¾Ù
3 String getAuthType() ;·µ»ØÓÃÀ´±£»¤servletµÄÈÏÖ¤·½·¨µÄÃû³Æ£¬Î´Êܱ£»¤Ê±·µ»Ønull¡£
4 String getCharacterEncoding() ·µ»Ø×Ö·û±àÂ뷽ʽ
5 int getContentLength() ·µ»ØÇëÇóÌåµÄ³¤¶È£¨ÒÔ×Ö½ÚÊý£©£¬²»ÄÜÈ·¶¨³¤¶Èʱ·µ»Ø-1¡£
6 String getContentType() µÃµ½ÇëÇóÌåµÄMIMEÀàÐÍ
7 String getContentPath() ·µ»ØÇëÇóµÄ·¾¶¡£
8 Cookie[] getCookies() ·µ»Ø¿Í»§¶ËËùÓеÄCookieµÄÊý×é¡£
9 Enumeration getHeaderNames() ·µ»ØËùÓÐHTTPÍ·µÄÃû³ÆµÄ¼¯ºÏ¡£
10 Enumeration getHeaders( String name ) ·µ»ØÖ¸¶¨HTTPÍ·µÄËùÓÐÖµµÄ¼¯ºÏ¡£
11 String getHeader( String name ) ·µ»ØÖ¸¶¨Ãû³ÆµÄHTTPÍ·µÄÐÅÏ¢¡£
12 long getDateHeader( String name ) ·µ»ØÖ¸¶¨Ãû³ÆµÄDataÀàÐ͵ÄHTTPÍ·µÄÐÅÏ¢¡£
13 int getIntHeader( String name ) ·µ»ØÖ¸¶¨Ãû³ÆµÄIntÀàÐ͵ÄHTTPÍ·µÄÐÅÏ¢¡£
14 ServletInputStream getInputStream() µÃµ½ÇëÇóÌåÖÐÒ»ÐеĶþ½øÖÆÁ÷
15 Locale getLocale() ·µ»Øµ±Ç°Ò³µÄLocale¶ÔÏ󣬿ÉÒÔÔÚresponseÖÐÉ趨¡£
16 Enumeration getLocales() ·µ»ØÇëÇóÖÐËùÓеÄLocale¶ÔÏóµÄ¼¯ºÏ¡£
17 String getLocalName() »ñÈ¡ÏìÓ¦ÇëÇóµÄ·þÎñÆ÷¶ËÖ÷»úÃû¡£
18 String getLocalAddr() »ñÈ¡ÏìÓ¦ÇëÇóµÄ·þÎñÆ÷¶ËµØÖ·¡£
19 int getLocalPort() »ñÈ¡ÏìÓ¦ÇëÇóµÄ·þÎñÆ÷¶Ë¶Ë¿Ú
20 String getMethod() »ñÈ¡¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍÇëÇóµÄ·½·¨(GET¡¢POST)¡£
21 String getParameter(String name) ·µ»ØnameÖ¸¶¨²ÎÊýµÄ²ÎÊýÖµ
22 Map getParameterMap() ¸Ã·½·¨·µ»Ø°üº¬ÇëÇóÖÐËùÓвÎÊýµÄÒ»¸öMap¶ÔÏó¡£
23 Enumeration getParameterNames() ·µ»ØÇëÇóÖÐËùÓвÎÊýµÄ¼¯ºÏ¡£
24 String[] getParameterValues(String name) ·µ»Ø°üº¬²ÎÊýnameµÄËùÓÐÖµµÄÊý×é
25 String getQueryString() ·µ»Øget·½·¨´«µÝµÄ²ÎÊý×Ö·û´®£¬¸Ã·½·¨²»·Ö½â³öµ¥¶ÀµÄ²ÎÊý¡£
26 Strin
Ïà¹ØÎĵµ£º
<%@ page contentType=”text/html; charset=GB2312″ %>
<META http-equiv=Content-Type content=”text/html; charset=gb2312″>
pageEncoding ÊÇjspÎļþ±¾ÉíµÄ±àÂë
contentTypeµÄcharsetÊÇ·þÎñÆ÷·¢Ë͸ø¿Í»§¶ËµÄÄÚÈݵıàÂë¡£
ÔÚÍøÒ³µÄHTMLÔ´´úÂëÖÐÒ»¸öÖØÒªµ ......
1¡¢ ×î»ù±¾µÄÂÒÂëÎÊÌâ¡£
Õâ¸öÂÒÂëÎÊÌâÊÇ×î¼òµ¥µÄÂÒÂëÎÊÌâ¡£Ò»°ãлá³öÏÖ¡£¾ÍÊÇÒ³Ãæ±àÂë²»Ò»Öµ¼ÖµÄÂÒÂë¡£
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=iso8859-1"%>
<html>
<head>
<title>ÖÐÎÄÎÊÌâ</title>
<meta http-equi ......
ÔÚÓ¦ÓóÌÐò¿ª·¢µÄʱºò·ÖÒ³ÓÐÁ½ÖÖ:Õæ·ÖÒ³ºÍ¼Ù·ÖÒ³£¬¼Ù·ÖÒ³Òª°ÑËùÓÐÊý¾ÝÏÈÌáÈ¡³öÀ´·Åµ½Ò»¸ölist¼¯ºÏÀï»òÕß¾²Ì¬±äÁ¿ÖС£Õæ·ÖÒ³ÔòÊÇÐèÒªÓõ½¼¸ÐÐÊý¾ÝÔÙ´ÓÊý¾Ý¿âÖÐÌáÈ¡³öÀ´·Å°ÑÐèÒªÏÔʾµÄÊý¾Ý·Åµ½list¼¯ºÏÀï¡£µ«ÎÞÂÛÕæ·ÖÒ³¼Ù·ÖÒ³pager-taglib¶¼¿ÉÒԺܺõÄΪÎÒÃǽøÐд¦Àí¡£
1.ÏÂÔØpager-taglib
ÏÂÔØµØ ......
Jsp ÒÔUrl·½Ê½´«²ÎÊýÂÒÂëÎÊÌâ
±ÈÈç˵ xxxx.action?name="ÖÐÎÄ"
´«µ½Action »á·¢Éú ÂÒÂë
½â¾ö·½·¨1£ºÒª¸Ätomcat µÄ±àÂë
2£º
Òª¸Ä³ÉÕâ¸ö·½Ê½¿ÉÒÔ½â¾öÂÒÂ룺
xxxx.action?name=encodeURIComponent("ÖÐÎÄ"); ......
Impl
public class BaseDAOImpl extends HibernateDaoSupport implements IBaseDAO
//Ìí¼ÓÊý¾Ý
this.getHibernateTemplate().save(achi);
//ɾ³ý
this.getHibernateTemplate().delete(this.getById(achi));
//²éѯËùÓÐ
return this.getHibernateTemplate().find("from Achievement a ......