英文:
How to get DDL form's field names?
问题
我实现了MVCActionCommand来覆盖ddl表单的add方法。我想从该表单中检索字段的值。
@Override
public boolean processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException {
try {
String fieldName = ParamUtil.getString(actionRequest, "field_name");
System.out.println(fieldName); //没有返回任何内容
} catch (Exception e) {
System.out.println(e.getMessage());
}
return false;
}
也尝试了这个,但给了我一个'null'值
ServiceContext serviceContext = ServiceContextFactory.getInstance(DDLRecord.class.getName(), actionRequest);
serviceContext.getAttribute('field_name');
英文:
I implemented MVCActionCommand to override ddl form's add method. I want to retreive the values of the field from that form.
@Override
public boolean processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException {
try {
String fieldName = ParamUtil.getString(actionRequest, "field_name");
System.out.println(fieldName); //returned nothing
} catch (Exception e) {
System.out.println(e.getMessage());
}
return false;
}
Tried this too but gave me a 'null' value
ServiceContext serviceContext = ServiceContextFactory.getInstance(DDLRecord.class.getName(), actionRequest);
serviceContext.getAttribute('field_name');
专注分享java语言的经验与见解,让所有开发者获益!
评论