Problem
This is the answer to yesterday's (unanswered) question ( see here ), as I am trying to find an alternative approach.
I added basic
<error-page> <error-code>404</error-code> <location>/404search.jsf</location> </error-page>
.. to my web.xml . Now I need to get the URL that the user entered to send my search function, but I will be able to get the current URL (in this case ... 404search.jsf ) instead of the actual request entered by the user.
Attempts
HttpServletRequest.getRequestURL returns http://www.website.com/foldername/404search.jsfHttpServletRequest.getRequestURI returns /foldername/404search.jsfHttpServletRequest.getQueryString returns nothing
I want it to return /foldername/wrong-url-the-user-entered#anchor-if-there-is-any
More details ...
The idea is to enter a user url (e.g. www.site.com/product/99999-product-that-cant-be-found or www.site.com/faq/support-question-that-doesnt-exist ), REGEX to remove hyphens and run a search query using 99999 product that cant be found or support question that doesnt exist .
Any suggestions?
source share