新客网WWW.XKER.COM:致力做中国最专业的网络学院!
学院: 操作系统 - 网络应用 - 服务器 - 网络安全 - 工具软件 - 办公软件 - Web开发 - 数据库 - 网页设计 - 图形图像 - 媒体动画 - 硬件学堂 - 存储频道 - QQ专区
您的位置:首页 > 软件开发 > .Net开发 > Asp.net教程 > 正文:Localization/MasterPage in ASP.NET 1.1 with Spring.Net

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

新客网 XKER.COM 2005-08-11 来源: 收藏本文
 

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:

<configuration>
    <configSections>
        <sectionGroup name="spring">
            <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
        </sectionGroup>
    </configSections>

    <spring>
        <context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
            <resource uri="~/spring-objects.xml"/>
        </context>
    </spring> 
  
  <system.web>

   <httpHandlers>
        <add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
    </httpHandlers>

    //.....default web.config begin.....
    <compilation     defaultLanguage="c#"     debug="true"   />
     .....

4.In the root, add a file: spring-objects.xml (defined in web.config <context type>...). like:
<?xml version="1.0" encoding="utf-8" ?>
 <objects>
<object id="masterPage" type="~/Master.aspx" />
  <object id="basePage" abstract="true">
      <property name="Master">
          <ref object="masterPage"/>
      </property>
  </object>
  <object id="Default" type="Default.aspx" parent="basePage" />

  <object id=THE_FILE_NAME type=THE_FULL_NAME />

  <object id="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
        <property name="ResourceManagers">
            <list>
                <value>SpringNet.Web.UI.Head, SpringNet.Web.UI</value>
                <value>YOUR_WEB_FORM_WITH_DIR_NAME,YOUR_ASSEMBLY</value>
            </list>
        </property>   
    </object>
</objects>

5.add a asp:label in your default.aspx, named Label1;

6. chang in Default.aspx.cs:
public class Default:System.web.UI.Page => public class Default: Spring.Web.UI.Page

7.add in your resource files: Label1.Text = CHANG_TO_LOCALIZED_TEXT

8. Then, your are at the END:
files you need:
\Web.config
\spring-objects.xml
\Default..zh-CN.resx
\Default.en-US.resx
\Default.aspx.resx
\Default.aspx.cs
\Default.aspx


收藏】 【评论】 【推荐】 【投稿】 【打印】 【关闭
发表评论
要记得去论坛讨论,点击注册新会员匿名评论
评论内容:不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
阅读排行
随机推荐
实用信息推荐