var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-20738293-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script')"/>
jutleo
欢迎走进有风的地方~~
posts - 63,  comments - 279,  trackbacks - 0
这些都是Struts2的一些新标签,感觉很新鲜,特别是datetimedipacker标志感觉很好

filevalidateExample.jsp 文件
<%@ page language="java" contentType="text/html; charset=ISO-8859-5"
    pageEncoding
="ISO-8859-5"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>fieldValidatorsExample test</title>
<s:url id="siteCss" includeContext="true"
    value
="/validationExamplesStyles.css" />
<s:head theme="xhtml" />

</head>
<body>
<h3>All field Error will show</h3>
<s:fielderror />
<hr color="red" />

<s:form action="fieldValidators" method="post">
    
<s:textfield tooltip="ENTER YOUR NAME" label="YOUR NAME" name="name" />
    
<s:textfield tooltip="ENTER YOUR AGE" label="YOUR AGE" name="age" />

    
<s:datetimepicker tooltip="ENTER YOUR BIRTHDAY" label="YOUR BIRTHDAY"
        name
="birthday" />

    
<s:textfield tooltip="ENTER YOUR EMAIL" label="YOUR EMAIL" name="Email" />
    
<s:textfield tooltip="ENTER YOUR URL" label="YOUR URL" name="url" />

    
<s:select tooltip="SELECT YOUR PROGRAM" label="YOUR PROGRAM"
        name
="program" list="{'Java','.net','C#','Struts2'}" />

    
<s:checkboxlist tooltip="SELECT YOUR FAVOURITE COLOR"
        label
="FAVOURITE COLOR" name="color"
        list
="{'red','green','yellow','pink','blue'}" value="{'green','blue'}" />

    
<s:tree label="parent" id="parentId" theme="ajax"
        templateCssPath
="/struts/tree.css" showRootGrid="true" showGrid="true">
        
<s:treenode theme="ajax" label="child1" id="child1Id">
            
<s:treenode theme="ajax" label="grandchild1" id="grandchild1Id" />
            
<s:treenode theme="ajax" label="grandchild2" id="grandchild2Id" />
            
<s:treenode theme="ajax" label="grandchild3" id="grandchild3Id" />
        
</s:treenode>

        
<s:treenode theme="ajax" label="child2" id="child2Id" />
        
<s:treenode theme="ajax" label="child3" id="child3Id" />
        
<s:treenode theme="ajax" label="child4" id="child4Id" />
        
<s:treenode theme="ajax" label="child5" id="child5Id">
            
<s:treenode theme="ajax" label="gChild1" id="gChild1Id" />
            
<s:treenode theme="ajax" label="gChild2" id="gChild2Id" />
        
</s:treenode>
    
</s:tree>

    
<s:hidden name="hiddenName" value="bulktree and oakertree" />
    
<s:submit label="SUBMIT" />

</s:form>

</body>
</html>
FileValidateAction.java文件
package com.bulktree.struts2;

import java.util.Date;

import com.opensymphony.xwork2.ActionSupport;

public class FieldValidatorsAction extends ActionSupport {
    
private String name = null;
    
private Integer age = null;
    
private Date birthday = null;
    
private String Email = null;
    
private String url = null;
    
private String program = null;
    
private String color = null;
    
private String hiddenName = null;
    
private String child2 = null;
    
    
    
    
public String getChild2() {
        
return child2;
    }

    
public void setChild2(String child2) {
        
this.child2 = child2;
    }

    
public String getHiddenName() {
        
return hiddenName;
    }

    
public void setHiddenName(String hiddenName) {
        
this.hiddenName = hiddenName;
    }

    
public String getColor() {
        
return color;
    }

    
public void setColor(String color) {
        
this.color = color;
    }

    
public String getProgram() {
        
return program;
    }

    
public void setProgram(String program) {
        System.out.println(
"*****setProgram**********");
        
this.program = program;
    }

    
public String getName() {
        
return name;
    }

    
public void setName(String name) {
        
this.name = name;
    }

    
public Integer getAge() {
        
return age;
    }

    
public void setAge(Integer age) {
        
this.age = age;
    }

    
public Date getBirthday() {
        
return birthday;
    }

    
public void setBirthday(Date birthday) {
        
this.birthday = birthday;
    }

    
public String getEmail() {
        
return Email;
    }

    
public void setEmail(String email) {
        Email 
= email;
    }

    
public String getUrl() {
        
return url;
    }

    
public void setUrl(String url) {
        
this.url = url;
    }

    
    @Override
    
public String execute() throws Exception {
        
        
return SUCCESS;
    }

    
    @Override
    
public void validate() {
        
    }

    
    
    
}

struts.xml配置片段
<action name="fieldValidators"
            class
="com.bulktree.struts2.FieldValidatorsAction">
            
<result>/welcome.jsp</result>
        
</action>
welcome.jsp显示页面
<%@ page language="java" contentType="text/html; charset=GB2312"
    pageEncoding
="GB2312"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>login</title>
</head>
<body>
YOUR USERNAME:
<FONT size="5" color="red"><s:property value="username" /></FONT>
<br>
YOUR PASSWORD:
<FONT size="5" color="red"><s:property value="password" /></FONT>
<br>

YOUR USERNAME:
<FONT size="5" color="red"><s:property value="user.username" /></FONT>
<br>
YOUR PASSWORD:
<FONT size="5" color="red"><s:property value="user.password" /></FONT>
<br>

YOUR NAME:
<FONT size="5" color="red"><s:property value="name" /></FONT>
<br>
YOUR AGE:
<FONT size="5" color="red"><s:property value="age" /></FONT>
<br>
YOUR BIRTHDAY:
<FONT size="5" color="red"><s:property value="birthday" /></FONT>
<br>
YOUR EMAIL:
<FONT size="5" color="red"><s:property value="Email" /></FONT>
<br>
YOUR URL:
<FONT size="5" color="red"><s:property value="url" /></FONT>
<br>
YOUR PROGARAM:
<FONT size="5" color="red"><s:property value="program" /></FONT>
<br>
YOUR FAVOURITE COLOR:
<FONT size="5" color="red"><s:property value="color" /></FONT>
<br>
YOUR HIDDEN NAME
<FONT size="5" color="red"><s:property value="hiddenName" /></FONT>
<br>

TREE:
<s:property value="child2" />

</body>
</html>
posted on 2008-01-04 22:01 凌晨风 阅读(2876) 评论(1)  编辑  收藏 所属分类: Spring/Hibernate/Struts2

FeedBack:
# re: Struts2常用标签[未登录]
2008-07-20 16:35 | fire
请问下 那个标签风格怎么设置的,那个css样式怎么整啊?
  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航:
 

<2008年1月>
303112345
6789101112
13141516171819
20212223242526
272829303112
3456789

常用链接

留言簿(11)

我参与的团队

随笔分类

随笔档案

文章分类

文章档案

新闻分类

新闻档案

收藏夹

围脖

最新随笔

搜索

  •  

最新评论

阅读排行榜

评论排行榜