liferay - How to put an error message on the screen when the file size limit is reached? -
if try upload file exceeding on limit size.. there no error message shown on screen however, did find error message on logs saying:
03:24:20,890 error [uploadservletrequestimpl:101] org.apache.commons.fileupload.fileuploadbase$sizelimitexceededexception: request rejected because size (220546593) exceeds configured maximum (104857600) org.apache.commons.fileupload.fileuploadbase$sizelimitexceededexception: request rejected because size (220546593) exceeds configured maximum (104857600)
i want show error message on screen saying: "you've reached maximum size of 10mb."
thanks.
in action class add error key along request object below,
sessionerrors.add(actionrequest, "your-error");
in jsp add:
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> <liferay-ui:error key="your-error" message="your error message goes here!" />
also handled through exception class, sessionerrors code like,
try { // ... code throws exception } catch(someexception se) { sessionerrors.add(actionrequest, se.getclass().getname()); }
in jsp
<liferay-ui:error exception="<%= someexception.class %>" message="this error" />
reference link: http://www.liferay.com/community/wiki/-/wiki/main/user+feedback+-+success+and+error+messages+in+portlets
Comments
Post a Comment