struts2使用超链接传递参数给action类!JSP超链接部分: <li>
<s2:url id="url" action="p_getProductsByBrandName"> <s2:param name="temp">参数</s2:param> </s2:url> <s2:a href="%{url}">华硕</s2:a>
</li> // get products by brand's name
public String getProductsByBrandName() {
HttpServletRequest request=(HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
String name=request.getParameter("temp");
// name=null ????
return SUCCESS;
}
}
主要异常:/-- Encapsulated exception ------------\
java.lang.NoSuchMethodException: vo.Test.setTemp([Ljava.lang.String;)他将此参数封装了 自然取不到
----------------------------------------------------------
使用HTML超链接标签也有同样的问题
<s2:url id="url" action="p_getProductsByBrandName"> <s2:param name="temp">参数</s2:param> </s2:url> <s2:a href="%{url}">华硕</s2:a>
</li> // get products by brand's name
public String getProductsByBrandName() {
HttpServletRequest request=(HttpServletRequest)ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
String name=request.getParameter("temp");
// name=null ????
return SUCCESS;
}
}
主要异常:/-- Encapsulated exception ------------\
java.lang.NoSuchMethodException: vo.Test.setTemp([Ljava.lang.String;)他将此参数封装了 自然取不到
----------------------------------------------------------
使用HTML超链接标签也有同样的问题
不能获取出来的值