0

有没有办法在 websphere commerce CmdImpl 类中获取 url 参数。我正在尝试这样

    SmartDataBeanImpl bean = new SmartDataBeanImpl();
    HttpServletRequest request = bean.getHttpRequest();
    String currencyId = request.getParameter("currencyId");

但我在第 3 行得到了 NullPointer 异常

4

2 回答 2

2

假设您正在使用控制器命令,那么您应该像这样访问 URL 参数:

public void setRequestProperties(TypedProperty pRequestProperties)  {
    String currencyId = pRequestProperties.getString("currencyId", ""); 
}
于 2014-03-12T15:03:15.873 回答
1
requestProperties.getString("URL", null)

您会在 validateParameters() 方法中的大多数 OOB 控制器命令中看到这一点。

于 2016-11-18T11:16:29.023 回答