我定义了一个类继续 ActionSupport 在中间定义了一个showRoleName()方法,中间带了一个参数 如:
public class Roleaction extends ActionSupport { private Integer roleId;
private String roleName;
private Integer userId;
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public RoleBean showRoleName(Integer userId)
{
RoleBean bean=new RoleBean();
this.roleoperationImpl.viewRole(1);
return bean;
}
}
我在struts.xml 中配置的是:
<action name="roleOP" class="com.colavia.action.Roleaction" method="showRoleName">
</action>
我要如何在页面上 调用showRoleName()带参数的 这个方法了
public class Roleaction extends ActionSupport { private Integer roleId;
private String roleName;
private Integer userId;
public Integer getRoleId() {
return roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public RoleBean showRoleName(Integer userId)
{
RoleBean bean=new RoleBean();
this.roleoperationImpl.viewRole(1);
return bean;
}
}
我在struts.xml 中配置的是:
<action name="roleOP" class="com.colavia.action.Roleaction" method="showRoleName">
</action>
我要如何在页面上 调用showRoleName()带参数的 这个方法了
{
alert("sfsf");
document.forms[0].action="roleOP";
document.forms[0].submit();
}
随便在我是在页面这样调用的,这样调用会报
java.lang.NoSuchMethodException: com.colavia.action.Roleaction.showRoleName()
找不倒这一个方法。。