JSP page redirection: relative url problems?

I have a problem for my JSP site.

I divided it into three sections: the main folder, which contains the "resources" and "actions" folders. I place the files that show the site in the main folder, and the validaton and actions files in the actions folder.

When logging into the site, the user must be logged in. I am checking if a user is logged in and his password is valid through a script in "actions". From this script, I am the jsp:forward

relevant script for the user login information, i.e. the login screen if invalid, or the home page if valid.

This triggers me when, on jsp:forward

the home page, it cannot access the CSS as it thought it was still in the "actions" directory, whereas I know it is in the main folder and thus can get Access the file in the "resources" folder via "./resources/".

My question is, can I use a different mechanism to set the page to the home page, or restrict the use jsp:forward

and hence deal with relative urls thinking we are in "actions"?

Thanks for any advice!

0


a source to share


1 answer


Could you redirect and not forward? This will make the URL match the location of the landing page:



response.sendRedirect('url');

      

+1


a source







All Articles