随笔分类 -  struts2

摘要:${tpNewMarriage.womanName } ${tpNewMarriage... 阅读全文
posted @ 2014-05-14 11:07 刘振明 阅读(1200) 评论(0) 推荐(0)
摘要:transaction.tjpopState 该对象在后台是枚举类型,在前台需要转为字符串才能比较。错误一:正确一: 阅读全文
posted @ 2014-02-25 17:07 刘振明 阅读(682) 评论(0) 推荐(0)
摘要:需要的包:struts2-jfreechart-plugin-2.2.1.1.jarjfreechart-1.0.13.jarjcommon-1.0.17.jar前台jsp页面中可以使用iframe显示图表,代码在struts.xml中配置,注意继承jfreechart-default,result的类型为chart 650 1300 action中要有chart全局变量,提供get、set方法private JFreeChart char... 阅读全文
posted @ 2013-11-26 16:36 刘振明 阅读(2135) 评论(0) 推荐(0)
摘要:环境搭建必须的lib包(这里没有写版本号,注意版本):commons-logging.jarfileupload.jarfreemarker.jarognl.jarstruts2-core.jarxwork-core.jarcommons-in.jarjavassist.jarweb.xml配置 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* 在src下创建struts.xml文件(只是配置了根元素,能够启动项... 阅读全文
posted @ 2013-08-19 14:22 刘振明 阅读(179) 评论(0) 推荐(0)
摘要:struts.i18n.encoding 指定web应用的默认编码集 阅读全文
posted @ 2013-08-08 23:30 刘振明 阅读(114) 评论(0) 推荐(0)
摘要:今天碰到了这个问题,原因不明白。在webContent下建立了index.jsp后重启项目不报错了。 原因未知。 阅读全文
posted @ 2013-08-03 19:09 刘振明 阅读(993) 评论(0) 推荐(0)
摘要:<s:property value="#parameters.id"/> 阅读全文
posted @ 2012-03-14 22:02 刘振明 阅读(238) 评论(0) 推荐(0)
摘要:<s:date name="project.contractStartDate" format="yyyy-MM-dd"/> 阅读全文
posted @ 2012-03-12 20:46 刘振明 阅读(268) 评论(0) 推荐(0)
摘要:在Struts2中,客户端和服务器之间的数据传输全部要用到get、set方法当在业务逻辑中需要用到页面传过来的值的时候,只要保证Action中属性的set方法和页面中的name属性值<s:textfield name=""/>相同即可。(去掉set,方法名大写变小写) 当在显示页面中需要用到业务逻辑中的返回值时,只要保证页面标签的value值<s:property value=""/> 和Action中属性的get方法形同即可。(用法同上) 阅读全文
posted @ 2012-03-10 17:39 刘振明 阅读(794) 评论(0) 推荐(0)
摘要:struts2的bean类名首字母和第二个字母都不能大写 否则在set 、get时会爆空指针错误(NullPointerException)原因:如后台类中有属性String sAdress这个属性。使用eclipse自动生成getsAdress()和setsAdress(String sAdress).注意:生成的方法中属性的首字母没有大写。页面中会用name="sAdress"传递参数。struts2拦截器会调用后台类中的setSAdress(String sAdress)方法。而后台中没有此方法。所以会报错。 阅读全文
posted @ 2012-03-10 17:15 刘振明 阅读(1634) 评论(0) 推荐(0)
摘要:有woman对象。前台将姓名,性别传到后台。在后台woman对象中有地址属性。会根据类型不同,赋予不同的初始值。 阅读全文
posted @ 2012-03-06 09:17 刘振明 阅读(2276) 评论(0) 推荐(0)
摘要:Struts2的property标签可以把“<”、“>”、“&”等等自动转成类似&xxxx;的HTML转意表示,在显示一段带HTML格式的文本时这功能很讨厌,可以设property标签的escape="false",即可关闭自动转码操作。 阅读全文
posted @ 2012-02-24 09:36 刘振明 阅读(1573) 评论(0) 推荐(0)
摘要:原来是在配置文件中返回的是json类型。前台是用window.location.href提交的。 阅读全文
posted @ 2012-02-23 16:23 刘振明 阅读(204) 评论(0) 推荐(0)
摘要:数据库中为date类型,在jsp页面这样使用<div><label>开始日期:</label><input id="startDate" name="project.contractStartDate" onclick="WdatePicker();" value="<s:date name="project.contractStartDate" format="yyyy-MM-dd"/>" onblur="ch 阅读全文
posted @ 2012-02-01 16:43 刘振明 阅读(219) 评论(0) 推荐(0)
摘要:Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file:/F:/Workspaces/MyEclipse%208.x/.metadata/.me_tcat/webapps/test04/WEB-INF/lib/struts2-core-2.1.8.jar!/struts-default.xml:29:72 - bean - jar:file:/F:/Workspaces/MyEclipse%208.x/.metadat 阅读全文
posted @ 2012-02-01 16:35 刘振明 阅读(14387) 评论(0) 推荐(0)