Wher to keep files to make it accessible in apache tomcat?


Please briefly explain why you feel this question should be reported .

Report Cancel

I have a file named index.jsp that contains a form, form action is a .java file named getAttr.java . Inside getAttr.java servlet I am writing code that will download a .jar file located in same directory as WEB-INF.

getJar.java code:

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ServletContext context=getServletContext();
    InputStream inputStream=context.getResourceAsStream("eee.jar");
    int read=0;
    byte bytes[]=new byte[1024];
    OutputStream outputStream=response.getOutputStream();
    RequestDispatcher dispatcher=request.getRequestDispatcher("getJar.jsp");
    dispatcher.forward(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    doGet(request, response);

getJar.jsp code:

<!-- necessary html code here  !>
// contains no code. 
//I don't know what to write here
<!-- necessary html code here  !>

I am coding J2EE in eclipse neon. My directory structure

Now my problem is:
User clicks a button in index.jsp which sends him to getAttr.java servlet.
getAttr servlet shows this error:

enter image description here

perhaps eee.jar is not accessible. Where to keep this .jar file?
Ask me if more information is needed.

0 Answer 4 views 0