有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java hybris WCMS渲染器传递属性

我正在通过插件扩展实现几个CMS组件,然后将它们添加到店面。我使用的是渲染器而不是控制器,并且我能够将项目的属性传递给jsp文件。然而,我有一个问题,可能很简单,但我被卡住了。假设我想通过渲染器将当前用户Id传递给我的JSP。这可能吗

  protected Map<String, Object> getVariablesToExpose(final PageContext pageContext, final C component)
{
    final Map<String, Object> variables = new HashMap<String, Object>();
    for (final String property : cmsComponentService.getEditorProperties(component))
    {
        try
        {
            final Object value = modelService.getAttributeValue(component, property);
            variables.put(property, value);

        }
        catch (final AttributeNotSupportedException ignore)
        {
            // ignore
        }
    }
    return variables;
}

这是获取项目类型属性及其值的代码。但我不想在我的CMS组件中有额外的名为用户id的字段


共 (1) 个答案

  1. # 1 楼答案

    试着做一些像

    if (property == "uid")
    {
        continue;
    }