JSP Spring 의 bean 방문

1739 단어 springhtmljspWebbean
<%-- 
    Document   : common
    Created on : 2010-2-20, 0:21:33
    Author     : wuyoubf
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.List" %>
<%@page import="org.springframework.web.context.support.*"%>
<%@page import="org.springframework.context.*" %>

 
<%-- 
    Document   : spy
    Created on : 2010-2-20, 0:07:57
    Author     : wuyoubf
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="common.jsp" %>
<%@page import="cn.luna.core.service.SysManagerImpl"%>
<%@page import="cn.luna.core.model.User" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Lnua platform spy page</title>
    </head>
    <body>
        <%
            ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
            SysManagerImpl smi = (SysManagerImpl)ctx.getBean("sysManager");
            List<User> userList = (List<User>)smi.selectAllUser();
            String name = userList.get(0).getName();
        %>
        <%=name%>
    </body>
</html>

좋은 웹페이지 즐겨찾기