📄 usebeanjsp_0002ejsp_jsp.java
字号:
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class UseBeanJsp_0002ejsp_jsp extends HttpJspBase {
// begin [file="/UseBeanJsp.jsp";from=(7,0);to=(7,74)]
// end
static {
}
public UseBeanJsp_0002ejsp_jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
String _value = null;
try {
if (_jspx_inited == false) {
synchronized (this) {
if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
}
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=GBK");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="/UseBeanJsp.jsp";from=(0,48);to=(7,0)]
out.write("\r\n<html>\r\n<head>\r\n<title>\r\nUseBeanJsp\r\n</title>\r\n</head>\r\n");
// end
// begin [file="/UseBeanJsp.jsp";from=(7,0);to=(7,74)]
mypackage.StudentBean student = null;
boolean _jspx_specialstudent = false;
synchronized (request) {
student= (mypackage.StudentBean)
pageContext.getAttribute("student",PageContext.REQUEST_SCOPE);
if ( student == null ) {
_jspx_specialstudent = true;
try {
student = (mypackage.StudentBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "mypackage.StudentBean");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"mypackage.StudentBean", exc);
}
pageContext.setAttribute("student", student, PageContext.REQUEST_SCOPE);
}
}
if(_jspx_specialstudent == true) {
// end
// begin [file="/UseBeanJsp.jsp";from=(7,0);to=(7,74)]
}
// end
// HTML // begin [file="/UseBeanJsp.jsp";from=(7,74);to=(8,0)]
out.write("\r\n");
// end
// begin [file="/UseBeanJsp.jsp";from=(8,0);to=(8,47)]
JspRuntimeLibrary.introspect(pageContext.findAttribute("student"), request);
// end
// HTML // begin [file="/UseBeanJsp.jsp";from=(8,47);to=(18,15)]
out.write("\r\n<body bgcolor=\"#ffffff\">\r\n<h1>\r\nUse JavaBeans in JSP\r\n</h1>\r\n<form method=\"post\">\r\n<input type=\"submit\" name=\"Submit\" value=\"Submit\">\r\n<input type=\"reset\" value=\"Reset\">\r\n<hr>student<br>\r\n<br>Enter Your Name:<input type=\"text\" name=\"name\">\r\n<br>Your Name: ");
// end
// begin [file="/UseBeanJsp.jsp";from=(18,15);to=(18,65)]
out.print(JspRuntimeLibrary.toString((((mypackage.StudentBean)pageContext.findAttribute("student")).getName())));
// end
// HTML // begin [file="/UseBeanJsp.jsp";from=(18,65);to=(27,0)]
out.write("<br>\r\n<hr>\r\nSelect Your Favorite:\r\n<br><input type=\"checkbox\" name=\"favorite\" value=\"Basketball\">Basketball\r\n<br><input type=\"checkbox\" name=\"favorite\" value=\"Football\">Football\r\n<br><input type=\"checkbox\" name=\"favorite\" value=\"Music\">Music\r\n<br><input type=\"checkbox\" name=\"favorite\" value=\"Reading\">Reading\r\n<br><input type=\"checkbox\" name=\"favorite\" value=\"PC Game\">PC Game\r\n<br>Your favorite:\r\n");
// end
// begin [file="/UseBeanJsp.jsp";from=(27,2);to=(34,0)]
String[] favorite = student.getFavorite();
if (favorite != null) {
for (int i =0; i < favorite.length; i ++) {
out.println(favorite[i]);
}
}
// end
// HTML // begin [file="/UseBeanJsp.jsp";from=(34,2);to=(38,7)]
out.write("\r\n<hr><br>\r\n</form>\r\n</body>\r\n</html>");
// end
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -