본문 바로가기
홈페이지 만들기/Spring

공통/설정데이터 XML파일로 가져오기

by 리틀홍콩 2015. 4. 8.
728x90
반응형

=== /WEB-INF/spring/appServlet/servlet-context.xml =================

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:beans="http://www.springframework.org/schema/beans"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:util="http://www.springframework.org/schema/util"
 xsi:schemaLocation="http://www.springframework.org/schema/mvc     

http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-3.2.xsd">

 

 

...

...

<util:properties id="properties" location="/WEB-INF/xml/properties.xml" />

=======================================================================

└ 빨간색 글 추가

 

 

=== index.jsp ==========================================================

 

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page session="false" %>
<h1>
<br/>
 Hello world! 
</h1>
<br/>
<P>  The time on the server is ${serverTime}. </P>
<spring:eval expression="@properties['code']"/>

=======================================================================

└ 빨간색 글 추가

 

=== properties.xml ======================================================

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd" >

<properties>
    <comment>설정파일</comment>
    <entry key="code">02123</entry>
</properties>

=======================================================================

└ 빨간색 글 추가

 


출처 : http://secondmemory.kr/271

반응형

댓글