Hi,
How to I dispatch a request to a page component (JSP)? I get the following error javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {}country. I don't want the country value to be persisted.
The code I used to dispatch from the servlet is:
RequestDispatcher dispatcher = request.getRequestDispatcher("/content/mycompany/cars/audi/a4.html");
dispatcher.forward(request, response);
Thanks you.
Cheers,
Viren.
Solved! Go to Solution.
Views
Replies
Total Likes
What I did was use the SlingHttpServletRequestWrapper class to convert the form method to GET from POST and then dispatch it. The below code worked for me.
org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper req = new org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper(request) { public String getMethod() { return "GET"; } }; String path = "/content/mycompany/shippingDetails.html"; javax.servlet.RequestDispatcher dispatcher = request.getRequestDispatcher(path); dispatcher.include(req, response);
Views
Replies
Total Likes
What I did was use the SlingHttpServletRequestWrapper class to convert the form method to GET from POST and then dispatch it. The below code worked for me.
org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper req = new org.apache.sling.api.wrappers.SlingHttpServletRequestWrapper(request) { public String getMethod() { return "GET"; } }; String path = "/content/mycompany/shippingDetails.html"; javax.servlet.RequestDispatcher dispatcher = request.getRequestDispatcher(path); dispatcher.include(req, response);
Views
Replies
Total Likes
It seems you are posting to a page resource url directly. If you are not persisting why are you using post request.
Views
Replies
Total Likes
According to this illustration located here http://dev.day.com/docs/en/cq/current/deploying/dispatcher.html:
[img]dd.png[/img]
Dispatcher goes through a flowchart to determine if the page is cached or not. Have you ensured that the Dispatcher is properly configured. Please read this AEM Topic:
http://dev.day.com/docs/en/cq/current/deploying/dispatcher/disp_config.html
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies