LifeRay Portal 六学习笔记6-1:使用Struts2开发Portlet
LifeRay Portal 6学习笔记6-1:使用Struts2开发Portletjava文件?Java代码?import?com.opensymphony.xwork2.
LifeRay Portal 6学习笔记6-1:使用Struts2开发Portlet
java文件
?
Java代码?
- import?com.opensymphony.xwork2.ActionSupport;??
- ??
- public?class?StrutsDemo?extends?ActionSupport?{??
- ??
- ????private?static?final?long?serialVersionUID?=?1L;??
- ??????
- ????private?String?message;??
- ??????
- ????public?String?getMessage(){??
- ????????return?message;??
- ????}??
- ????public?void?setMessage(String?message){??
- ????????this.message=message;?????????
- ????}??
- ????public?String?view()?throws?Exception?{??
- ????????message?=?"hello?Struts2?View?Portlet!";??
- ????????return?SUCCESS;??
- ????}??
- ????public?String?portletView(){??
- ????????return?"view";??
- ????}??
- ????public?String?edit()?throws?Exception?{??
- ????????message?=?"hello?Struts2?Edit?Portlet!";??
- ????????return?SUCCESS;??
- ????}??
- ????public?String?portletEdit(){??
- ????????return?"edit";??
- ????}??
- }??
?
strutsDemoView/view.jsp
?
?
Html代码?
- <%@?page?contentType="text/html;charset=utf-8"%>??
- <%@?taglib?prefix="s"?uri="/struts-tags"%>??
- <h2><s:property?value="message"/></h2>??
- <s:form?action="portletView!portletView.action"?method="post"?namespace="view">??
- ????<s:textfield?label="名字"?key="message"></s:textfield>??
- ????<s:submit?value="提交"></s:submit>??
- </s:form>??
?
其他的JSP不写了,和普通的Strtus2开发一样?