首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

LifeRay Portal 六学习笔记6-1:使用Struts2开发Portlet

2012-11-05 
LifeRay Portal 6学习笔记6-1:使用Struts2开发Portletjava文件?Java代码?import?com.opensymphony.xwork2.

LifeRay Portal 6学习笔记6-1:使用Struts2开发Portlet

java文件

?

Java代码?
  1. import?com.opensymphony.xwork2.ActionSupport;??
  2. ??
  3. public?class?StrutsDemo?extends?ActionSupport?{??
  4. ??
  5. ????private?static?final?long?serialVersionUID?=?1L;??
  6. ??????
  7. ????private?String?message;??
  8. ??????
  9. ????public?String?getMessage(){??
  10. ????????return?message;??
  11. ????}??
  12. ????public?void?setMessage(String?message){??
  13. ????????this.message=message;?????????
  14. ????}??
  15. ????public?String?view()?throws?Exception?{??
  16. ????????message?=?"hello?Struts2?View?Portlet!";??
  17. ????????return?SUCCESS;??
  18. ????}??
  19. ????public?String?portletView(){??
  20. ????????return?"view";??
  21. ????}??
  22. ????public?String?edit()?throws?Exception?{??
  23. ????????message?=?"hello?Struts2?Edit?Portlet!";??
  24. ????????return?SUCCESS;??
  25. ????}??
  26. ????public?String?portletEdit(){??
  27. ????????return?"edit";??
  28. ????}??
  29. }??

?

strutsDemoView/view.jsp

?

?

Html代码?
  1. <%@?page?contentType="text/html;charset=utf-8"%>??
  2. <%@?taglib?prefix="s"?uri="/struts-tags"%>??
  3. <h2><s:property?value="message"/></h2>??
  4. <s:form?action="portletView!portletView.action"?method="post"?namespace="view">??
  5. ????<s:textfield?label="名字"?key="message"></s:textfield>??
  6. ????<s:submit?value="提交"></s:submit>??
  7. </s:form>??
?

其他的JSP不写了,和普通的Strtus2开发一样?

热点排行