jspÉÏ´«×é¼þʹÓúͽéÉÜ
jspʹÓÃ×é¼þ½øÐÐÎļþÉÏ´«
WEBÎļþÉÏ´«¿ÉÄÜÊÇÍøÕ¾½¨ÉèÖÐ×î³£ÓõŦÄÜÖ®Ò»£¬ÎÒÔÚÏîÄ¿¿ª·¢Öм¸ºõ¶¼ÐèҪʵÏÖÎļþÉÏ´«¹¦ÄÜ£®Ç°¶Îʱ¼ä×Ô¼ºËѼ¯ÁËһЩÉÏ´«×é¼þ£®ÕâƪÎÄÕÂÖн«½éÉÜÕâЩ×é¼þµÄʹÓ÷½·¨£¬²¢ÇұȽϸ÷×ÔµÄÓÅÁÓ£®
Ò»£¬smartupload×é¼þ£®
ÎÒÏëÖ»Òª×ö¸öÎļþÉÏ´«µÄÅóÓѶ¼ÖªµÀÕâ¸ö×é¼þ£¬ÎÒÈÏʶµÄÈËÖÐʹÓÃ×î¶àµÄÒ²ÊÇËü£¡ÎÒ¸Õµ½¹«Ë¾µÄʱºò£¬¹«Ë¾Ò²Ê¹ÓõÄsmartupload,Õâ¸ö×é¼þÉÏ´«Ïà¶Ô½ÏСµÄÎļþʱÊǸö²»´íµÄÑ¡Ôñ£®ÏÂÃæ¸ø³ö¸öʹÓõÄÀý×Ó£º
¡¡¡¡
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.jspsmart.upload.*" %>
<%
//ʵÀý»¯ÉÏÔØbean
SmartUpload mySmartUpload=new SmartUpload();
//³õʼ»¯
mySmartUpload.initialize(pageContext);
//ÉèÖÃÉÏÔصÄ×î´óÖµ,×¢Òâ:Èç¹ûÕâÀïÉèÖùý´ó»á³öÏÖÎÊÌâ!
mySmartUpload.setMaxFileSize(500 * 1024*1024);
//ÉÏÔØÎļþ
mySmartUpload.upload();
//Ñ»·È¡µÃËùÓÐÉÏÔصÄÎļþ
for (int i=0;i<mySmartUpload.getFiles().getCount();i++){
//È¡µÃÉÏÔصÄÎļþ
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i);
if (!myFile.isMissing())
{
//È¡µÃÉÏÔصÄÎļþµÄÎļþÃû
String myFileName=myFile.getFileName();
//È¡µÃ²»´øºó׺µÄÎļþÃû
String suffix=myFileName.substring(0,myFileName.lastIndexOf('.'));
//È¡µÃºó׺Ãû
String ext= mySmartUpload.getFiles().getFile(0).getFileExt();
//È¡µÃÎļþµÄ´óС
int fileSize=myFile.getSize();
//±£´æ·¾¶
String aa=getServletContext().getRealPath("/")+"jsp\\";
String trace=aa+myFileName;
//È¡µÃ±ðµÄ²ÎÊý
String explain=(String)mySmartUpload.getRequest().getParameter("text");
&nb
Ïà¹ØÎĵµ£º
jspÒ³ÃæʹÓÃstruts2µÄproperty±êÇ©Êä³öÈçÏÂÄÚÈÝ
<s:property value="detailinfo"/> ÆäÖУ¬detailinfo="<strong>abc</strong>"£»
ºÃÏñûÊ£¬ÎÊÌâ³öÏÖÁË£¬ÔÚjspÒ³ÃæÉÏÏÔʾ³öÁË<strong>abc</strong>
Ò»¿´Ò³ÃæÔ´Â룬·¢ÏÖ£¬Ô´´úÂëÖÐÒѾ±ä³ÉÁË
< strong&a ......
ÔÚJspºÍjspÖеÄjavabeanÀïÃ棬"/"Ö¸µÄÊÇtomcatËùÔڵĸù·¾¶£¬Èç¹ûÊÇÔÚWindowsϾÍÊÇtomcatËùÔÚÅ̵ÄÅÌ·û£»¶ø“.”Ö¸µÄÊÇtomcatµÄbinĿ¼ËùÔڵķ¾¶¡£
ÎÒ²ÂÏëÕâÊÇÒòΪjsp´úÂ붼»á±»tomcatתΪServlet£¬¶øServletÊÇÔÚtomcatÖзÃÎʵģ¬ËùÒÔjvmÔÚÔËÐÐServletʱ¾ÍÈÏΪĿ¼ÊÇtomcatËùÔÚµÄĿ¼¡£
HtmlÖеē/&r ......
<%@ page contentType="text/html; charset=gbk" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w ......
ÔÚ¿ª·¢ÖÐÑéÖ¤ÂëÊDZȽϳ£Óõ½ÓÐЧ·ÀÖ¹ÕâÖÖÎÊÌâ¶Ôijһ¸öÌض¨×¢²áÓû§ÓÃÌض¨³ÌÐòÆƽⷽʽ½øÐв»¶ÏµÄµÇ½³¢ÊԵķ½Ê½¡£
´ËÑÝʾ³ÌÐò°üÀ¨Èý¸öÎļþ£º
1.login.jsp:µÇ¼ҳÃæ
2.code.jsp:Éú³ÉÑéÖ¤ÂëͼƬҳÃæ
3.check.jsp:ÑéÖ¤½á¹û
code.jsp
³ÌÐò´úÂë ==================================================
<%@ page co ......
Äãʱ³£±»¿Í»§±§Ô¹JSPÒ³ÃæÏìÓ¦ËٶȺÜÂýÂð£¿ÄãÏë¹ýµ±¿Í»§·ÃÎÊ´ÎÊý¾çÔöʱ£¬ÄãµÄWEBÓ¦ÓÃÄܳÐÊÜÈÕÒæÔö¼ÓµÄ·ÃÎÊÁ¿Âð£¿
±¾ÎĽ²ÊöÁ˵÷ÕûJSPºÍservletµÄһЩ·Ç³£ÊµÓõķ½·¨£¬Ëü¿ÉʹÄãµÄservletºÍJSPÒ³ÃæÏìÓ¦¸ü¿ì£¬À©Õ¹ÐÔ¸üÇ¿¡£¶øÇÒÔÚÓû§ÊýÔö¼ÓµÄÇé¿öÏ£¬ÏµÍ³¸ºÔØ»á³ÊÏÖ³öƽ»¬Éϳ¤µÄÇ÷ÊÆ¡£ÔÚ±¾ÎÄÖ ......