【发布时间】:2019-02-24 15:08:32
【问题描述】:
我创建了我的自定义表单组件。我在智能编辑中添加后,它不会调用控制器来填写表单。 我在 *-items.xml 中创建了 itemtype MyComponentModel,检查了 HAC 部署,它就在那里。 我还添加了类似 answer
的注释@Controller("MyComponentController")
@RequestMapping(value = ControllerConstants.Actions.Cms.MyComponent)
public class MyComponentController extends AbstractAcceleratorCMSComponentController<MyComponentModel> {
映射值在我的 ControllerConstants 中,如下所示:
String _Prefix = "/view/"; // NOSONAR
String _Suffix = "Controller"; // NOSONAR
String MyComponent = _Prefix + MyComponentModel._TYPECODE + _Suffix; // NOSONAR
当我在页面上的 smartedit 中添加它时,会加载 .jsp 文件(我可以看到一些文本),但由于没有调用控制器
根据 Hybris 文档,我的控制器中被调用的方法应该是这样的:
@Override
protected 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>
【问题讨论】:
-
为 MyComponentModel 添加您的 *items.xml。首先,您的 Impex 在这里似乎错了
-
你想在你的插件中创建这个组件吗?如果是,请关注this answer
-
我编辑了一个 impex。是的,这是我的插件。现在它正在调用控制器,但它找不到 .jsp 文件。我把它放在路径
/WEB-INF/views/responsive/cms,但我仍然收到错误Error processing component tag. currentComponent [MyComponentModel (8796093136412@1)] exception: File [/WEB-INF/views/responsive/cms/myComponent.jsp] not found -
检查我的答案