struts2ÖÐactionÈçºÎ»ñÈ¡jspÒ³Ãæ²ÎÊý
1. ActionContext
ÔÚStruts2¿ª·¢ÖÐ,³ýÁ˽«ÇëÇó²ÎÊý×Ô¶¯ÉèÖõ½ActionµÄ×Ö¶ÎÖÐ,ÎÒÃÇÍùÍùÒ²ÐèÒªÔÚActionÀïÖ±½Ó»ñÈ¡ÇëÇó(Request)»ò»á»°
(Session)µÄһЩÐÅÏ¢,ÉõÖÁÐèÒªÖ±½Ó¶ÔJavaServlet
HttpµÄÇëÇó(HttpServletRequest),ÏìÓ¦(HttpServletResponse)²Ù×÷.
ÎÒÃÇÐèÒªÔÚActionÖÐÈ¡µÃrequestÇëÇó²ÎÊý"username"µÄÖµ:
ActionContext context = ActionContext.getContext();
Map params = context.getParameters();
String username = (String) params.get("username");
ActionContext(com.opensymphony.xwork.ActionContext)ÊÇActionÖ´ÐÐʱµÄÉÏÏÂÎÄ,ÉÏÏÂÎÄ¿ÉÒÔ¿´
×÷ÊÇÒ»¸öÈÝÆ÷(ÆäʵÎÒÃÇÕâÀïµÄÈÝÆ÷¾ÍÊÇÒ»¸öMap¶øÒÑ),Ëü´æ·ÅµÄÊÇActionÔÚÖ´ÐÐʱÐèÒªÓõ½µÄ¶ÔÏó. Ò»°ãÇé¿ö,
ÎÒÃǵÄActionContext¶¼ÊÇͨ¹ý: ActionContext context = (ActionContext)
actionContext.get();À´»ñÈ¡µÄ.ÎÒÃÇÔÙÀ´¿´¿´ÕâÀïµÄactionContext¶ÔÏóµÄ´´½¨:
static ThreadLocal actionContext = new ActionContextThreadLocal();
ActionContextThreadLocalÊÇʵÏÖThreadLocalµÄÒ»¸öÄÚ²¿Àà.ThreadLocal¿ÉÒÔÃüÃûΪ"Ïֲ߳̾¿±ä
Á¿",ËüΪÿһ¸öʹÓøñäÁ¿µÄÏ̶߳¼Ìṩһ¸ö±äÁ¿ÖµµÄ¸±±¾,ʹÿһ¸öÏ̶߳¼¿ÉÒÔ¶ÀÁ¢µØ¸Ä±ä×Ô¼ºµÄ¸±±¾,¶ø²»»áºÍÆäËüÏ̵߳ĸ±±¾³åÍ».ÕâÑù,ÎÒÃÇ
ActionContextÀïµÄÊôÐÔÖ»»áÔÚ¶ÔÓ¦µÄµ±Ç°ÇëÇóÏß³ÌÖпɼû,´Ó¶ø±£Ö¤ËüÊÇḬ̈߳²È«µÄ.
ͨ¹ýActionContextÈ¡µÃHttpSession: Map session = ActionContext.getContext().getSession();
2. ServletActionContext
ServletActionContext(com.opensymphony.webwork.
ServletActionContext),Õâ¸öÀàÖ±½Ó¼Ì³ÐÁËÎÒÃÇÉÏÃæ½éÉܵÄActionContext,ËüÌṩÁËÖ±½ÓÓëServletÏà¹Ø¶ÔÏó·ÃÎʵÄ
¹¦ÄÜ,Ëü¿ÉÒÔÈ¡µÃµÄ¶ÔÏóÓÐ:
(1)javax.servlet.http.HttpServletRequest : HTTPservletÇëÇó¶ÔÏó
(2)javax.servlet.http.HttpServletResponse : HTTPservletÏàÓ¦¶ÔÏó
(3)javax.servlet.ServletContext : ServletÉÏÏÂÎÄÐÅÏ¢
(4)javax.servlet.ServletConfig : ServletÅäÖöÔÏó
(5)javax.servlet.jsp.PageContext : HttpÒ³ÃæÉÏÏÂÎÄ
ÈçºÎ´ÓServletActionContextÀïÈ¡µÃServletµÄÏà¹Ø¶ÔÏó:
<1>È¡µÃHttpServletRequest¶ÔÏó: HttpServletRequest request = ServletActionContext. getRequest();
<2>È¡µÃHttpSession¶ÔÏó: HttpSession session = ServletActionContext. getRequest().getSession();
3. Serv
Ïà¹ØÎĵµ£º
1.FCKeditor ½éÉÜ
FCKeditor Õâ¸ö¿ªÔ´µÄHTML Îı¾±à¼Æ÷¿ÉÒÔÈÃweb ³ÌÐòÓµÓÐÈçMS Word ÕâÑùÇ¿´óµÄ±à¼¹¦ÄÜ£¬.FCKeditor Ö§³Öµ±Ç°Á÷ÐеÄä¯ÀÀÆ÷¡£
2£®×¼±¸¹¤×÷£º
»·¾³£ºwinddows XP¡¢tomcat6.0¡¢JDK1.6
ÏÂÔØ£º
1)£ºFCKeditor_2.6.4.zip
µØÖ·£ºhttp://nchc.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.6.4.zip ......
1 ±ê¼Ç´¦Àí³ÌÐòÀà
´¦ÀíÀà¼Ì³ÐTagSupportÀಢÖØÔØdoStartTag()·½·¨,
Ôڸ÷½·¨ÖÐʹÓÃout.print();Êä³öÐèÒªµÄÊý¾Ýµ½Ê¹Óñ¾±êÇ©µÄjspÒ³Ãæ
package cn.xxx;
public class DateTag extends TagSupport {
private static final long serialVersionUID = 1L;
public int doStartTag() thr ......
Ò»¡¢
ÔÚÒ»¸öÉè¼ÆÁ¼ºÃµÄWebÓ¦ÓÃÖУ¬¶¼»á×ÛºÏʹÓÃServletºÍJSP¼¼Êõ¡£Servlet¿ØÖÆÒµÎñÁ÷ת£¬JSPÔò¸ºÔðÒµÎñ´¦Àí½á¹ûµÄÏÔʾ¡£´Ëʱ£¬½«´óÁ¿Óõ½Öض¨Ïò¼¼Êõ¡£
¡¡¡¡Öض¨Ïò¼¼Êõ¿ÉÒÔ·ÖΪÁ½À࣬һÀàÊÇ¿Í»§¶ËÖض¨Ïò£¬Ò ......
Excel±¨±íµÄ·½·¨£¬Ò»¸ö¹ý춼òµ¥£¬Ò»¸öÖ»ÄÜÓÃì¶windowƽ̨(ÒòΪʹÓÃjdbc-odbc bridge)£¬ÇÒÎÞ·¨Ê¹Óõ½ExcelÄÚ²¿µÄ¸÷ÖÖ¹«Ê½»òÊÇ·½·¨£¬Òò´Ë£¬½ñÌì½éÉÜÒ»¸öapache³öµÄÔª¼þ½ÐPOI£¬Ëü¿ÉÒÔÔÚUNIX»òwindowƽ̨´¦Àíword»òExcelµµ°¸£¬¶ø²»ÐèÒªÒÀ¿¿windowµÄcom£¬²¢ÇÒ¿ÉÉ趨´¢´æ¸ñ¸ñʽ¡¢ÁÐÓ¡¸ñʽµÈµÈ£»½ñÌìÎÒÀ´½éÉÜÆäÖÐÓйØ×ÊÁ϶ÁÈ¡¡¢ÐÂÔ ......