Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: How to get DDL form's field names?
I implemented MVCActionCommand to override ddl form's add method. I want to retreive the values of the field in 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;
}
Please correct me if I'm doing it wrong.Any suggestions? Thanks.
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;
}
Please correct me if I'm doing it wrong.Any suggestions? Thanks.
Hi ,
You can try getting value of field from serviceContext.getAttribute('field_name'); to get ServiceContext you can use below
You can try getting value of field from serviceContext.getAttribute('field_name'); to get ServiceContext you can use below
ServiceContext serviceContext = ServiceContextFactory.getInstance(DDLRecord.class.getName(), actionRequest);
Thanks for the suggestion,Mohammed.
I tried this. But it's giving me null.
I tried this. But it's giving me null.
Can you try setting a breakpoint in your custom override service and then inspecting the parameter map to see what is in there?