JSPÖеIJÎÊý´«µÝ·½·¨
£¨1£©ÀûÓÃ<jsp:param name="paramName" value="paramValue"></jsp:param>ÆäÖÐnameΪÓëÊôÐÔÏà¹ØÁªµÄ¹Ø¼ü´Ê£¬valueΪÊôÐÔµÄÖµ¡£
ʾÀý£º´«³£Á¿×Ö·û´®<param name="userName" value="shilei"/>
ʾÀý£º´«±äÁ¿ User user=new User("shilei");//UserÊÇÒ»¸öÀà
<jsp:param name="user" value="<%=user%>"/>//<%=user%>ÀïÃæÀ¨ÆðÀ´µÄÊÇjsp±í´ïʽ
£¨2£©ÀûÓÃsession.setAttribute("attributeName",attribute)»òÕßrequest.setAttribute("attributeName",attribute)
ʾÀý£ºUser user=new User("shilei");
session.setAttribute("userName",user);
£¨3£©¾ÍÏñ´«Í³µÄhtmlÄÇÑùÀûÓÃ±íµ¥×¨µÝ²ÎÊý¡£
ʾÀý£º<form name="loginForm" action="checkLogin.jsp" method="get">
<input type="text" name="username">
<input type="password" name="userpwd">
<input type="submit" value="Ìá½»">
</form>
£¨4£©Ö±½Ó¹ÒÔÚURLºóÃæ¡£Ê¾Àý£ºresponse.sendRedirect("checkLogin.jsp?username="+username+"&userpwd="+userpwd"");
String name=request.getParameter("name");
<a href="welcome.jsp?name=<%=name%>">
£¨5£©ÀûÓÃcookie¶ÔÏóÀ´´«µÝ
Cookie cookie=new Cookie("my","liuliu")
cookie.setMaxage(60*60);(ÒÔÃëΪµ¥Î»)×î´óµÄÉúÃüÖÜÆÚ
response.addCookie(cookie);
Cookie[] cookies=request.getCookies();(¿ÉÒÔͨ¹ý±éÀú´ËÊý×éÀ´·ÃÎÊÖµ)
Ïà¹ØÎĵµ£º
Ò») °²×°JDK(jdk-1_5_0-windows-i586.exe)£¬Ä¬Èϰ²×°£»
(¶þ) °²×°Tomcat(tomcat5.5-installer.exe)£¬Ä¬Èϰ²×°£»
* ˳Ðò²»¿ÉÒԵߵ¹ *
(Èý) ²âÊÔ°²×°½á¹û
1. ´ò¿ªä¯ÀÀÆ÷ÊäÈëhttp://localhost:8080£¬Èç¹û³É¹¦£¬Ôò»á¿´µ½»¶ÓÒ³Ãæ¡£´Ëʱ·ÃÎʵÄ·¾¶Îª$tomcat/webapps/root/
(ËÄ) ½¨Á¢ÎÒµÄÕ¾µ ......
1.No getter method for property name problem(struts)
ÓÐÒ»ÖÖ¿ÉÄÜÊÇBeanûÓÐдÏàÓ¦µÄget·½·¨£¬ÀýÈç±äÁ¿userNameµÄget·½·¨ÊÇgetUserName£»
»¹ÓоÍÊÇÕâ¸öBeanΪ¿Õ£»
2.
MyEclipseµÄ×Ô¶¯Ìí¼ÓstrutsºÍhibernate¹¦Äܲ»ÄÜ·µ»Ø£¬Çë×¢Ò⣡
ËùÒÔÎÒÏÈʹÓÃMyEclipseµ¼ÈëstrutsºÍhibernate£¬È»ºó½«ËüÃǵÄjarµ¼Èëµ½ÁíÍâÒ»¸öн¨µÄ ......
ÔÚ·ÃÎÊJSPÎļþ»òÕßServletµÄʱºò£¬Èç¹ûÌáʾÏÂÔØ²¢±£´æ£¬ÈçÏÂͼËùʾ£º
ͬÑùµÄ³ÌÐòÓеÄä¯ÀÀÆ÷³ö´í£¬ÓеÄä¯ÀÀÆ÷²»³ö´í¡£´íÎóµÄÔÒòÊÇÉèÖÃMIMEÀàÐ͵ĴúÂëÓÐÎó¡£
Èç¹ûÊÇJSPÎļþ£¬²é¿´ÎļþÍ·£º
<%@ page contentType="text/html;charset=gb2312"%>
Èç¹ûÊÇServletÎļþ£¬²é¿´£º
response.setContentType("text/html;char ......
ÎÒÏÈ˵Ã÷Ò»ÏÂÅäÖû·¾³µÄ´ó¸ÅÇé¿ö£º
* FreeBSD 7.0-RELEASE
* apache-2.2.9
* mod_jk-ap2-1.2.26
* diablo-jdk-1.6.0.07.02
* tomcat-6.0.16
¾ßÌåµÄ°æ±¾ÐÅÏ¢ÏÔʾÈçÏ£º
freebsd# pkg_info
apache-2.2.9_5 Version 2.2.x of Apache web server&nbs ......