ÎÒ¿ª·¢Ò»¸öjspϵͳʱÅöµ½µÄÎÊÌâ
1.No getter method for property name problem(struts)
ÓÐÒ»ÖÖ¿ÉÄÜÊÇBeanûÓÐдÏàÓ¦µÄget·½·¨£¬ÀýÈç±äÁ¿userNameµÄget·½·¨ÊÇgetUserName£»
»¹ÓоÍÊÇÕâ¸öBeanΪ¿Õ£»
2.
MyEclipseµÄ×Ô¶¯Ìí¼ÓstrutsºÍhibernate¹¦Äܲ»ÄÜ·µ»Ø£¬Çë×¢Ò⣡
ËùÒÔÎÒÏÈʹÓÃMyEclipseµ¼ÈëstrutsºÍhibernate£¬È»ºó½«ËüÃǵÄjarµ¼Èëµ½ÁíÍâÒ»¸öн¨µÄ¹¤³Ì£¬ÕâÊÇÎҾͲ»ÐèÒªMyeclipseÀ´¸øÎÒ¹ÜÀíÒÀÀµÁË¡£
3
.ÔÚÔö¼Ó¶Ôstruts taglibÖ§³Öʱ£¬Ç뽫¶ÔÓ¦µÄtldÎļþ×·¼Óµ½web.xmlÎļþÖÐÈ¥£º
ÀýÈ磺
<jsp-config>
<taglib>
<taglib-uri>http://struts.apache.org/tags-bean </taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld </taglib-location>
</taglib>
</jsp-config>
4.
Èç¹û³ö´í˵ij¸ötagÔÚtldÎļþÖÐûÓУ¬Ôò˵Ã÷×Ô¼ºÔÚjspÎļþÖÐʹÓõÄtagºÍʹÓõÄstruts taglib°æ±¾²»Ò»ÖÂ
ÀýÈ磺ÔÚstruts1.1ÖеÄhtml:locale£¬ÔÚstruts1.2ÖиÄΪhtml:lang
5.
struts tagÖпÉÒÔʹÓÃscriptlets£¬µ«ÊÇÔÚscriptletsÖв»ÄÜʹÓÃstruts tag¡£
Any Struts tag will work only if you place it directly in the JSP, not if you generate it through a scriptlet. To understand why it won't work to generate it in a scriptlet.
JSP life cycle:
* The JSP interpreter reads the JSP file, including any custom tags such as Struts tags and converts everything to Java source code
* It then compiles it into a class file
* It executes the code, rendering a response in plain HTML and sending it back to the browser.
* It is only at this point that the scriptlet code you inserted gets executed. It is now too late in the cycle to insert any custom tags, since they've already been interpreted by this point.
6. it is illegal according to JSP specification to nest one tag within another as an attribute.
There are two options:
1) You evaluate bean:write and then substitute it into html:text.
2) Use Struts-EL tags. They let you use expression language to get a bean value and substitute it in another tag.
Unless yo
Ïà¹ØÎĵµ£º
ÔÚ¿ª·¢ÖÐÑéÖ¤ÂëÊDZȽϳ£Óõ½ÓÐЧ·ÀÖ¹ÕâÖÖÎÊÌâ¶Ôijһ¸öÌض¨×¢²áÓû§ÓÃÌض¨³ÌÐòÆƽⷽʽ½øÐв»¶ÏµÄµÇ½³¢ÊԵķ½Ê½¡£
´ËÑÝʾ³ÌÐò°üÀ¨Èý¸öÎļþ£º
1.login.jsp:µÇ¼ҳÃæ
2.code.jsp:Éú³ÉÑéÖ¤ÂëͼƬҳÃæ
3.check.jsp:ÑéÖ¤½á¹û
code.jsp
³ÌÐò´úÂë ==================================================
<%@ page co ......
Ò») °²×°JDK(jdk-1_5_0-windows-i586.exe)£¬Ä¬ÈÏ°²×°£»
(¶þ) °²×°Tomcat(tomcat5.5-installer.exe)£¬Ä¬ÈÏ°²×°£»
* ˳Ðò²»¿ÉÒԵߵ¹ *
(Èý) ²âÊÔ°²×°½á¹û
1. ´ò¿ªä¯ÀÀÆ÷ÊäÈëhttp://localhost:8080£¬Èç¹û³É¹¦£¬Ôò»á¿´µ½»¶ÓÒ³Ãæ¡£´Ëʱ·ÃÎʵÄ·¾¶Îª$tomcat/webapps/root/
(ËÄ) ½¨Á¢ÎÒµÄÕ¾µ ......
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+"/";
%>
<%!
& ......
ÕâÖ÷ÒªÊÇtomcatµÄÎÊÌ⣬Ëü»áÔÚ´«Ë͵Äʱºò°Ñ×Ö·û¼¯ÖØбàÒ룬µÈ´«¹ýÈ¥µÄjspÒ³Ãæ½ÓÊܵÄʱºò¾Í»á³öÏÖÂÒÂ룬
²»¹ÜÔÚÒ³ÃæÀïÈçºÎÉèÖÃ×Ö·û¼¯¶¼Ã»°ì·¨½â¾ö£¬Õâʱºò±ØÐë±ØÐëÔÚtomcat°²×°Ä¿Â¼Àï½øÐÐÉèÖã¬
C:\Program Files\apache-tomcat-6.0.14\confĿ¼Ï server.xmlÏ <Connector/>±êÇ©Ï ¼ÓÒ»¾ä URIEncoding="GBK" ¾ÍºÃÁ ......