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ÎļþÉÏ´«ºÍÏÂÔØ
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
* ......
<html>
<head>
<title>marquee</title>
<style>
#marq {
width:500px;
height:100px;
border:1px solid red;
overflow:hidden;
}
#mar ......
JSP/Servletת·¢ÓëÖض¨ÏòµÄÇø±ð
¾¡¹ÜHttpServletResponse.sendRedirect ·½·¨ºÍRequestDispatcher.forward ·½·¨¶¼¿ÉÒÔÈÃä¯ÀÀÆ÷»ñµÃÁíÍâÒ»¸öURLËùÖ¸ÏòµÄ×ÊÔ´£¬µ«Á½ÕßµÄÄÚ²¿ÔËÐлúÖÆÓÐןܴóµÄÇø±ð¡£
¡¡¡¡ÏÂÃæÊÇHttpServletResponse.sendRedirect ·½·¨ÊµÏÖµÄÇëÇóÖض¨ÏòÓëRequestDispatcher.forward ·½·¨ÊµÏÖµÄÇëÇó ......
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 ......
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.ÔÚ·þÎñÆ÷µÄ¶¯Ì¬ÍøÒ³ÖнûÖ¹»º´æ£¬Òª¼ÓÈëÀàË ......