-1

请解释以下代码的作用:

boolean showButton = ParamUtil.getBoolean(request, "showButton", true);
PortletSession psession = renderRequest.getPortletSession();
4

1 回答 1

3

代码从传递的请求对象ParamUtil.getBoolean(request, "showButton", true);中检索参数值。showButton

它只是调用的同义词,request.getParameter("showButton")但另外它还将String参数的值转换为booleanie 如果字符串值为"true", "t", "y", "on""1"它们将被转换为 boolean true

于 2013-01-09T09:41:15.503 回答