• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error message not displayed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear.
 
I am not a spy. Definitely. Definitely not a spy. Not me. No way. But this tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic