aspose file tools*
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
Author

Error message not displayed

Ria Dev
Greenhorn

Joined: Aug 18, 2010
Posts: 6
Hi,

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

-------------------------------------------------------------------------------------------------------------
SignUp.jsp:
<form id="newUserForm" action="registerServlet" method="post">
Email Address:<input type="text" name="email" value=""/>
${error.email.msg}
<input type="submit" name="signUp" value="SIGN UP" />
</form>
--------------------------------------------------------------------------------------------------------------------
registerServlet:

.. code for checking if email already exists in db
..if yes, then
HttpSession session = request.getSession();
session.setAttribute("error.email.msg", 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 ${error.email.msg} with ${sessionScope["error.email.msg"]} and see if you are able to see the error messgae
Ria Dev
Greenhorn

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
Marshal

Joined: Jan 10, 2002
Posts: 61008
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ria Dev
Greenhorn

Joined: Aug 18, 2010
Posts: 6
Thanks Bear.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error message not displayed