Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set attribute of PageContext  RSS feed

Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a login.jsp which controls the name and password of the user. After control, the servlet decides whether to get the user back to the login or to allow acces.
If the user is put back at the loginscreen, he/she must see a warning message.
At first I decided to give this Java Bean a scope of "request".
So, in the servlet I wrote :
_request.setAttribute("melding", melding);

This worked fine, only the message kept coming. The scope should be shortened. So I put in my jsp
<jsp:useBean id="melding" class="org.gertcuppens.general.Melding" scope="page"/>
<jsp:setProperty name="melding" property="*"/>

And in my servlet I wrote :
PageContext pageContext = jspFactory.getPageContext(this, _request, _response, null, true, 8192, true);

pageContext.setAttribute("melding", melding);

Unfortunately, I don't see any message at all.

Briefly stated : with scope="request" I can see the message but too long.
With scope="page", I don't see any message at all.

Where's my mistake ?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!