为了账号安全,请及时绑定邮箱和手机立即绑定

Addon 中的 Hybris 组件不调用控制器

Addon 中的 Hybris 组件不调用控制器

哆啦的时光机 2021-09-29 16:35:19
我创建了我的自定义表单组件。我在智能编辑中添加它后,它不会调用控制器来填充表单。我在 *-items.xml 中创建了 itemtype MyComponentModel,在 HAC 部署中检查,它就在那里。我还添加了这个答案中的注释@Controller("MyComponentController")@RequestMapping(value = ControllerConstants.Actions.Cms.MyComponent)public class MyComponentController extends AbstractAcceleratorCMSComponentController<MyComponentModel> {映射值在我的 ControllerConstants 中,如下所示:String _Prefix = "/view/"; // NOSONARString _Suffix = "Controller"; // NOSONARString MyComponent = _Prefix + MyComponentModel._TYPECODE + _Suffix; // NOSONAR当我在页面上的 smartedit 中添加它时,会加载 .jsp 文件(我可以看到一些文本),但是由于没有调用控制器根据 Hybris doc,我的控制器中被调用的方法应该是这样的:@Overrideprotected void fillModel(HttpServletRequest request, Model model, MyComponentModel component) {但它没有被调用,所以我无法填写表格。<div class="span-20 last">    I can see this text    <div class="row item_container_holder">        <c:if test="${not empty MyForm}">          <%--this condition is false, form is empty--%>请注意,我还在impex中添加了组件,我在HAC中更新了系统,我尝试同步目录。INSERT_UPDATE MyComponent; $contentCV[unique = true]; uid[unique = true]       ; name                               ; &componentRef;; MyComponent ; MyComponent ; MyComponent编辑:*-items.xml <itemtype code="MyComponent" autocreate="true" generate="true" extends="SimpleCMSComponent"              jaloclass="mypackage.b2c.core.jalo.components.MyComponent">        <deployment table="MyComponents" typecode="15900"/>        <attributes>            <attribute qualifier="title" type="localized:java.lang.String">                <persistence type="property" />                <modifiers />                <description>Localized title of the component.</description>            </attribute>        </attributes>    </itemtype>
查看完整描述

2 回答

?
人到中年有点甜

TA贡献1895条经验 获得超7个赞

为 cms 组件调用的控制器取决于项目类型。您不能创建 JspIncludeComponent 并期望调用 MyComponent 的组件控制器。

试试这个:

INSERT_UPDATE MyComponent;...


查看完整回答
反对 回复 2021-09-29
?
函数式编程

TA贡献1807条经验 获得超9个赞

正如您所说,您正在尝试在插件中创建此组件

确保您按照我在此处提到的步骤进行操作

您的评论:我把它放在 path 上/WEB-INF/views/responsive/cms,但我仍然收到错误错误处理组件标签。currentComponent [MyComponentModel (8796093136412@1)] 异常:File  [/WEB-INF/views/responsive/cms/myComponent.jsp] not found

调试AbstractCMSAddOnComponentController 的getView方法来检查路径。

您必须将您的 jsp 添加到/youraddon/acceleratoraddon/web/webroot/WEB-INF/views/responsive/cms/myComponent.jsp,稍后将在构建过程中将其复制到您的 stroefront 扩展。


查看完整回答
反对 回复 2021-09-29
  • 2 回答
  • 0 关注
  • 163 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信