Yesky首页| 产品报价| 行情| 手机 | 数码 | 笔记本 | 台式机 | DIY硬件 | 外设 | 网络 | 数字家庭 | 评测 | 软件 | e时代 | 游戏 | 图片 | 壁纸 | 群乐 | 社区 | 博客 | 下载
您现在的位置: 天极网 > 开发频道 > 实例学习Struts
全文

实例学习Struts

2003-11-25 21:10 作者: satitan 出处: yesky-matrix 责任编辑:>方舟
  创建 View

  现在回到 Eclipse,建立一个新页面 index.jsp:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title" /></title>
<html:base/>
</head>

<body>
<html:errors/>
<html:form action="/logon">
<bean:message key="prompt.username"/>
<html:text property="username"/>
<br/>
<bean:message key="prompt.password"/>
<html:password property="password"/>
<br/>
<html:submit>
<bean:message key="index.logon"/>
</html:submit>
</html:form>
</body>
</html:html>

  成功登录后的页面 main.jsp:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html:html>
<head>
<title><bean:message key="main.title"/></title>
<html:base/>
</head>
<body>
<html:link forward="logoff">
<bean:message key="main.logoff"/>
</html:link>
</body>
</html:html>

  你可能注意到这两个页面中都使用了方便国际化的特性,这至少需要一个默认的属性文件 ApplicationResources.properties:

index.title=Struts Homepage
prompt.username=Username
prompt.password=Password
index.logon=Log on
main.title=Struts Main page
main.logoff=Log off
error.password.mismatch=Invalid username and/or password.

共3页。 9 1 2 3 :
共3页。 9 1 2 3 :
网友关注
最新上市
编辑推荐
文章阅读排行
周排行
月排行
欢迎订阅天极网RSS聚合资讯:http://www.yesky.com/index.xml