Hi I can't seem to get the path to forward to another page within my servlet.
I have one page which makes a call to servlet then that servlet redirects to a different page.
The page I want to be redirected to lives under /content/magazine
I tried this but doesn't work:
RequestDispatcher requestDispatcher = request.getRequestDispatcher("/content/Magazine.html");
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi
"sendRedirect("page2.jsp");" should work for you.
Link:- http://stackoverflow.com/questions/16414999/redirect-to-another-jsp-page-after-submitting-a-form
Also for your approach, try forwarding as well like:-
RequestDispatcher dispatcher = request.getRequestDispatcher("demo.jsp");
dispatcher.forward(request, response);
I hope this helps.
~kautuk
Views
Replies
Total Likes
Sorry guys this still didn't work.
My second page(The one I want the servlet to forward to) lives on AEM.
It's path is http://localhost:4502/content/Magazine.html
I also tried putting the jsp under the "content" part of my bundle
under src/main/content/jcr_root and still didn't work
My servlet redirect code is this:
RequestDispatcher requestDispatcher = request.getRequestDispatcher("Magazine.jsp");
requestDispatcher.forward(request, response)
Think I might be doing this wrong, sorry first time doing a multi-page site on AEM.
This is the error the servlet spits out:
0 TIMER_START{Request Processing} 0 COMMENT timer_end format is {<elapsed msec>,<timer name>} <optional message> 0 LOG Method=GET, PathInfo=/bin/pubnetSEARCH 0 TIMER_START{ResourceResolution} 0 TIMER_END{0,ResourceResolution} URI=/bin/pubnetSEARCH resolves to Resource=ServletResource, servlet=com.rogers.aem.servlets.PubnetSearch, path=/bin/pubnetSEARCH 0 LOG Resource Path Info: SlingRequestPathInfo: path='/bin/pubnetSEARCH', selectorString='null', extension='null', suffix='null' 0 TIMER_START{ServletResolution} 0 TIMER_START{resolveServlet(ServletResource, servlet=com.rogers.aem.servlets.PubnetSearch, path=/bin/pubnetSEARCH)} 0 TIMER_END{0,resolveServlet(ServletResource, servlet=com.rogers.aem.servlets.PubnetSearch, path=/bin/pubnetSEARCH)} Using servlet com.rogers.aem.servlets.PubnetSearch 0 TIMER_END{0,ServletResolution} URI=/bin/pubnetSEARCH handled by Servlet=com.rogers.aem.servlets.PubnetSearch 0 LOG Applying Requestfilters 0 LOG Calling filter: com.adobe.granite.requests.logging.impl.RequestLoggerImpl 0 LOG Calling filter: com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet 0 LOG Calling filter: org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter 0 LOG Calling filter: com.adobe.granite.httpcache.impl.InnerCacheFilter 0 LOG Calling filter: com.day.cq.wcm.designimporter.CanvasPageDeleteRequestFilter 0 LOG Calling filter: com.adobe.cq.history.impl.HistoryRequestFilter 1 LOG Calling filter: com.day.cq.wcm.core.impl.WCMRequestFilter 1 LOG Calling filter: com.adobe.granite.optout.impl.OptOutFilter 1 LOG Calling filter: com.day.cq.theme.impl.ThemeResolverFilter 1 LOG Calling filter: com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet 1 LOG Calling filter: org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter 1 LOG Calling filter: com.day.cq.analytics.provisioning.impl.UserAuthenticationRequestFilter 1 LOG Calling filter: com.adobe.cq.social.commons.cors.CORSAuthenticationFilter 1 LOG Calling filter: com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter 1 LOG RedirectFilter did not redirect (not redirecting in author mode) 1 LOG Calling filter: com.day.cq.wcm.core.impl.warp.TimeWarpFilter 1 LOG Calling filter: com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl 1 LOG Calling filter: org.apache.sling.rewriter.impl.RewriterFilter 1 LOG Calling filter: org.apache.sling.i18n.impl.I18NFilter 1 LOG Calling filter: org.apache.sling.security.impl.ContentDispositionFilter 1 LOG Calling filter: com.adobe.granite.csrf.impl.CSRFFilter 1 LOG Calling filter: com.adobe.cq.dam.s7imaging.impl.auth.MemoryTokenAuthHandler 1 LOG Calling filter: com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl 1 LOG Calling filter: com.day.cq.dam.core.impl.servlet.ActivityRecordHandler 1 LOG Applying Componentfilters 1 LOG Calling filter: com.day.cq.wcm.core.impl.WCMComponentFilter 1 LOG Calling filter: com.day.cq.wcm.core.impl.WCMDebugFilter 1 LOG Calling filter: com.day.cq.personalization.impl.TargetComponentFilter 1 TIMER_START{com.rogers.aem.servlets.PubnetSearch#0} 1 TIMER_START{resolveIncludedResource(/bin/Magazine.jsp)} 1 TIMER_END{0,resolveIncludedResource(/bin/Magazine.jsp)} path=/bin/Magazine.jsp resolves to Resource=NonExistingResource, path=/bin/Magazine.jsp 1 LOG Including resource NonExistingResource, path=/bin/Magazine.jsp (SlingRequestPathInfo: path='/bin/Magazine.jsp', selectorString='null', extension='jsp', suffix='null') 1 TIMER_START{resolveServlet(NonExistingResource, path=/bin/Magazine.jsp)} 2 LOG {0}: no servlet found 2 TIMER_END{1,resolveServlet(NonExistingResource, path=/bin/Magazine.jsp)} Using servlet org.apache.sling.servlets.get.DefaultGetServlet
Views
Replies
Total Likes
Look at this community thread:
Code is: response.sendRedirect(redirect);
Views
Replies
Total Likes
Sorry guys I think you're misunderstanding here.
I know how to redirect, just can't get the PATH to my JSP page correct
The jsp page I want to redirect to lives in http://localhost:4502/content/magazine.html
What would be the path to this...currently my getting this exception from my servlet
LOG Including resource NonExistingResource, path=/bin/Magazine.jsp (SlingRequestPathInfo: path='/bin/Magazine.jsp', selectorString='null', extension='jsp', suffix='null')
My servlet path is /bin/MyServlet
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies