File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error message not displayed

 
Ria Dev
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 256
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace ${error.email.msg} with ${sessionScope["error.email.msg"]} and see if you are able to see the error messgae
 
Ria Dev
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the scoped variable name contains dots. You must use the general reference operator ([]) rather than the dot shortcut operator.
 
Ria Dev
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic