• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pageContext attributes!

 
ashok khetan
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
given below is a tag-handler class..An attribute "msg" is set in the doStartTag() method of this class.I tried to retrieve the value of this attribute in the JSP page using <%=pageContext.getAttribute("msg")%>, it shows the value well...My question is that, is it guaranteed that after returning from the tag-handler class, the pageContext object will keep the attribute set?
thanks.
ashok.
_______________
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.io.*;
public class MyPage extends TagSupport {
public int doStartTag() throws JspException {
pageContext.setAttribute("msg","Go!! Get it");
return SKIP_BODY;
}
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
}
 
Tim Duncan
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't see why not. The attribute will be in page scope for as long as the PageContext exists, unless it is removed or replaced.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic