//动作类代码:
public class SAStandAloneTables extends ActionSupport {
public Object getValue(String pStr) {
return "xyz";
}
}
我试图从JSP文件中的Struts2 textField标记的name属性调用getValue(String)
方法(在我的Struts2 Action类中编写)。此方法接受String作为参数。我知道如何在没有Struts2标记的任何参数的情况下调用方法。但在这种情况下需要帮助。请帮我写出正确的OGNL表达式。对不起,我无法在这里发布JSP代码。
答案 0 :(得分:0)
您可以使用以下方式致电您的行动:
<s:textfield name="%{getFieldName('txtName')}" value="amit Kumar" id="firstName">
</s:textfield>
和
之类的方法public Object getFieldName(String param){
System.out.println("here1 .");
return param;
}