JSPCN主页 | JSP空间 | 网站制作 | JSP下载 | JSP论坛 | JSP教程 | 关于JSPCN | 联系我们
JSP虚拟主机,jsp空间,java空间,java虚拟空间,详细请点击进入
做最专业的JSP中文网站 当前位置首页--JSP技术--STRUTS  
文章搜索:
关键字 标题
  
JSP中文网内容管理系统(JCMS)
JSP虚拟主机
网络笔记本
网摘,图片,笔记收藏
虚拟服务器

JSPCN文章目录分类
JSP配置[219]JSP基础[136]
中文问题[69]上传问题[27]
JAVABEAN[46]数据库[212]
文件操作[126]图片声音[17]
JSP其他[57]时间相关[16]
JAVAMAIL[72]STRUTS[144]
开发工具[28]教程系列[157]
JSP实例[89]
JAVA基础[421]APPLET[78]
JAVA网络[179]Applica[115]
Servlet[98]XML[163]
J2ME[257]J2EE[374]
考试相关[63]JAVA线程[90]
EJB[261]Swing[26]
Java API[141]声音图片[28]
异常处理[33]JAVA实例[290]
JAVA类[139]SUN[89]
Hibernate[6]JMX[8]
Spring[34]
本版推荐文章 
本版热点文章 
相关文章链接 
 
Struts Layout
作者:     文章来源:
访问次数:455次     加入时间:2006年09月14日
正如软件有他的皮肤一样,我们的系统也有自己的皮肤,如果我们的应用系统可以让不同的客户选择自己喜欢的风格,那么我们将会感到无比的开心,难道不是吗?
可以更加容易的使用标记库,更轻松的开发出系统风格一致的系统
Struts基于mvc2的frameWork广泛的应用的j2ee开发领域中,
? configure struts for the webapp
? configure the struts-layout treeview and sort action (just copy the corresponding lines of the struts-config file of the example application)
? copy the struts-layout.jar file into the WEB-INF/lib directory.
? declare the struts-layout tld file in the web.xml file
? copy the menu.jar file from the struts-layout example application into the WEB-INF/lib directory.
? put a version of the common BeanUtils library in the WEB-INF/lib directory if using struts 1.0
? copy the struts-layout.tld file into the WEB-INF directory.
? copy the files in the config and images directory of the struts-layout example application in your new webapp.
? if forward to Tiles definition will be used with sorting or paging on the server, the struts-layout request processor

example:
...
<layout:form action="..." styleClass="FORM">
<layout:grid cols="3">
<layout:text key="Field 1" property="username1"/>
<layout:text key="Field 2" property="username2"/>
<layout:text key="Field 3" property="username3"/>
<layout:text key="Field 4" property="username4"/>
<layout:text key="Field 5" property="username5"/>
<layout:text key="Field 6" property="username6"/>
</layout:grid>
<layout:grid cols="2">
<layout:text key="Text input field 7" property="username7"/>
<layout:text key="Text input field 8" property="username8"/>
<layout:text key="Text input field 9" property="username9"/>
<layout:text key="Text input field 10" property="username10"/>
</layout:grid>
</layout:form>
...

...
<layout:form action="..." styleClass="FORM">
<layout:row>
<layout:collection name="users" styleClass="FORM">
<layout:collectionItem title="users.login" property="login"/>
<layout:collectionItem title="users.firstname" property="firstname"/>
<layout:collectionItem title="users.lastname" property="lastname"/>
<layout:collectionItem title="users.society" property="society"/>
</layout:collection>
<layout:column>
<layout:text key="Field 1" property="username1"/>
<layout:text key="Field 2" property="username2"/>
<layout:text key="Field 3" property="username3"/>
</layout:column>
</layout:row>
</layout:form>
...
...
<layout:form action="..." styleClass="FORM">
<layout:grid cols="2">
<layout:collection name="users" styleClass="FORM" length="3">
<layout:collectionItem title="users.login" property="login"/>
<layout:collectionItem title="users.firstname" property="firstname"/>
<layout:collectionItem title="users.lastname" property="lastname"/>
<layout:collectionItem title="users.society" property="society"/>
</layout:collection>
<layout:column>
<layout:text key="Field 1" property="username"/>
<layout:text key="Field 2" property="username"/>
<layout:text key="Field 3" property="username"/>
</layout:column>
</layout:grid>
<layout:space/>
<layout:grid cols="3">
<layout:text key="Field 6" property="username"/>
<layout:text key="Field 7" property="username"/>
<layout:text key="Field 8" property="username"/>
<layout:space/>
<layout:text key="Field 9" property="username"/>
<layout:space/>
</layout:grid>
</layout:form>
...


jsp page:
[

<%@ page 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="logon.title"/></title>
<html:base/>
</head>
<body bgcolor="white">

<html:errors/>

<html:form action="/logon" focus="username">
<table border="0" width="100%">

<tr>
<th align="right">
<bean:message key="prompt.username"/>
</th>
<td align="left">
<html:text property="username" size="16" maxlength="16"/>
</td>
</tr>

<tr>
<th align="right">
<bean:message key="prompt.password"/>
</th>
<td align="left">
<html:password property="password" size="16" maxlength="16"
redisplay="false"/>
</td>
</tr>

<tr>
<td align="right">
<html:submit property="submit" value="Submit"/>
</td>
<td align="left">
<html:reset/>
</td>
</tr>

</table>

</html:form>

</body>
</html:html>

]

layout page:
[
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<layout:html locale="true" styleClass="FORM">

<html:errors property="org.apache.struts.action.GLOBAL_ERROR"/>

<layout:form action="/logon.do" focus="username" key="logon.title" styleClass="FORM">

<layout:field key="prompt.username" property="username" size="16" maxlength="16" isRequired="true" styleClass="LABEL"/>

<layout:field key="prompt.password" property="password" size="16" maxlength="16" type="password" styleClass="LABEL" isRequired="true"/>

<layout:formActions>
<layout:submit property="submit" value="Submit"/>
<layout:reset/>
</layout:formActions>

</layout:form>

</layout:html>



]
,使用layout可以更加容易的开发!

Copyright © 2002-2005 JSPCN.net. All rights reserved.
JSP中文网    备案序号:蜀ICP备05001583号
成都恒海科技发展有限公司    成都市一环路南二段6号新瑞楼三楼8号