웹 워 크 학습 노트

7471 단어 WebworkJavaJSPWebXML
더 읽 기
iterator 탭 을 사용 하 는 예 를 기록 하 십시오.

/*
 * Created on 2004-8-2
 * author:xmx
 */
package demo.tagdemo;


import com.opensymphony.xwork.Action;
import java.util.List;
import java.util.ArrayList;

public class TagDemoAction implements Action {
	//              
	private User user= new User();;
	private String name1;
	private int int1;
	private float float1;
	private double double1;
	private String []strs;

	public User getUser();{
		return this.user;
	}
	
	public String execute();{
		
		System.out.println("Start execute 。。。。。。。。。。。。。");;
		System.out.println("User="+user);;
		//              ,  :           
		System.out.println("Name1="+name1);;
		System.out.println("Int1="+int1);;
		return SUCCESS;
	}
	
    public String[] getProperties(); {
        String []back=new String[]{"1","2","3","4","5","6"}; 
        return back; 
    }
	/**
	 * @return
	 */
	public String getName1(); {
		return name1;
	}

	/**
	 * @param string
	 */
	public void setName1(String string); {
		name1 = string;
	}

	/**
	 * @return
	 */
	public int getInt1(); {
		return int1;
	}

	/**
	 * @param i
	 */
	public void setInt1(int i); {
		int1 = i;
	}

	/**
	 * @return
	 */
	public double getDouble1(); {
		return double1;
	}

	/**
	 * @return
	 */
	public float getFloat1(); {
		return float1;
	}

	/**
	 *        ,  getXXX();,             
	 *    service   
	 * @return
	 */
	public String[] getStrs(); {
		String []back=new String[]{"11","22","33","44","55","66"};
				
		return back;
	}
/**
 * List       iterator  
 * @return
 */
	public List getList(); {
		List back=new ArrayList();;
		back.add("test1");;
		back.add("test21");;		
				
		return back;
	}
	
	public List getUserList(); {
			List back=new ArrayList();;
			for(int i=0;i<5;i++);{
				User tmp=new User();;
				tmp.setUsername("UserName"+i);;
				back.add(tmp);;
			}
				
			return back;
	}
	
	
	/**
	 * @param d
	 */
	public void setDouble1(double d); {
		double1 = d;
	}

	/**
	 * @param f
	 */
	public void setFloat1(float f); {
		float1 = f;
	}

	/**
	 * @param strings
	 */
	public void setStrs(String[] strings); {
		strs = strings;
	}

}


input.jsp





Register Example

Username:
Password:
Email:
Age:
Name1:
Int1:
Float1:
Double1:
show.jsp





    First WebWork Example---tag-iterator



TagDemoAction.java


count = isfirst = islast = index = iseven = isodd = modulus=


strs:



list:



UserList:
username[]: ___

( import): TEST =
if。。。else。。。
if: Failures elseIf: Failure elseIf: Success
1<0 else: 1>=0

username: ,password: ,email: ,age: ,name1: ,int1: ,float1: ,double1:

xwork.xml 세 션

        
            
                
                
            
            
            
				
				
				
			
        

        



		
		
            
                /web/tag_iterator.jsp
            
            
                /web/fail.jsp
            
            
                /web/tag_iterator.jsp
            
            
                 
        

좋은 웹페이지 즐겨찾기