• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP doesn't show attribute set in Tag Handler.

 
Bahadar Khan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Please see this classic tag code:


package FirstTag;

import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.*;

public class MyTagClass extends TagSupport{

public int doStartTag() throws JspException{



pageContext.setAttribute("name","MyName");

return EVAL_BODY_INCLUDE;

}


public int doEndTag() throws JspException{


try{
pageContext.getOut().println("Hello This is greeting message from doEndTag\n");
return EVAL_PAGE;
}
catch(IOException e){ throw new JspException ( e.toString());}


}





}


I am calling it from this JSP:
----------------------------------------------------------------
<%@ taglib prefix="mine" uri="http://www.khan.bahadar/MyBodyTag" %>



Gonna call tag this: <BR>

<mine:NameOfMyTag>${name}</mine:NameOfMyTag> <BR>

This is after I called page

---------------------------------------------------

As I know it should print the value of ${name} ( MyName ) , but it is just printing it as :

Gonna call tag this:
${name} Hello This is greeting message from doEndTag
This is after I called page

I put this in the <body-content>JSP</body-content> element of .tld file

Can some body please guide me over here?
 
Bahadar Khan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never mind. I figured out. The problem was with isELIgnored="true"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic