wood burning stoves 2.0*
The moose likes JSP and the fly likes not able to redirect to html file from a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "not able to redirect to html file from a jsp" Watch "not able to redirect to html file from a jsp" New topic
Author

not able to redirect to html file from a jsp

Praveen Sharma
Ranch Hand

Joined: Jul 31, 2008
Posts: 129
I am stuck in a stupid problem.
I want to redirect my window to a new page and that fileis placed inside WEB-INF folder.

This is my code for the file "index.jsp":



This is the directory stucture :




But some how this is not working.
Could you please help me out of this problem.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

Files under WEB-INF cannot be directly addressed.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Praveen Sharma
Ranch Hand

Joined: Jul 31, 2008
Posts: 129
Hi Bear,

That is correct, files under WEB-INF cannot be directly accessed but I am trying is to make my program do that.
I understand what you say. By putting them under WEB-INF I would disallow users from typing the url and accessing the files directly.

But it should it be working if I am doing it programmatically, right ?

In case it should not I dont understand how this statement is working fine for me :
<%@ include file="/WEB-INF/jsp/treeInclude.jsp"%>

Please help me understand this.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

Praveen Sharma wrote:But it should it be working if I am doing it programmatically, right ?

No. How on Earth could the server possibly know the difference?

Files under WEB-INF cannot be served by URL, no matter how the URL is generated or the request issued.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61314
    
  66

Praveen Sharma wrote:In case it should not I dont understand how this statement is working fine for me :
<%@ include file="/WEB-INF/jsp/treeInclude.jsp"%>

That's a server-side include, and has nothing to do with client-side access.
Praveen Sharma
Ranch Hand

Joined: Jul 31, 2008
Posts: 129
Hi Bear,

I got it. Maybe I need to reconsider my project structure.

Thanks anyways for the knowledge sharing.
 
GeeCON Prague 2014
 
subject: not able to redirect to html file from a jsp