2

I need to Implement Slide menu in my application but I have my jsp in WEB-INF/pages Directory. Of course I cannot Access these pages from href. How should I go about this?

My slide menu example:

<li class="SlideMenu1_Folder"><div><a href="#">SCHOOL FEES</a></div><span><!-- empty --></span>
                        <ul style="display:none">
                            <li><a href="/WEB-INF/pages/coursefeessetup.jsp">Set Course Fees</a></li>
                            <li><a href="/WEB-INF/pages/configurebankaccount.jsp">Configure Bank Account</a></li>
                            <li><a href="/WEB-INF/pages/payschoolfees.jsp">Pay Fees</a></li>
                            <li><a href="/WEB-INF/pages/studentfeesinquiry.jsp">Fee Inquiry</a></li>
                            <li><a href="/WEB-INF/pages/studentFeeStatement.jsp">Fee Statement</a></li>
                        </ul>
                    </li>

This is returning that the page is not found. What is the best way to implement this type of menu while retaining the JSPs inside the WEB-INF directory?

informatik01
  • 16,038
  • 10
  • 74
  • 104
Stanley Mungai
  • 4,044
  • 30
  • 100
  • 168

2 Answers2

0

Files in WEB-INF are not publicly visible. This is for security. See https://stackoverflow.com/a/6825956/1389219

You must either pull them out of the WEB-INF folder, or (recommended) use an MVC framework such as Spring MVC and map URLs like /course-fees-setup to /WEB-INF/pages/coursefeessetup.jsp.

Community
  • 1
  • 1
vegemite4me
  • 6,621
  • 5
  • 53
  • 79
0

The correct answer here was to invoke a servlet like this:

<li><a href="myservlet">Set Course Fees</a></li>

and then inside my servlet:

String path = request.getServletPath();
if(path.equal("/myservlet")){
request.getRequestDispatcher("WEB-INF/jsp/myjsppage.jsp").forward(request,response);
}
Stanley Mungai
  • 4,044
  • 30
  • 100
  • 168