After the Portlet is deployed, an exception is reported-cocould not initialize class com. liferay. util. Portlet. portletprops.
Briefly describe the Portlet. properties. During the development of the Portlet, you can customize the configuration file-Portlet. properties similar to portal. properties.
The procedure is as follows:
1. Create the Portlet. properties in classpath, such as the WEB-INF/src directory
line.chart.types=line,spline,column,bar,timeline,spiderweb,area
2. Create portletpropskeys. Java
public class PortletPropsKeys {public static final String LINE_CHART_TYPES = "line.chart.types";}
3. Create portletpropsvalues. Java
import com.liferay.util.portlet.PortletProps;public class PortletPropsValues {public static final String[] LINE_CHART_TYPES = PortletProps.getArray(PortletPropsKeys.LINE_CHART_TYPES);}
You can call the method in portletprops as needed.
After three steps, you can directly call
String[] types = PortletPropsValues.LINE_CHART_TYPES;
Obtain the value of line. Chart. types.
If this exception occurs during compilation and running
Could not initialize class com.liferay.util.portlet.PortletProps
1. First check whether there is a util-java.jar In the Lib of the Portlet.
2. Determine the classpath of the Portlet. properties in the Portlet.