I'm having a problem related to the
servlet I am using to check the requests made.
Every request of my application has an "acao" field, in order to tell what this servlet will do, so the first thing I check when getting the request is its value.
The first page is the login. The servlet can easily get the "acao", and checks for additional parameters like "user" and "password". After validation, it redirects using
res.sendRedirect(res.encodeURL("http://localhost:8080/aiwua/" + targetURL));
Now, this targetURL page is shown and it has a hidden form with another "acao" parameter.
The servlet now should get this "acao" and do other things since the value is different than before.
But here's the odd part. I have this structure in the servlet:
if (acao != null) {
if (acao.equals("login") {
// do stuff for validating user
}
else if (acao.equals("link") {
// do other stuff
}
else
// redirect to error page1
}
else
// redirect to error page2
Now, the second request, in which "acao" is "link", doesn't work.
There IS an "acao" parameter, since it doesn't show the error page2, but error page1.
When I get the request parameters names, I get none.
But how come, since he KNOWS the "acao" parameter exists?
And I guess the above has to do with the fact that I can't set any attribute to the request session, though I use the getSession() method with no parameter and it doesn't show any other errors.
Thanks for your attention.