Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

jspÒ³Ãæ»ñÈ¡Action±äÁ¿Öµ(²»Í¨¹ý±êÇ©)


¹Ø¼ü×Ö: struts2 webwork
½ñÌìÓöµ½Ò»¸öÇé¿ö,ÒªÔÚjspÒ³ÃæÉÏ´¦Àí²éѯ³öÀ´listÒ³µÄһЩÊý¾Ý,¸Ä±äActionÀàÌ«Âé·³,ÓÚÊÇÏëµ½´ÓÒ³ÃæÉÏÖ±½Ó»ñÈ¡ActionÖеıäÁ¿Öµ,²¢½øÐвÙ×÷,ÏÖÔÚ°Ñ»ñÈ¡·½·¨¼Ç¼һÏÂ,ÒÔ±ãÒÔºó²éѯ.
Èç¹ûÔÚActionÀàÀïÓÐÒ»¸ö¼òµ¥µÄ±äÁ¿,²¢ÇÒÒѾ­Ð´ºÃÁËËüµÄgetºÍset·½·¨
private String test="jsp value test";  
private String test="jsp value test";
ÄÇôÎÒÃǾͿÉÒÔÔÚÒ³ÃæÉÏÖ±½Ó»ñÈ¡,¶ø²»Í¨¹ýstruts2»òÕßwebworkµÄ±êÇ©.
Ê×Ò³jspÒ³ÃæÒªÒýÈëJAR°ü  
webwork°ü com.opensymphony.webwork.ServletActionContext
struts2°üΪorg.apache.struts2.ServletActionContext
È»ºóÔÚÒ³ÃæÉ϶¨ÒåÒ»¸öServletActionContext±äÁ¿
<%
HttpServletRequest request1 = ServletActionContext.getRequest();
String test=request1.getAttribute("test");
%>
È»ºóÊä³ö¾Í¿ÉÒÔ¿´µ½½á¹û
<%=test%>


Ïà¹ØÎĵµ£º

jspÎļþµÄÉÏ´«ºÍÏÂÔزÙ×÷´úÂë

jspÎļþÉÏ´«ºÍÏÂÔØ
package net.jspcn.tool;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* Title: ÎļþÉÏ´«Àà
* Description: ¼ÈÄܶÔÎļþ½øÐÐÉÏ´«,ÓÖÄÜÈ¡µÃÊäÈë¿òµÄÖµ,×î¶à¿ÉͬʱÉÏ´«255¸öÎļþ
* Copyright: Copyright (c) 2002
* Company: Tekson
* ......

²»¼ä¶ÏÑ­»·¹ö¶¯Í¼Æ¬£¬jspÍøÒ³´úÂë

<html>
 <head>
  <title>marquee</title>
  <style>
   #marq {
    width:500px;
    height:100px;
    border:1px solid red;
    overflow:hidden;
   }
   #mar ......

JSP/Servletת·¢ÓëÖض¨ÏòµÄÇø±ð

JSP/Servletת·¢ÓëÖض¨ÏòµÄÇø±ð
¾¡¹ÜHttpServletResponse.sendRedirect ·½·¨ºÍRequestDispatcher.forward ·½·¨¶¼¿ÉÒÔÈÃä¯ÀÀÆ÷»ñµÃÁíÍâÒ»¸öURLËùÖ¸ÏòµÄ×ÊÔ´£¬µ«Á½ÕßµÄÄÚ²¿ÔËÐлúÖÆÓÐןܴóµÄÇø±ð¡£
 
¡¡¡¡ÏÂÃæÊÇHttpServletResponse.sendRedirect ·½·¨ÊµÏÖµÄÇëÇóÖض¨ÏòÓëRequestDispatcher.forward ·½·¨ÊµÏÖµÄÇëÇó ......

Ö´ÐÐJSPºóÉú³ÉHTML¾²Ì¬Îļþ

import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.Servl ......

jsp½ûÖ¹Ò³Ã滺´æ

1.½ûÖ¹¿Í»§¶Ë»º´æÒªÔÚ<head>ÖмÓÈëÀàËÆÈçÏÂÄÚÈÝ£º
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.ÔÚ·þÎñÆ÷µÄ¶¯Ì¬ÍøÒ³ÖнûÖ¹»º´æ£¬Òª¼ÓÈëÀàË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ