首页 > 编程 > .NET > 正文

Localization/MasterPage in ASP.NET 1.1 with Spring

2024-07-10 12:55:46
字体:
来源:转载
供稿:网友
 

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


  • 本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。
  • 发表评论 共有条评论
    用户名: 密码:
    验证码: 匿名发表