java

位置:IT落伍者 >> java >> 浏览文章

Struts Layout


发布日期:2022年04月22日
 
Struts Layout

正如软件有他的皮肤一样我们的系统也有自己的皮肤如果我们的应用系统可以让不同的客户选择自己喜欢的风格那么我们将会感到无比的开心难道不是吗?

可以更加容易的使用标记库更轻松的开发出系统风格一致的系统

Struts基于mvc的frameWork广泛的应用的jee开发领域中

· configure struts for the webapp

· configure the strutslayout treeview and sort action (just copy the corresponding lines of the strutsconfig file of the example application)

· copy the strutslayoutjar file into the WEBINF/lib directory

· declare the strutslayout tld file in the webxml file

· copy the menujar file from the strutslayout example application into the WEBINF/lib directory

· put a version of the common BeanUtils library in the WEBINF/lib directory if using struts

· copy the strutslayouttld file into the WEBINF directory

· copy the files in the config and images directory of the strutslayout example application in your new webapp

· if forward to Tiles definition will be used with sorting or paging on the server the strutslayout request processor

example:

<layout:form action= styleClass=FORM>

<layout:grid cols=>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

</layout:grid>

<layout:grid cols=>

<layout:text key=Text input field property=username/>

<layout:text key=Text input field property=username/>

<layout:text key=Text input field property=username/>

<layout:text key=Text input field property=username/>

</layout:grid>

</layout:form>

<layout:form action= styleClass=FORM>

<layout:row>

<layout:collection name=users styleClass=FORM>

<layout:collectionItem title=userslogin property=login/>

<layout:collectionItem title=usersfirstname property=firstname/>

<layout:collectionItem title=userslastname property=lastname/>

<layout:collectionItem title=userssociety property=society/>

</layout:collection>

<layout:column>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

</layout:column>

</layout:row>

</layout:form>

<layout:form action= styleClass=FORM>

<layout:grid cols=>

<layout:collection name=users styleClass=FORM length=>

<layout:collectionItem title=userslogin property=login/>

<layout:collectionItem title=usersfirstname property=firstname/>

<layout:collectionItem title=userslastname property=lastname/>

<layout:collectionItem title=userssociety property=society/>

</layout:collection>

<layout:column>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

</layout:column>

</layout:grid>

<layout:space/>

<layout:grid cols=>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:text key=Field property=username/>

<layout:space/>

<layout:text key=Field property=username/>

<layout:space/>

</layout:grid>

</layout:form>

jsp page:

[

<%@ page language=java %>

<%@ taglib uri=/WEBINF/strutsbeantld prefix=bean %>

<%@ taglib uri=/WEBINF/strutshtmltld prefix=html %>

<html:html locale=true>

<head>

<title><bean:message key=logontitle/></title>

<html:base/>

</head>

<body bgcolor=white>

<html:errors/>

<html:form action=/logon focus=username>

<table border= width=%>

<tr>

<th align=right>

<bean:message key=promptusername/>

</th>

<td align=left>

<html:text property=username size= maxlength=/>

</td>

</tr>

<tr>

<th align=right>

<bean:message key=promptpassword/>

</th>

<td align=left>

<html:password property=password size= maxlength=

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=/WEBINF/strutslayouttld prefix=layout %>

<%@ taglib uri=/WEBINF/strutshtmltld prefix=html %>

<layout:html locale=true styleClass=FORM>

<html:errors property=orgapachestrutsactionGLOBAL_ERROR/>

<layout:form action=/logondo focus=username key=logontitle styleClass=FORM>

<layout:field key=promptusername property=username size= maxlength= isRequired=true styleClass=LABEL/>

<layout:field key=promptpassword property=password size= maxlength= type=password styleClass=LABEL isRequired=true/>

<layout:formActions>

<layout:submit property=submit value=Submit/>

<layout:reset/>

</layout:formActions>

</layout:form>

</layout:html>

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

               

上一篇:Eclipse远程调试Java

下一篇:Hibernate主键生成方式 Key Generator