PRJ301_-_SP_2024_-_RE_1764.webp
M

PRJ301_-_SP_2024_-_RE_1764.webp

Given the following JSP and tag handler code, what is the result of accessing the JSP?
JSP Page Source
<html>
<body>
<%@taglib uri="test_taglib" prefix="myTag"%><% session.setAttribute("first", "first"); %>
<my Tag:TestTag/>
<br>
<%=session.getAttribute("second")%>
</body></html>
Tag Handler Code for <my Tag:TestTag />
package examples;import java.io.*;
import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;
public class TestTag extends TagSupport
} private PageContext pageContext;
public void setPageContext(PageContext page){
}
this.pageContext=page;
public int doStartTag() throws JspException
{
try{String first-pageContext.getSession().getAttribute("first").toString();
pageContext.getOut().write(first);
pageContext.setAttribute("second", "second", PageContext.PAGE_SCOPE);}
catch(IOException i)
{
throw new JspException(i.getMessage());
} return SKIP_BODY;
}
public int doEndTag() throws JspException{


Exit (33
return EVAL_PAGE;
}

Thông tin

Category
PRJ301
Thêm bởi
Mỹ Duyên2
Ngày thêm
Lượt xem
2,303
Lượt bình luận
4
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRJ301_-_SP_2024_-_RE_1764.webp
File size
91.4 KB
Dimensions
1926px x 906px

Share this media

Back
Bên trên Bottom