Here is a question:-
Given the following tag handler defined with <bodycontent>JSP</bodycontent>
public class body extends TagSupport {
public int doStartTag() throws JspException{
return EVAL_BODY_INCLUDE;
}
public int doAfterBody() throws JspException {
try { pageContext.getOut().print("how are you?"); }catch(IOException e) {}
return SKIP_BODY;
}
}
what will be printed out by the following part of a jsp page?
<prefix:sufix>
<i>Hello</i>
</prefix:sufix>
1) The tag handler won't compile.
2) The jsp page will print Hello how are you?
3) The jsp page will print how are you? Hello
4) The jsp page will print Hello
the ans is 4.The jsp page will print Hello
1.Why is "how are u" not getting printed??
2.If i extend BodyTagSupport then when i have to print something from inside doAfterBody() , do i have to use getBodyContent.getEnclosingWriter() ???
I am a lot confused in custom tags.If there is a good link for it, please let me know.
thanks,mallika
Given the following tag handler defined with <bodycontent>JSP</bodycontent>
public class body extends TagSupport {
public int doStartTag() throws JspException{
return EVAL_BODY_INCLUDE;
}
public int doAfterBody() throws JspException {
try { pageContext.getOut().print("how are you?"); }catch(IOException e) {}
return SKIP_BODY;
}
}
what will be printed out by the following part of a jsp page?
<prefix:sufix>
<i>Hello</i>
</prefix:sufix>
1) The tag handler won't compile.
2) The jsp page will print Hello how are you?
3) The jsp page will print how are you? Hello
4) The jsp page will print Hello
the ans is 4.The jsp page will print Hello
1.Why is "how are u" not getting printed??
2.If i extend BodyTagSupport then when i have to print something from inside doAfterBody() , do i have to use getBodyContent.getEnclosingWriter() ???
I am a lot confused in custom tags.If there is a good link for it, please let me know.
thanks,mallika