ʯ¼ÒׯÍøÕ¾Éè¼Æ£ºjspÍøÕ¾µÄ¾²Ì¬Ò³ÃæÉú³É·½°¸
ʯ¼ÒׯÌáÉýÍøÕ¾ÐÔÄܵķ½Ê½Óкܶ࣬ÀýÈçÓÐЧµÄʹÓûº´æ£¬Éú³É¾²Ì¬Ò³ÃæµÈµÈ¡£½ñÌìҪ˵µÄ¾Í
ÊÇÉú³É¾²Ì¬Ò³ÃæµÄ·½Ê½¡£
ʲô½ÐÉú³É¾²Ì¬Ò³ÃæÄØ£¿ºÜ¼òµ¥£¬ÀýÈçÎÒÃÇÈç¹û·ÃÎÊÒ»¸öÁ´½Ó http://xyz.com/index.do£¬
ÄÇô·þÎñÆ÷¾Í»á½âÎöÕâ¸öÇëÇó£¬ÈÃÌض¨µÄAction È¥´¦Àí¡£ÕâÆäÖеÄȱµãÊÇÏÔ¶øÒ×¼ûµÄ£ºÈç¹û
·ÃÎʵÄÈË£¬ÄÇô¾Í»á¼ÓÖØÓ¦Ó÷þÎñÆ÷µÄѹÁ¦£¬×î¶ñÁӵĺó¹û¾ÍÊÇÓ¦Ó÷þÎñÆ÷down µôÁË¡£ÄÇ
ôÈçºÎÈ¥±ÜÃâÄØ£¿Èç¹ûÎÒÃÇ°Ñ¶Ô index.do ÇëÇóºóµÄ½á¹û±£´æ³ÉÒ»¸ö html Îļþ£¬È»ºóÿ´Î
Óû§¶¼È¥·ÃÎÊ http://xyz.com/index.html £¬ÕâÑùÓ¦Ó÷þÎñÆ÷µÄѹÁ¦²»¾Í¼õÉÙÁË£¿
ºÃ°É£¬ÎÒÒѾѧ»áÈçºÎÉú³É¾²Ì¬Ò³ÃæÁË¡£´ò¿ªÎÒµÄä¯ÀÀÆ÷£¬ÊäÈë http://xyz.com/index.do£¬
È»ºóÔÙʹÓÓÁí´æΪ”¹¦Äܱ£´æÒ»¸öhtml Îļþ£¬È»ºóÉÏ´«µ½·þÎñÆ÷£¬ÕâÑù¾Íok ÁË£¡
ÎÒ²»ÄÜ˵Õâ²»Êǽâ¾ö·½°¸£¬µ«ÊÇÎÒ¿ÉÒÔ˵Õâ²»ÊǺõĽâ¾ö·½°¸¡£ÎÒÃÇÐèÒªµÄÊÇ×Ô¶¯µÄÉú
³É¾²Ì¬Ò³Ã棬µ±Óû§·ÃÎÊ http://xyz.com/index.do£¬»á×Ô¶¯Éú³É index.html £¬È»ºóÏÔʾ¸ø
Óû§¡£
1¡¢ »ù´¡—URL Rewrite
ʲôÊÇ URL Rewrite ÄØ£¿Çë google it ☺ ¡£²»¹ýÕâÀï¼òµ¥µÄ啰àÂһϡ£´Ó×ÖÃæ
ÉÏÎÒÃǾͿÉÒÔÀí½âËüµÄÒâ˼£ºURL ÖØд¡£ÓÃÒ»¸ö¼òµ¥µÄÀý×ÓÀ´ËµÃ÷ÎÊÌ⣺ÊäÈëÍøÖ· copyright dedecms
http://www.xyz.com/index.do £¬ µ«ÊÇʵ¼ÊÉÏ·ÃÎʵÄÈ´ÊÇ
http://www.xyz.com/index.action£¬ÄÇÎÒÃǾͿÉÒÔ˵URL ±»ÖØдÁË¡£ÕâÏî¼¼ÊõÓ¦ÓÃ
¹ã·º£¬ÓÐÐí¶à¿ªÔ´µÄ¹¤¾ß¿ÉÒÔʵÏÖÕâ¸ö¹¦ÄÜ¡£
2¡¢ »ù´¡—Servlet web.xml
Èç¹ûÄ㻹²»ÖªµÀweb.xml ÖÐÒ»¸öÇëÇóºÍÒ»¸öservlet ÊÇÈçºÎÆ¥Åäµ½Ò»ÆðµÄ£¬ÄÇô
ÇëËÑË÷һϠservlet µÄÎĵµ¡£Õâ¿É²»ÊÇÂÒ˵ѽ£¬ÓкܶàÈ˾ÍÈÏΪ /xyz/*.do ÕâÑùµÄÆ¥
Å䷽ʽÄÜÓÐЧ¡£
Èç¹ûÄ㻹²»ÖªµÀÔõô±àдһ¸ö servlet £¬ÄÇôÇëËÑË÷Ò»ÏÂÈçºÎ±àдservlet¡£Õâ¿É
²»ÊÇ˵Цѽ£¬ÔÚ¸÷ÖÖ¼¯³É¹¤¾ßÂþÌì·ÉÎèµÄ½ñÌ죬ºÜ¶àÈ˶¼²»»áÈ¥´ÓÁã±àдһ¸öservlet
ÁË¡£
3¡¢ ̸̸·½·¨
ºÃÁË£¬ÏÖÔÚ²½ÈëÕýÌ⡣̸̸Éú³É¾²Ì¬Ò³ÃæµÄ·½·¨(»¹ÊDz»ÒªËµ³É“ÔÀ픣¬¸øÈËÒ»ÖÖ
ºÜ¸ßÉîµÄ¸Ð¾õ)¡£·½·¨¾ÍÊÇÕâÑù£º
·½·¨1
ÆäÖУ¬¶ÔÓÚURL Rewriter µÄ²¿·Ö£¬¿ÉÒÔʹÓÃÊÕ·Ñ»òÕß¿ªÔ´µÄ¹¤¾ßÀ´ÊµÏÖ£¬Èç¹û url
²»ÊÇÌرðµÄ¸´ÔÓ£¬¿ÉÒÔ¿¼ÂÇÔÚ servlet ÖÐʵÏÖ£¬ÄÇô¾ÍÊÇÏÂÃæÕâ¸öÑù×Ó£º
´¦Àí .action µÄservlet
ÇëÇó index
URL
Rewriter
ÇëÇó index.action
Èç¹û¾²Ì¬Ò³Ãæ
´æÔÚ
ÏÔʾ¾²Ì¬Ò³Ãæ
Éú³É¾²Ì¬Ò³Ãæ
ÏÔʾ¾²Ì¬Ò³Ãæ
ÄÚÈÝÀ´×
Ïà¹ØÎĵµ£º
jspÒ³ÃæÖиù¾ÝÒ»¸öcheckedÊÇ·ñ±»Ñ¡ÖÐÀ´µ¯³ö²»Í¬µÄÈ·È϶Ի°¿ò¡£
<script type="text/javascript">
function modifyDetail() {
var v = document.getElementById("isDelete");
......
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< ......
ͨ³££¬ÎÒÃÇÐèÒªÌṩһ¸öÎļþÏÂÔصÄʱºò£¬½öÐèÒªÒ»¸ö³¬Á´½Ó¾Í¿ÉÒÔ½â¾ö¡£
±ÈÈçexeÎļþ£¬Êó±ê×ó¼üµã»÷Á´½Ó¾Í»áÌáʾÄãÖ±½ÓÖ´Ðл¹ÊDZ£´æ£¬ÓÒ¼üÔò¿ÉÒÔÖ±½ÓÁí´æΪ¡£¡£¡£
µ«ÊÇÓÐÒ»²¿·ÖÎļþ£¬±ÈÈçtxtµÈ¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐÖ±½Ó´ò¿ªµÄÎļþ£¬ÄãÖ»ÄÜÓÃÊó±êÓÒ¼üµã»÷Á´½ÓÈ»ºóÁí´æΪµÄ·½Ê½È¥±£´æ¸ÃÎļþ£¬Èç¹ûÖ±½Óµã»÷×ó¼ü£¬¸Ã ......
Ò»°ãjsp½Å±¾¶¼ÊÇÔÚ<%= %>ÖÐÊä³ö¶«Î÷£¬µ«ÊÇÈç¹ûÒªÌáʾµÄ»°£¬Ôò±ØÐëºóÃæÒª¼ÓÒ»¸ö¿Õ¸ñ£¬¾ÍÏñÄǸö·ûºÅÒ»Ñù£¬²»È»µÄ»°´òµÄÌáʾ²»»á³öÀ´
»¹ÓÐÒ»¸öʹØÓÚ·¾¶ÎÊÌ⣺±ØÐëÒªÔÚºóÃæ¼ÓÉÏ"/"Õâ¸ö·´Ð±¸Ü
myeclipse ÖÐÓÐÒ»¸ösnippetsÊÓͼ,Õâ¸öÀïÃæÌṩһЩÒѾдºÃÁ˵ĴúÂ룬ÎÒÃÇÒ²¿ÉÒÔ½«×Ô¼ºµÄһЩ´úÂëÌí¼Óµ½snippetsÖУ¬ÓÒ¼ü£¬a ......
´ó¼Ò×ÜÊDz»Ï²»¶¿´µ½<%ºÍ%>ÔÚjspÒ³ÃæÉÏ£¬ÆäʵÎÒÃÇ¿ÉÒÔʹÓñȽÏÓÅÑŵÄxml·½Ê½À´±í´ï
1£¬Òþº¬µÄ×¢ÊÍ
JSPÓï·¨£º<%-- ÄÚÈÝ --%>
XMLÓï·¨£ºÎÞ
2£¬±äÁ¿»òº¯ÊýµÄÉùÃ÷
JSPÓï·¨:<%! declaration;[declaration;]+... %>
ÀýÈ磺
<%!
int i=0;int a,b,c;
Color red=new Color( ......