MNM
MNM

Reputation: 2743

How to link to a webpage that is in the same folder and level

I am having trouble with accessing a html page that is in the same folder directory and level. Every thing I tried results in a error on the page. I have tried a few ways to navigate to the page, but all fail except for main 5 it just opens the login page again so that does not work either. I am a bit lost on how this works. I have attached a picture of now my structure is set up below. I am trying to get from home.html to main.html I am running Spring framework.

enter image description here

And this is the code that I am using to as the link.

 {{>partials/header}}
 <h2>Login Page</h2>
 <h4>Links</h4>

 <ul class="nav nav-pills nav-stacked">
 <li role="presentation">
    <a href="main">Main 1 </a>
    <a href="/main">Main 2</a>
    <a href="~/main">Main 3</a>
    <a href="../main">Main 4</a>
     <a href=".main">Main 5</a>
 </li>
 </ul>

 {{>partials/footer}}

Here is my controller

 //New login page
@RequestMapping(value = HOME_URL_MAPPING)
public String inventory(final Model model) {
    return controllerHelper.createUrl(INVENTORY, WebGlobals.HOME);
}

//new page Was the home page before
@RequestMapping(value ="/main")
public String inventgus(final Model model) {
    UserDetails activeUser = (UserDetails)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    model.addAttribute(CAN_MAKE_REQUEST, canMakeRequest(activeUser));
    model.addAttribute(CAN_APPROVE_REQUEST, canApproveRequest(activeUser));

    return controllerHelper.createUrl(INVENTORY, "main");
}

Upvotes: 0

Views: 78

Answers (2)

Flompy Doo
Flompy Doo

Reputation: 21

this works for me:

<a href="main.html">Main</a>

Upvotes: 1

BenWurth
BenWurth

Reputation: 800

You were so close! Here's the answer:

<a href="./main.html">Main</a>

The single dot refers to the current folder and putting a slash means that the file is under that folder.

Upvotes: 1

Related Questions