Hello everyone, I am preparing for exam and would ask you some help in clarifying a few issues. But, before anything, some code is inbound first - it's a really simple login example I've constructed.
Let's assume correct username and pass combination is entered; questions are at the bottom.
LoginPage.jsp (entrypoint - view)
UserDAO.java ("service" class)
UserBean.java (model, a classic POJO/bean used as a DTO)
userLogged.jsp (exitpoint - view) --never mind the div elements, they're there to center the view, but I won't spam you needlessly with CSS, it's irrelevant anyhow--
Webpage output is as follows (c/p directly from FireFox):
Test 0 ->
Test 1 ->
Test 2 ->
Test 3 ->
Test 4 ->
Test 5 ->
Test 6 -> USER_X
Test 7 -> localhost:8080
Test 8 -> localhost:8080
Test 9 -> GET
1) My first question is regarding the scope - which scope is actually applicable?? If you checkout userLogged.jsp, lines 13 and 22, you'll see my dilemma - if I use any other scope than "application" in L13, line 14 returns null value. On the other hand, should I use applicationScope on L22, it returns null (as it damn well should, since I am setting a SESSION attribute, not a context attribute!).
So, the question is - why should I use application scope on L13 anyway?? I'd expect nothing other than session scope, as can be seen from my controller.
2) The other question is regarding EL - why can't I fetch request parameters in Tests 0-5? Other stuff works fine (as can be seen from output), but I can't understand how to make these request parameters printed out as I inteded (via request EL implicit objects).