2

Using the reference of campaign custom controller from the reference document i created my own custom controller. Following entries were made

URL When the controller should be invoked:

http://localhost:9081/dev/sr?query=insurance

Initializer:

@RegisteredViewModel(viewName = "SearchResults", modelClass = SearchModel.class, controllerName = "Search")

})

Controller:

@Controller
@RequestMapping(ControllerUtils.INCLUDE_PATH_PREFIX + "Training/Search")
public class SearchController extends EntityController {
@Autowired

View File Name : SearchResults.jsp

SDL Config:

enter image description here

Exception Details:

[5/17/17 10:17:12:458 EDT] 00000116 SystemOut O 10:17:12.458 [WebContainer : 3] DEBUG c.s.w.c.impl.taglib.dxa.RegionTag - Including region: MainBody [5/17/17 10:17:12:460 EDT] 00000116 SystemOut O 10:17:12.459 [WebContainer : 3] TRACE c.s.w.c.i.i.StaticContentInterceptor - preHandle: /dev/sr [5/17/17 10:17:12:460 EDT] 00000116 SystemOut O 10:17:12.460 [WebContainer : 3] TRACE c.s.w.c.controller.RegionController - handleGetRegion: regionName=MainBody [5/17/17 10:17:12:460 EDT] 00000116 SystemOut O 10:17:12.460 [WebContainer : 3] TRACE c.s.w.c.controller.RegionController - Region MvcData: MvcDataImpl(controllerAreaName=Core, controllerName=Region, actionName=Region, areaName=Training, viewName=MainBody, regionAreaName=null, regionName=null, routeValues={}, metadata={}) [5/17/17 10:17:12:465 EDT] 00000116 SystemOut O 10:17:12.465 [WebContainer : 3] TRACE c.s.w.c.i.i.StaticContentInterceptor - preHandle: /dev/sr [5/17/17 10:17:12:471 EDT] 00000116 SystemOut O 10:17:12.470 [WebContainer : 3] ERROR c.s.w.c.controller.PageController - Exception while processing request for: /system/mvc/Training/SearchController/Entity/187963 com.sdl.webapp.common.controller.exception.BadRequestException: Request to unknown action: /system/mvc/Training/SearchController/Entity/187963 at com.sdl.webapp.common.controller.PageController.handleGetUnknownAction(PageController.java:258) ~[dxa-common-api-1.5.0.jar:1.5.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88) ~[na:1.7.0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55) ~[na:1.7.0] at java.lang.reflect.Method.invoke(Method.java:618) ~[na:2.6 (01-06-2014)] at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) ~[spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) ~[spring-web-3.1.4.RELEASE.jar:3.1.4.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:100) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:604) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:565) ~[spring-webmvc-3.1.4.RELEASE.jar:3.1.4.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) ~[spring-web

3
  • According to the error message, the Controller's URL is expected to contain /Training/SearchController instead of /Training/Search. Frankly, this is not what I would expect, but can you try changing the URL in the @RequestMapping ? May 18, 2017 at 6:00
  • Thanks @Rick. I was able to fix this by replacing all the alias for controller (Search--> SearchController) in the component template and controller '@RequestMapping' . This is weird as the reference document allows the alias names May 18, 2017 at 13:47
  • Yeah, as said, it should work without the Controller suffix. See, for example, github.com/sdl/dxa-modules/blob/release/1.5/webapp-java/… May 18, 2017 at 17:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.