Myeclipseн¨jspÎļþʱĬÈÏ´úÂë
ÒýÓÃ×Ô: http://hi.baidu.com/tickwudi/blog/item/1c0ddb6dd4e821fc4316949b.html
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'MyJsp.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css" mce_href="styles.css">
-->
</head>
<body>
This is my JSP page. <br>
</body>
</html>
ÉÏÃæΪMyeclipseн¨jspÎļþʱĬÈÏ´úÂ룡£¡
Ò»°ãҲûʲôÓ㡵«ÊÇ£¡ÎÒ»¹ÊDZêÉÏ×Ô¼º²éµÄ½âÊÍ°É£¡
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
ʹÓõÄÓïÑÔ£¬µ¼ÈëµÄ°ü£¬Ä¬ÈϱàÂë
<%
String path = request.getContextPath();
»ñµÃµÄµ±Ç°Ä¿Â¼Â·¾¶
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
ÐÒé+"://"+·þÎñµØÖ·Ãû+·þÎñ¶Ë¿Ú+Ŀ¼·¾¶
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
ΪҳÃæÌí¼ÓÕýÈ·µÄDOCTYPE
ºÜ¶àÉè¼ÆʦºÍ¿ª·¢Õ߶¼²»ÖªµÀʲôÊÇDOCTYPE£¬DOCTYPEÓÐʲôÓá£DOCTYPEÊÇdocument typeµÄ¼òд¡£Ö÷ÒªÓÃÀ´ËµÃ÷ÄãÓõÄXHTML»òÕßHTMLÊÇʲô°æ±¾¡£ä¯ÀÀÆ÷¸ù¾ÝÄãDOCTYPE¶¨ÒåµÄDTD(ÎĵµÀàÐͶ¨Òå)À´½âÊÍÒ³Ãæ´úÂë¡£ËùÒÔ£¬Èç¹ûÄã²»×¢ÒâÉèÖÃÁË´íÎóµÄDOCTYPE£¬½á¹û»áÈÃÄã´ó³ÔÒ»¾ª¡£XHTML1.0ÌṩÁËÈýÖÖDOCTYPE¿ÉÑ¡Ôñ£º
(1)¹ý¶ÉÐÍ£¨Transitional £©
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona
Ïà¹ØÎĵµ£º
1. ActionContext
ÔÚStruts2¿ª·¢ÖÐ,³ýÁ˽«ÇëÇó²ÎÊý×Ô¶¯ÉèÖõ½ActionµÄ×Ö¶ÎÖÐ,ÎÒÃÇÍùÍùÒ²ÐèÒªÔÚActionÀïÖ±½Ó»ñÈ¡ÇëÇó(Request)»ò»á»°
(Session)µÄһЩÐÅÏ¢,ÉõÖÁÐèÒªÖ±½Ó¶ÔJavaServlet
HttpµÄÇëÇó(HttpServletRequest),ÏìÓ¦(HttpServletResponse)²Ù×÷.
ÎÒÃÇÐèÒªÔÚActionÖÐÈ¡µÃrequestÇëÇó²ÎÊý"username"µÄÖµ: ......
ÎÒµÄjsp±à³Ì»·¾³Ò²ÊÇ×î½ü²Å´î½¨ÆðÀ´µÄ£¬ÓõÄÊÇwindows2003£«ecplise£«tomcat£«lomboz£«sql Server 2000£¬´î½¨µÄ¹ý³ÌÖгÔÁ˲»ÉٵĿàÍ·£¬ÔڴµÄ¹ý³ÌÖÐ×ܽáÁËһЩ¾Ñ飬¶ÔÓÚjsp´î½¨ÔÚÍøÉÏÓв»ÉٵĽéÉÜ£¬´î½¨ÆðÀ´±È½ÏÈÝÒ×£¬ÏÂÃæÖ÷Òª½éÉÜÔÚjsp´î½¨ÆðÀ´ºóÁ¬½ÓÊý¾Ý¿âҪעÒâµÄµØ·½£º
£¨1£©Êý¾Ý¿âµÄ°æ±¾Ñ¡ÔñÒªÕýÈ·£¬Ñ¡ÔñµÄ°æ±¾ºÍ ......
setAttribute()ÊÇÓÃÓÚ·þÎñÆ÷¶ËÉèÖÃÊôÐÔÏò¿Í»§¶Ë·¢Ë͸ÃÊôÐÔ£¬ÔÚ¿Í»§¶Ëͨ¹ýgetAttribute£¨£©»ñµÃÊôÐÔ¡£setAttribute()Ò²ÄÜ´«µÝ¶ÔÏó¡£
setParameter()ÊÇ¿Í»§¶ËÏò·þÎñÆ÷¶Ë·¢ËÍÊôÐÔ£¬Ö»ÄÜ´«×Ö·û£¬ÓÃÓÚget/postµÄÊýÖµ´«µÝ£¬ÔÚ·þÎñ¶ËÓÃgetParameter£¨£©»ñÈ¡£¬Ò³ÃæÖÐÓÐforward´Ó¶¨ÏòÒ³ÃæµÄµØÖ·ÖеIJÎÊýÒ²ÄÜÓÃgetParameter£¨£©»ñÈ¡¡ ......
Ò»£º¹¤³§Ä£Ê½³öÏÖµÄÔÒò
Ò»°ãÉè¼Æģʽ£º
view plaincopy to clipboardprint?
interface Fruit{
public void eat();
}
class Apple implements Fruit{
&n ......