2004-05-20 1、 jsp乱码问题,需要在首行加上: <%@ page language="java" contentType="text/html;charset=gb2312" %> 据archive说这样设置在其他地方可能还会出现乱码的,先保证俺的能用。 2、 从tab中读取数据,代码在printstack中显示。 myMap = new MapJ(); myMap.loadMapDefinition("e:/share/test/test.mdf"); //------------for adding a buffer------------------------------------ ArrayList columns = new ArrayList(); //tab表的结构 columns.add("fName"); columns.add("fID"); columns.add("fAddr"); FeatureLayer parkLayer = (FeatureLayer)myMap.getLayers().get("test"); //FeatureSet fs = parkLayer.searchByAttribute(columns,"road",att1,null); TableInfo ti = parkLayer.getTableInfo(); List allCols = new ArrayList(); System.out.print("Columns: "); int colCount = ti.getColumnCount(); for ( int i = 0; i < colCount; i++ ) { String colName = ti.getColumnName(i); allCols.add(colName); // Print all of the column names for reference later System.out.print(colName); if ( i < colCount - 1 ) { System.out.print(", "); } } System.out.println(""); //QueryParams qp = new QueryParams(); FeatureSet fs = parkLayer.searchAll(columns, null); RewindableFeatureSet rfs = new RewindableFeatureSet(fs); Feature f; // Loop until FeatureSet.getNextFeature() returns null int featNum = 1; rfs.rewind(); while ( (f = rfs.getNextFeature()) != null ) { // Print out all of the Attributes of each Feature System.out.print("Attributes #" + featNum++ + ": "); Geometry g = f.getGeometry(); for ( int i = 0; i < colCount; i++ ) { System.out.print(f.getAttribute(i)); if ( i < colCount - 1 ) { System.out.print(", "); } } System.out.println(""); f.getAttribute(0).set("hello"); } fs.dispose(); 3、 其他
|