Localization/MasterPage in ASP.NET 1.1 with Spring.Net

1. Get spring.core/spring.web from sourceforge's CVS

2.Include Spring.Core,Spring.Web in your new Web App

3.Change your Web.Config like:

 1<configuration>
 2<configsections>
 3<sectiongroup name="spring">
 4<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"></section>
 5</sectiongroup>
 6</configsections>
 7<spring>
 8<context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
 9<resource uri="~/spring-objects.xml"></resource>
10</context>
11</spring>
12<system.web>
13<httphandlers>
14<add path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web" verb="*"></add>
15</httphandlers>
16
17//.....default web.config begin.....   
18<compilation debug="true" defaultlanguage="c#"></compilation>   
19..... 
20
214.In the root, add a file: spring-objects.xml (defined in web.config <context type="">...). like:   
22<?xml version="1.0" encoding="utf-8" ?>
23<objects>
24<object id="masterPage" type="~/Master.aspx"></object>
25<object abstract="true" id="basePage">
26<property name="Master">
27<ref object="masterPage"></ref>
28</property>
29</object>
30<object id="Default" parent="basePage" type="Default.aspx"></object>
31<object id="THE_FILE_NAME" type="THE_FULL_NAME"></object>
32<object id="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
33<property name="ResourceManagers">
34<list>
35<value>SpringNet.Web.UI.Head, SpringNet.Web.UI</value>
36<value>YOUR_WEB_FORM_WITH_DIR_NAME,YOUR_ASSEMBLY</value>
37</list>
38</property>
39</object>
40</objects>
41
425.add a asp:label in your default.aspx, named Label1; 
43
446\. chang in Default.aspx.cs:   
45public class Default:System.web.UI.Page =&gt; public class Default: Spring.Web.UI.Page 
46
477.add in your resource files: Label1.Text = CHANG_TO_LOCALIZED_TEXT 
48
498\. Then, your are at the END:   
50files you need:   
51\Web.config   
52\spring-objects.xml   
53\Default..zh-CN.resx   
54\Default.en-US.resx   
55\Default.aspx.resx   
56\Default.aspx.cs   
57\Default.aspx</context></system.web></configuration>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus