Java Struts2 doubleselect实现省市级联下拉框

在Struts2中,给我们提供了一个s:doubleselect标签,该标签可以实现级联下拉选择。

doubleselect.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>


	Document
	<%@ taglib prefix="s" uri="/struts-tags" %>
	


	
	
		
		
		
			
		
	


result.jsp

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>


	
	Document


	 , 

struts.xml





	
 	
	
		
			/doubleselect.jsp
		
		
		
			/result.jsp
		
  
	

web.xml



  	
  
    doubleselect.jsp
  
  
  	struts2
  	
  		org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  	
  
  
  	struts2
  	/*
  

DoubleSelectAction.java

package top.k10000;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import com.opensymphony.xwork2.ActionSupport;

public class DoubleSelectAction extends ActionSupport{
	private static final long serialVersionUID = 1L;
	private String province;
	private String city;
	Map> map;

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public Map> getMap() {
		return map;
	}

	public void setMap(Map> map) {
		this.map = map;
	}

	public DoubleSelectAction(){
		map =new HashMap>();		
		map.put("广东省", new ArrayList(Arrays.asList("广州市", "深圳市", "汕尾市","东莞市")));
		map.put("北京", new ArrayList(Arrays.asList("东城区", "西城区","朝阳区")));
		map.put("新疆省", new ArrayList(Arrays.asList("乌鲁木齐","克拉玛依市","图木舒克市")));
		System.out.println(map);
	}

	public String execute() {
		return SUCCESS;
	}
	
	public String display() {
		return SUCCESS;
	}
	
}

Java Struts2 doubleselect实现省市级联下拉框_第1张图片

Java Struts2 doubleselect实现省市级联下拉框_第2张图片

园子参考:https://www.cnblogs.com/IT-1994/p/6135952.html

你可能感兴趣的:(#,SSH古董框架,Java)