It's not a secret anymore!
The moose likes Servlets and the fly likes Error message not displayed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error message not displayed" Watch "Error message not displayed" New topic

Error message not displayed

Ria Dev

Joined: Aug 18, 2010
Posts: 6

I have problem when i use EL for the below scenerio. Please help

<form id="newUserForm" action="registerServlet" method="post">
Email Address:<input type="text" name="email" value=""/>
<input type="submit" name="signUp" value="SIGN UP" />

.. code for checking if email already exists in db
..if yes, then
HttpSession session = request.getSession();
session.setAttribute("", e.getMessage());
request.getRequestDispatcher("JSPs/SignUp.jsp").forward(request, response);

when i submit the SignUp form , i am redirected to the same form but error message is not being displayed.

Please let me know if anything else has to added.
bhanu chowdary
Ranch Hand

Joined: Mar 09, 2010
Posts: 256
Replace ${} with ${sessionScope[""]} and see if you are able to see the error messgae
Ria Dev

Joined: Aug 18, 2010
Posts: 6
Thanks Bhanu, your solutions works.
If scope is not mentioned then, is it not that all the scopes(session,application,page,request) are searched for that particular variable? please correct me if i am wrong. As there were no other variables with the same name in any other scope, i used directly ${var}.I didnt get why it didnt work for me.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63852

Because the scoped variable name contains dots. You must use the general reference operator ([]) rather than the dot shortcut operator.

[Asking smart questions] [About Bear] [Books by Bear]
Ria Dev

Joined: Aug 18, 2010
Posts: 6
Thanks Bear.
I agree. Here's the link:
subject: Error message not displayed
It's not a secret anymore!