jsp – A link to go back one level in the folder hierarchy and go down one level in another folder

Question:

Hi.

The problem is the following: inside the WebContent folder I have the hotel folder and inside this hotel folder I have the cadastro_hotel.jsp file.

At the WebContent root, I have the menu folder and inside this folder, I have the menu_initial.jsp file. I created a link, inside the menu_inicial.jsp to point to hotel/cadastro_hotel.jsp, but I can't. I've used ../ and nothing.

<a href="../hotel/cadastro_hotel.jsp">Cadastrar hotel</a>  

That is, I am one level down in relation to the root, I want to go back to the root and thus, go down the level to the other folder. I can go back to the root using ../, but I can't go down the level.

Answer:

I solved it as follows:

<a href="../menu/menu_inicial.jsp"></a>

and for the hotel folder and the cadastro_hotel.jsp file, I did:

<a href="../hotel/cadastro_hotel.jsp"></a>

The '../' goes back to the root folder, which in this case is the webContent and then just put the path: /folder/file or if it's on the same level, put the filename: /file.jsp.

Scroll to Top