在Hybris插件中找不到自定义组件的JSP /控制器 [英] JSP / Controller not found for custom component in Hybris addon

查看:61
本文介绍了在Hybris插件中找不到自定义组件的JSP /控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Hybris 6.6,并正在构建一个新的插件,基本上是一个控制器和相应的JSP。但是,在运行时,Hybris找不到控制器bean并在店面文件夹中搜索JSP(因为JSP在店面插件文件夹中,所以它不在那儿)。

I’m running Hybris 6.6 and are building a new addon, that is basically a controller and corresponding JSP. During runtime however, Hybris isn’t finding the controller bean and searches for JSP in the storefront folder (it’s not there, since the JSP is in the storefront addon folder).

我使用extgen创建了插件,然后使用ant将其安装在店面中。

I created the addon using extgen, and then installed it in the storefront using also ant.

步骤:


  • 在-items.xml中创建的组件继承自SimpleCMSComponent

  • 从AbstractCMSController继承的创建的控制器,

  • 在addon文件夹中创建的JSP,

  • 已创建的组件并添加到页面通过Imped插入插槽,

  • @Controller的名称等于component + Controller

  • Created component in -items.xml inheriting from SimpleCMSComponent
  • Created controller inheriting from AbstractCMSController,
  • Created JSP in addon folder,
  • Created component and added to page slot via Imped,
  • @Controller has the name equal to component + "Controller"

我已经调试了代码,当Hybris尝试通过getBeanFactory()。contains(controller)查找是否存在控制器时,它返回false。如果我查看bean工厂返回的bean列表,则控制器的bean不存在。

I’ve debuged the code, and when Hybris tries to find if there is a controller via getBeanFactory().contains(controller) it returns false. If I look at the bean list that the bean factory returns, the bean for the controller is not there.

有什么线索吗?我什至尝试在-web-spring.xml上显式创建控制器bean,但未做任何更改。

Any clues on what’s happening? I’ve even tried to create the controller bean explicitly on the -web-spring.xml but doesn’t change anything.

谢谢

推荐答案

请确保


  • 您的控制器应扩展 GenericCMSAddOnComponentController AbstractCMSAddOnComponentController

  • 使用

  • Your controller should extends GenericCMSAddOnComponentController or AbstractCMSAddOnComponentController for the compoent inside addon.
  • Annotate the Controller with

@Controller(YourComponentController)$注释控制器b $ b @RequestMapping(value = / view / YourComponentController)

将jsp添加到 * addon / web / webroot / * / view / * / cms / yourcomponentname.jsp
将此路径引用AbstractCMSAddOnComponentController的getView方法

Add your jsp to *addon/web/webroot/*/view/*/cms/yourcomponentname.jsp. Refer getView method of AbstractCMSAddOnComponentController for the path

*-web-spring.xml 应该在资源文件夹/路径中

*-web-spring.xml should be in resource folder/path

应该在 *-web-spring.xml

<上下文:component-scan base-package = my.path.controllers />

*-web-spring.xml 应该在AdditionalWebSpringConfigs属性中配置。引用您的插件project.properties

*-web-spring.xml should be configured in additionalWebSpringConfigs properties. Refer your addon project.properties


myCustomstorefront.additionalWebSpringConfigs.MyAddonName = classpath:/ XXX / web / spring / *-web -spring.xml

这篇关于在Hybris插件中找不到自定义组件的JSP /控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆