zoukankan      html  css  js  c++  java
  • JSP中调用Spring的方法

    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
     <%@ page import="org.springframework.context.ApplicationContext"%>
    <%@ page import="org.springframework.context.support.ClassPathXmlApplicationContext"%>
    <%@ page import="com.pegasus827.bean.helloworld" %>
    <!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>Insert title here</title>
    </head>
    <body>
    <%
    ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
    helloworld hw=(helloworld)ctx.getBean("helloworld");
    hw.hello();
    
    %>
    </body>
    </html>

    spring的基本包要引入,而且你自己定义的包也要引入才能识别类名

  • 相关阅读:
    vi命令大全
    理解proc文件系统
    读目录
    取得系统资源信息
    qtempinc
    我实现的一个正则表达式代码
    oracle内置函数大全
    STL算法
    unix基础教程
    两日期间的天数
  • 原文地址:https://www.cnblogs.com/pegasus827/p/9149297.html
Copyright © 2011-2022 走看看