如何获取DDL表单的字段名称?

huangapple 未分类评论43阅读模式
英文:

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');

huangapple
  • 本文由 发表于 2020年4月9日 23:23:57
  • 转载请务必保留本文链接:https://java.coder-hub.com/61124585.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定