网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
本月文章推荐
.接口和抽象类的定义方式举例说明.
.JAVA中用动态代理类实现记忆功能.
.J2EE综合-浅析Java程序员的存储过.
.Forte for Java简介与基础安装.
.Java做一个最简单的Socket通话程.
.保护Applet免遭“窃取”的小技巧.
.java的经历.
.MIDP1.0-五子棋1.1读后的修改.
.JADT 入门,第 1 部分.
.Java编程语言在软件开发中的几个.
.J2ME工具:使用j2meunit进行游戏测.
.一个象棋手机游戏的源代码.
.接口和抽象类有什么区别?.
.为 Web 服务构建 Struts 应用程序.
.在Java程序中实现对数字的格式化.
.用 WebSphere Studio 创建 JSF 提.
.IBM Java如何做到高性能GC的实现.
.J2EE编程起步.
.当用Servlet来处理http请求页面时.
.NaN 属性.

3. Building View Components

发表日期:2008-1-5


3. Building View Components

3.1 Overview

This chapter focuses on the task of building the View components for use with the Struts framework. Many applications rely on JavaServer Pages (jsp) technology to create the presentation layer. The Struts distribution includes a comprehensive JSP tag library that provides support for building internationalized applications, as well as for interacting with input forms. Several other topics related to the View components are briefly discussed.

3.2 Internationalized Messages

A few years ago, application developers could count on having to support only residents of their own country, who are used to only one (or sometimes two) languages, and one way to represent numeric quantities like dates, numbers, and monetary values. However, the eXPlosion of application development based on web technologies, as well as the deployment of sUCh applications on the Internet and other broadly Accessible networks, have rendered national boundaries invisible in many cases. This has translated (if you will pardon the pun) into a need for applications to support internationalization (often called "i18n" because 18 is the number of letters in between the "i" and the "n") and localization.

Struts builds upon the standard classes available on the Java platform to build internationalized and localized applications. The key concepts to become familiar with are:

  • Locale - The fundamental Java class that supports internationalization is Locale. Each Locale represents a particular choice of country and language (plus an optional language variant), and also a set of formatting assumptions for things like numbers and dates.
  • ResourceBundle - The java.util.ResourceBundle class provides the fundamental tools for supporting messages in multiple languages. See the Javadocs for the ResourceBundle class, and the information on Internationalization in the documentation bundle for your JDK release, for more information.
  • PropertyResourceBundle - One of the standard implementations of ResourceBundle allows you to define resources using the same "name=value" syntax used to initialize properties files. This is very convenient for preparing resource bundles with messages that are used in a web application, because these messages are generally text oriented.
  • MessageFormat - The java.text.MessageFormat class allows you to replace portions of a message string (in this case, one retrieved from a resource bundle) with arguments specified at run time. This is useful in cases where you are creating a sentence, but the Words would appear in a different order in different languages. The placeholder string {0} in the message is replaced by the first runtime argument, {1} is replaced by the second argument, and so on.
  • MessageResources - The Struts class org.apache.struts.util.MessageResources lets you treat a set of resource bundles like a database, and allows you to request a particular message string for a particular Locale (normally one associated with the current user) instead of for the default Locale the server itself is running in.


上一篇:JAVA 深度控制 WORD 人气:569
下一篇:4. Building Controller Components 人气:627
浏览全部Java的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐