on 2018 May 03 5:19 PM
In order to modify a jsp from the commerceorgaddon I had to modify the UserManagementPageController defined in the same hybris addon.
To resolve this problem, I created a new addon wich depends on commerceorgaddon. In my newaddon I copied the UserManagementPageController and made my changes there (also I put there my new jsp). Finally I define in the web-spring.xml of my addon the following:
<alias alias="userManagementPageController" name="customUserManagementPageController"/>
<bean name="customUserManagementPageController" class="de.hybris.platform.commerceorgaddon.controllers.pages.UserManagementPageController"/>
<!-- add the url to controller mapping to the existing SimpleUrlHandlerMapping bean -->
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/my-company/organization-management/manage-users/**">customUserManagementPageController</prop>
</props>
</property>
</bean>
The problem is that when I go to my storefront the UserManagementPageController being used is the the one defined in the commerceorgaddon and not the one that I customized in my new addon.
Any idea how can I do to use my new controller?
Request clarification before answering.
Hi Martin,
Please make sure you have placed the Controller in the correct folder. The controller should be placed in acceleratoraddon>web>src>[package]>controllers. The Jsp should be placed in acceleratoraddon>web>webroot>WEB-INF>views.
Once you make sure the files are in correct location. You need to run ant addonuninstall command to uninstall OTB commerceorgaddon ant addonuninstall -Daddonnames="commerceorgaddon" -DaddonStorefront.yacceleratorstorefront="<storefrontName>". Then run ant clean all once the build is successful check if the files are removed.
You then need to run ant addoninstall -Daddonnames="customcommerceorgaddon" -DaddonStorefront.yacceleratorstorefront="<storefrontName>" to install your custom addon to the storefront. Once done you need to do a clean build again using ant clean all and check if the code in the customAddon should move to [storefront]>web>addonsrc>customcommerceorgaddon. Once done you should check the customcommerceorgaddon project.properties [storefront].additionalWebSpringConfigs.customcommerceorgaddon =classpath\:/customcommerceorgaddon/web/spring/customcommerceorgaddon-web-spring.xml
Once everything is verified , just run the hybrisserver and your custom controller should now be picked up.
thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Steps to extend the ootb addon controller:
1) Implement your own controller extending the ootb addon controller. Don't mark it with @ Controller annotation.
2) Add the bean definition for the custom controller in your custom addon web-spring.xml without any alias.
3) Make sure that your addon web-spring.xml is provided in the storefront's additionalWebSpringConfigs as himanshu.mehta1 mentioned.
4) Build & start your server. Your custom controller will be picked.
<bean name="userManagementPageController" class="***.controllers.pages.CustomUserManagementPageController" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you added the below property in your project.properties or local.properties
.additionalWebSpringConfigs.myAddOn=classpath:/myAddOn/web/spring/myAddOn-web-spring.xml
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any news on how this issue can be solved?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.