I have gone through many topics about this error, but i am not able to arrive at a solution to my problem.
I have a JSP named 'Login.jsp' placed inside a folder called 'LoginPages'. On clicking submit button, it goes to a servlet page named 'LoginController.java' and checks for correct login. If username and pwd matches it goes to the home page, else returns back to the login page itself.
When the username and pwd does not match, it correctly returns back to the login page itself. My problem is, when the username and pwd matches, it gives out this error:
The requested resource (/LoginController) is not available.
But at the first attempt when my username and pwd matches, it works correctly. Only after a wrong entry(uname and pwd not match) it gives out this error. Can anyone tell me why?
Relative paths change depending upon what page the links are located on.
Try to use absolute path 'like' below
A.A.Anbarasu
vysh srini
Greenhorn
Joined: Apr 25, 2009
Posts: 25
posted
0
I used
But no use, I am getting the same error. I also tried using 'application.getRealPath(servlets\LoginController.java)'. It returns the absolute path. But i need to give only the 'url-pattern' (which is in web.xml) in the 'action' tag(if i am not wrong). So it is also not working. Please help me...
My web.xml is as follows:
subhash kumar
Ranch Hand
Joined: Jul 14, 2010
Posts: 62
posted
0
you browser might clearly telling you which resource is not available with him
you have not posted that name like
The requested resource(LoginPages/UserHomePage.jsp) is not available
so
1. provide the requested resource
or
2. request the available resource
This message was edited 1 time. Last update was at by subhash kumar
Subhash Kumar
Attitude is everything
vysh srini
Greenhorn
Joined: Apr 25, 2009
Posts: 25
posted
0
I have already mentioned the error. the error which I am getting is:
The requested resource (/LoginController) is not available.
The resource is present in my project. no doubt about it.....
Random guessing isn't going to do any good. There's nothing wrong with that declaration.
Even here the mapping is not correct.
It's not a mapping; it's the class name.
Up there he said he class was at:
D:\Netbean Projects\Example\src\java\servlets\LoginController.java
And he mapped at
Thats why i said that, I think hes package should be:
Bear Bibeault
Author and opinionated walrus
Marshal
Thats why i said that, I think hes package should be:
I use Netbeans IDE. When I open my project through window explorer, the structure of my project will consists of folders like
build, dist, src, web etc.... Inside my 'web' folder, I will be having my jsp pages. Inside my 'src' folder, i will having all my java codings inside the folder 'src\java'. Since i wanted to give the full path, i gave the full path by right cliking my file and looking into its properties .So the 'java' is not the package name, it is the folder name. So my servlet class
is correct(as it should not include the folder 'java')
Roshan Ramesh
Greenhorn
Joined: Jul 12, 2010
Posts: 8
posted
0
I believe that a proper mapping of Java resource in the web.xml should resolve your issue.
Few days before there was another discussion thread on somewhat a similar issue. Just have a look at this:
This problem still seems to be there . Can anyone help me
vysh srini
Greenhorn
Joined: Apr 25, 2009
Posts: 25
posted
0
Atlast the error is resolved!!! The error was with the usage of RequestDispatcher.forward() method. When we use this method, the contents of the page only gets changed but the url still shows the forwarding page, i.e., if i am in page1.jsp and forwarding to page2.jsp, the contents will show page2.jsp but the url will still show page1.jsp only.
So in my case, the url was still showing the 'LoginController' page, from there when i again try to go to 'LoginController' itself, it shows me an error.
vysh srini wrote:The error was with the usage of RequestDispatcher.forward() method. When we use this method, the contents of the page only gets changed but the url still shows the forwarding page, i.e., if i am in page1.jsp and forwarding to page2.jsp, the contents will show page2.jsp but the url will still show page1.jsp only.
That's where absolute path comes in picture. If we use absolute path, url will work regardless of current path. This is what I have suggested in my previous post.
Anyhow you got it working
subject: 'The requested resource is not available' error