action类不使用liferay中的struts2将对象传递给jsp类
我在liferay中使用struts2来创建一个portlet,我有一个提交按钮来执行操作,在操作方法中我想填充一个私有字段并将其传递给resualt add.jsp但是当我想要添加打印该字段时.jsp的值为null。 问题是什么???!!! 我该怎么办????!!
在运行服务器,构建/部署和执行期间没有错误或exception……
这是我的代码:
portlet.xml中
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd“version =”2.0“>
IIN Subject MySiteStruts MySiteStruts org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher viewNamespace /support defaultViewAction index 0 text/html MySiteStruts MySiteStruts MySiteStruts administrator guest power-user user
在struts.xml
STORE RETRIEVE /html/support/view.jsp /html/support/add.jsp
PowerAction.java
package com.test.actions; import com.opensymphony.xwork2.ActionSupport; public class PowerAction extends ActionSupport { private String testString; @Override public String execute() throws Exception { return "success"; } public String navigateToAddSubject(){ testString = "test object value!!!!!"; System.out.println(testString); return SUCCESS; } public String getTestString() { return testString; } public void setTestString(String testString) { this.testString = testString; } }
view.jsp的
</s: [/code] [b]add.jsp[/b] [code] print str:
我甚至在add.jsp中使用value =“testString”但是也没有用。