·ÃÎÊJSPÎļþ»òÕßServletÎļþʱÌáʾ¡°ÏÂÔØ¡±
ÔÚ·ÃÎÊJSPÎļþ»òÕßServletµÄʱºò£¬Èç¹ûÌáʾÏÂÔز¢±£´æ£¬ÈçÏÂͼËùʾ£º
ͬÑùµÄ³ÌÐòÓеÄä¯ÀÀÆ÷³ö´í£¬ÓеÄä¯ÀÀÆ÷²»³ö´í¡£´íÎóµÄÔÒòÊÇÉèÖÃMIMEÀàÐ͵ĴúÂëÓÐÎó¡£
Èç¹ûÊÇJSPÎļþ£¬²é¿´ÎļþÍ·£º
<%@ page contentType="text/html;charset=gb2312"%>
Èç¹ûÊÇServletÎļþ£¬²é¿´£º
response.setContentType("text/html;charset=gb2312");
Ïà¹ØÎĵµ£º
²»´¦ÀíÌåÄÚÈݵıêÇ©Àí½âÒ»ÏÂͼƬ1
´¦ÀíÌåÄÚÈݱêÇ©Àí½âÌáͼƬ2
1£ºJspWriter out = pageContext.getOut();
2£ºBodyContent bc = this.getBodyContent();
3£ºString input = bc.getString();
4£ºJspWriter out = bc.getEnclosingWriter();
²»´¦ÀíÌåÄÚÈÝ
µÚÒ»ÐдúÂëΪ²»´¦Àí±êÇ©ÌåÄÚÈÝʱÄõ½ÐèÒªµÄÊä³öµ½Ò³ ......
½¨Á¢Ìõ¼þÊ×ÏÈÒ»¶¨ÒªÈ·¶¨×Ô¼ºµÄmysql£¬tomcat,eclipseÁ¬½ÓÊÇÕýÈ·µÄ¡£
index.jspºÜ¼òµ¥£¬¾ÍÒ»¸öÌøת¡£
<%
response.sendRedirect("lg.jsp");
%>
lg.jsp ʵÏֵǼ¿ò¼Ü
<%@ page contentType="text/html; charset=utf-8" %>
<html>
<head>
<title>
login
</title>
</hea ......
index.jsp
<%@ page language="java" import="java.sql.*" import="java.lang.*" import="java.util.*" pageEncoding="GB2312"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%!
& ......
×Ô¶¨Òå±êÇ©ÊÇÈÿª·¢ÈËÔ±´´½¨¿Í»§»¯µÄ±êÇ©,²¢ÇÒÔÚjspÎļþÖÐʹÓÃÕâЩ±êÇ©,ÕâÑù¿ÉÒÔʹjsp´úÂë¸ü¼ò½à!
Ê×ÏÈÕâÀïÏȽéÉÜ´Ó¶¨Òå±êÇ©µ½Ê¹ÓñêÇ©µÄ²½Öè:
1,´´½¨×Ô¶¨Òå±êÇ©´¦ÀíÀà,¼°Ïà¹ØÀà.class ²¢ÇÒ°ÑËûÃǶ¼·ÅÔÚWEB-INF/classesĿ¼ÏÂ
2,´´½¨TLD±êÇ©¿âÃèÊöÎļþ(.tld)Î ......
1.No getter method for property name problem(struts)
ÓÐÒ»ÖÖ¿ÉÄÜÊÇBeanûÓÐдÏàÓ¦µÄget·½·¨£¬ÀýÈç±äÁ¿userNameµÄget·½·¨ÊÇgetUserName£»
»¹ÓоÍÊÇÕâ¸öBeanΪ¿Õ£»
2.
MyEclipseµÄ×Ô¶¯Ìí¼ÓstrutsºÍhibernate¹¦Äܲ»ÄÜ·µ»Ø£¬Çë×¢Ò⣡
ËùÒÔÎÒÏÈʹÓÃMyEclipseµ¼ÈëstrutsºÍhibernate£¬È»ºó½«ËüÃǵÄjarµ¼Èëµ½ÁíÍâÒ»¸öн¨µÄ ......