锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
]]>
涓嬭澆鐨勮蔣浠跺寘涓凡鏈夎嚜甯﹂厤緗枃浠訛紝涓轟簡浣跨敤鏂逛究浣滀簡涓浜涗慨鏀?br />
鐩綍緇撴瀯濡備笅
JORAM-4.3.14
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |---[CONFIG]
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |---[lib]
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 |---start-server.bat
config涓負(fù)鑷甫鐨勯厤緗枃浠舵瘡嬈″惎鍔ㄥ彲浠ラ変笉鍚岀殑閰嶇疆
lib涓負(fù)鎵闇瑕佺殑jar鍖?br />
涓昏浠嬬粛涓嬩慨鏀圭殑start-server.bat
錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛?br />Title 娑堟伅鏈嶅姟
@echo off
REM Verify if JORAM_HOME is well defined
set JORAM_HOME=%CD%聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 //%CD%鍙互鍔ㄦ佸緱鍒板綋鍓嶈礬寰勶紝閬垮厤浜嗗湪鍘繪墜鍚岃緗甁ORAM_HOME鐨勯棶棰?/font>
if not exist "%JORAM_HOME%\bin\admin.bat" goto nokHome
REM Verify if JAVA_HOME is well defined
if not exist "%JAVA_HOME%\bin\java.exe" goto nokJava
set CONFIG_DIR=%JORAM_HOME%\config
set JORAM_LIBS=%JORAM_HOME%\lib
set RUN_DIR=%JORAM_HOME%\run聽聽聽//鏈嶅姟鍚姩鏃跺欎細(xì)鐢熸垚榪欎釜鐩綍錛岃繖閲屼篃浼?xì)鐢熸垚涓浜涜繍琛屾枃浠?/font>
REM聽 Building the Classpath
set CLASSPATH=%JORAM_LIBS%\joram-mom.jar
set CLASSPATH=%CLASSPATH%;%JORAM_LIBS%\joram-shared.jar
set CLASSPATH=%CLASSPATH%;%JORAM_LIBS%\JCup.jar
set CLASSPATH=%CLASSPATH%;%JORAM_LIBS%\jakarta-regexp-1.2.jar
set CLASSPATH=%CLASSPATH%;%JORAM_LIBS%\ow_monolog.jar
set CLASSPATH=%CLASSPATH%;%JORAM_LIBS%\jmxri.jar
set CLASSPATH=%CLASSPATH%;%JORAM_LIBS%\log4j-1.2.8.jar //濡傛灉鐢ㄥ埆鐨刲og api榪欓噷灝遍渶瑕佷慨鏀?/font>
set CLASSPATH=%CLASSPATH%;%RUN_DIR%
mkdir %RUN_DIR%
copy %CONFIG_DIR%\a3config.dtd %RUN_DIR%\a3config.dtd
copy %CONFIG_DIR%\a3debug.cfg %RUN_DIR%\a3debug.cfg
copy %CONFIG_DIR%\centralized_a3servers.xml %RUN_DIR%\a3servers.xml聽 //榪欓噷娉ㄦ剰centralized_a3servers.xml涓殑NullTransaction 鏀規(guī)垚NTransaction 鎵嶅彲浠ユ敮鎸佹寔涔呭寲
copy %CONFIG_DIR%\jndi.properties %RUN_DIR%\jndi.properties
cls
color A聽聽聽 //鎸囧畾DOS涓嬪瓧浣撻鑹?鍙敤鍙笉鐢?/font>
echo %DATE% %time%
echo聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 ------------------------
echo聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 == 鍚姩鍙寔涔呮ф湇鍔?0 ==
echo聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 ------------------------
start /D %RUN_DIR% /B %JAVA_HOME%\bin\java -classpath %CLASSPATH% fr.dyade.aaa.agent.AgentServer 0 ./s0
goto end
:nokHome
echo The JORAM_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:nokJava
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
:end
錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛?br />
import com.opensymphony.xwork.Result;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.webwork.ServletActionContext;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
public class ExcelResult implements Result{
聽聽聽 private HSSFWorkbook workbook;
聽聽聽 private String filename;
聽聽聽 private String contenttype;
聽聽聽 public void execute(ActionInvocation invocation) throws Exception {
聽聽聽聽聽聽聽 if(contenttype==null)
聽聽聽聽聽聽聽聽聽聽聽 contenttype = "application/ms-excel";
聽聽聽聽聽聽聽 if (workbook==null)
聽聽聽聽聽聽聽聽聽聽聽 workbook = (HSSFWorkbook) invocation.getStack().findValue("workbook");
聽聽聽聽聽聽
聽聽聽聽聽聽聽 HttpServletResponse response = ServletActionContext.getResponse();
聽聽聽聽聽聽聽 response.setContentType(contenttype);
聽聽聽聽聽聽聽 response.setHeader("Content-Disposition","attachment;Filename="+filename+".xls");
聽聽聽聽聽聽聽 OutputStream os = response.getOutputStream();
聽聽聽聽聽聽聽 workbook.write(os);
聽聽聽聽聽聽聽 os.flush();
聽聽聽聽聽聽聽 os.close();
聽聽聽 }
聽聽聽 public void setWorkbook(HSSFWorkbook workbook) {
聽聽聽聽聽聽聽 this.workbook = workbook;
聽聽聽 }
聽聽聽 public void setFilename(String filename) {
聽聽聽聽聽聽聽 this.filename = filename;
聽聽聽 }
聽聽聽 public void setContenttype(String contenttype) {
聽聽聽聽聽聽聽 this.contenttype = contenttype;
聽聽聽 }
}
瑙嗗浘鍋氬畬涔嬪悗鍋氬涓嬮厤緗繍琛屾祴璇?br />
package com.customer.action;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.ActionSupport;
import com.opensymphony.webwork.ServletActionContext;
import com.dboperate.ResultGather;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ByteArrayInputStream;
import java.util.List;
import java.util.Map;
public class ExportExcelAction extends ActionSupport {
聽聽聽 private HSSFWorkbook workbook;
聽聽聽 public String execute() throws Exception {
聽聽聽聽聽聽聽 return SUCCESS;
聽聽聽 }
聽聽聽 public String product() throws Exception {
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 workbook = new HSSFWorkbook();
聽聽聽聽聽聽聽聽聽聽聽 HSSFSheet sheet = workbook.createSheet();
聽聽聽聽聽聽聽聽聽聽聽 workbook.setSheetName(0, "鍘傚晢浜у搧", (short) 1);
聽聽聽聽聽聽聽聽聽聽聽 HSSFRow row = sheet.createRow((short) 0);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell0 = row.createCell((short) 0);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell1 = row.createCell((short) 1);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell2 = row.createCell((short) 2);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell3 = row.createCell((short) 3);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell4 = row.createCell((short) 4);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell5 = row.createCell((short) 5);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell6 = row.createCell((short) 6);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell7 = row.createCell((short) 7);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell8 = row.createCell((short) 8);
聽聽聽聽聽聽聽聽聽聽聽 HSSFCell cell9 = row.createCell((short) 9);
聽聽聽聽聽聽聽聽聽聽聽 cell0.setEncoding(HSSFCell.ENCODING_UTF_16);//榪欓噷鏄緗紪鐮佷繚璇佷腑鏂囨甯告樉紺?br />聽聽聽聽聽聽聽聽聽聽聽 cell1.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell2.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell3.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell4.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell5.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell6.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell7.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell8.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell9.setEncoding(HSSFCell.ENCODING_UTF_16);
聽聽聽聽聽聽聽聽聽聽聽 cell0.setCellValue("鍘傚晢鍚?);
聽聽聽聽聽聽聽聽聽聽聽 cell1.setCellValue("浜у搧鍚?);
聽聽聽聽聽聽聽聽聽聽聽 cell2.setCellValue("閲嶉噺");
聽聽聽聽聽聽聽聽聽聽聽 cell3.setCellValue("鏄熺駭");
聽聽聽聽聽聽聽聽聽聽聽 cell4.setCellValue("parama");
聽聽聽聽聽聽聽聽聽聽聽 cell5.setCellValue("paramb");
聽聽聽聽聽聽聽聽聽聽聽 cell6.setCellValue("paramc");
聽聽聽聽聽聽聽聽聽聽聽 cell7.setCellValue("paramd");
聽聽聽聽聽聽聽聽聽聽聽 cell8.setCellValue("鐘舵?);
聽聽聽聽聽聽聽聽聽聽聽 cell9.setCellValue("澶囨敞");
聽聽聽聽聽聽聽 } catch (Exception e) {
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return SUCCESS;
聽聽聽 }
聽聽聽 public HSSFWorkbook getWorkbook() {
聽聽聽聽聽聽聽 return workbook;
聽聽聽 }
}
Xwork.xml涓厤緗姞鍏?br />
聽聽聽聽聽聽聽 <result-type default="true" name="freemarker"
聽聽聽聽聽聽聽聽聽聽聽 <result-type name="excel" class="com.customer.resulttype.ExcelResult"/>
聽聽聽聽聽聽聽 </result-types>
聽<action name="exportExcel" class="com.customer.action.ExportExcelAction">
聽聽聽聽聽聽聽聽聽聽聽 <result name="success" type="excel">
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 <param name="filename">productparam>
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽 </result>
聽聽聽聽聽聽聽 </action>
聽聽聽 public String update() throws Exception {
聽聽聽聽聽聽聽 ....
聽聽聽 }
聽聽聽 public String delete() throws Exception {
聽聽聽聽聽聽聽 ....
聽聽聽 }
聽聽聽 public String list() throws Exception {
聽聽聽聽聽聽聽 ....
聽聽聽 }
DAO
涓嬮潰鏄疍AO鎺ュ彛
public interface BaseDao {
聽聽聽 public int insert(Object form);
聽聽聽 public int update(Object form);
聽聽聽 public int delete(Object form);
聽聽聽 public int delete(int[] id);//榪欓噷鏄負(fù)浜嗘敮鎸佹壒閲忓垹闄?br />聽聽聽 public Map getInfo(Object form);
聽聽聽 public List getList();
聽聽聽 public void getList(Pagination page);//榪欓噷娌℃湁榪斿洖鍊鹼紝鍐呰銆傘傘傘?br />}
EXTENDS
鎵╁睍閮ㄥ垎
1 BaseAction
榪欓噷澧炲姞浜嗕竴浜涘叕鐢ㄦ柟渚跨殑鍔熻兘錛屼究浜庡叾浠朅CTION緇ф壙錛屽叡鐢?br />2 DaoSupport
榪欓噷涔熸槸涓浜涘叕鐢ㄧ殑鍔熻兘錛孌ao涓敤鐨勫ぇ閮ㄥ垎SQL閮芥槸閰嶇疆鍦ㄥ閮ㄩ厤緗枃浠朵腑
3DaoFactory
public class DaoFactory {
聽聽聽 public static BaseDao getDao(String daoKey){
聽聽聽聽聽聽聽 if("user".equals(daoKey)) //榪欐牱鐨勬柟寮忓彲浠ラ氳繃鍦╔WORK.XML涓厤緗瓵CTION浣跨敤鍝釜DAO錛堥潤鎬佹敞鍏ワ級
聽聽聽聽聽聽聽聽聽聽聽 return new UserDao();
聽聽聽聽聽聽聽 else
聽聽聽聽聽聽聽聽聽聽聽 return null;
聽聽聽 }
}
鏁版嵁搴撴槸MYSQL5
CREATE TABLE `usertbl` (聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 `User_ID` int(11) NOT NULL auto_increment,聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 `username` varchar(50) default NULL,聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 `password` varchar(50) default NULL,聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 `truename` varchar(50) default NULL,聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 `usersex` tinyint(4) default NULL,聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 `useremail` varchar(50) default NULL,聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽 PRIMARY KEY聽 (`User_ID`)聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽 )
婧愮爜涓嬭澆鍦板潃
http://www.migti.com/download.ww
聽
瀛︿範(fàn)鐨勬椂鍊欑湅浜嗙綉涓婄殑涓浜涢厤緗暀紼嬶紝娌℃湁杈懼埌鎯寵鐨勭粨鏋?BR>鏌ヤ簡濂藉璧勬枡鎵嶅紕鍑烘潵錛岄殢鍚庡悗鑷繁鏁寸悊鍑轟竴涓厤緗柟娉?BR>
web.xml
// 榪欓噷涓嶉渶瑕侀厤緗瓧絎﹁繃婊わ紝緗戜笂鏈夌殑渚嬪瓙鍔犱簡錛屽疄闄呬笂
webwork.properties閲岃緗涓嬪氨鍙互浜嗛〉闈篃鏄疓BK
webwork.locale=zh_CN
webwork.i18n.encoding=GBK
錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛?BR><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.atlassian.xwork.ext.ResolverSetupServletContextListener</listener-class>
</listener>
<!--
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
-->
<servlet>
<servlet-name>webwork</servlet-name>
<servlet-class>com.opensymphony.webwork.dispatcher.ServletDispatcher</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<servlet-name>freemarker</servlet-name>
<servlet-class>com.opensymphony.webwork.views.freemarker.FreemarkerServlet</servlet-class>
<load-on-startup>10</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webwork</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>freemarker</servlet-name>
<url-pattern>*.ftl</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>webwork</taglib-uri>
<taglib-location>/WEB-INF/webwork.tld</taglib-location>
</taglib>
</web-app>
錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛嶏紞錛?BR>
xwork.xml
==================---------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE xwork PUBLIC "-//OpenSymphony Group//XWork 1.0//EN" "http://www.opensymphony.com/xwork/xwork-1.0.dtd">
<xwork>
<include file="webwork-default.xml"/>
<package name="users" extends="webwork-default"
externalReferenceResolver="com.atlassian.xwork.ext.SpringServletContextReferenceResolver">
<interceptors>
<interceptor name="reference-resolver" class="com.opensymphony.xwork.interceptor.ExternalReferencesInterceptor"/>
<interceptor-stack name="myDefaultWebStack">
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="reference-resolver"/>
<interceptor-ref name="model-driven"/>
<interceptor-ref name="params"/>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="myDefaultWebStack"/>
<action name="blogUser" class="com.jsblog.action.BlogUserAction">
<external-ref name="baseDao">baseDaoTarget</external-ref> //榪欓噷鏄妸applicationContext閲岄厤緗殑DAO 娉ㄥ叆action閲?action閲岃鏈塨aseDao灞炴?BR> <result name="success">/add.htm</result>
</action>
-------------------------------------------------------------------------
applicationContext.xml
---------------------------------------------------------------------------
<?xml version="1.0"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="no" default-dependency-check="none" default-lazy-init="false">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName">
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</property>
<property name="url">
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jsblog;SelectMethod=cursor</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value>jfy</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"/>
</property>
<property name="mappingResources">
<list>
<value>com/jsblog/BlogUserForm.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
net.sf.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
<bean id="baseDaoTarget" class="com.jsblog.dao.BlogUserDao">
<property name="sessionFactory">
<ref local="sessionFactory"/>
</property>
</bean>
</beans>
---------------------------------------------------------------------------
BlogUserDao.java
---------------------------------------------------------------------------
package com.jsblog.dao;
import org.springframework.orm.hibernate.support.HibernateDaoSupport;
import org.springframework.orm.hibernate.HibernateCallback;
import org.springframework.orm.hibernate.SessionFactoryUtils;
import com.jsblog.BlogUserForm;
import java.io.Serializable;
import java.util.List;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
public class BlogUserDao extends HibernateDaoSupport implements BaseDao {
public void insert(BlogUserForm bloguser) {
getHibernateTemplate().save(bloguser);
}
}
<VERIFY xmlns="<KEY>guid</KEY>
<IP>string</IP>
</VERIFY>
</soap:Body>
verify鏈?鍚嶄負(fù) xmlns灞炴х殑鏃跺欏氨浼?xì)鎶ラ?br />
闄勪竴涓獂ml璇誨啓綾?br />import org.dom4j.io.XMLWriter;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import java.io.FileWriter;
import org.dom4j.io.OutputFormat;
import java.io.File;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
public class XmlTool {
聽聽聽 private String filename;
聽聽聽 private SAXReader saxReader = null;
聽聽聽 private Document document = null;
聽聽聽 private Element cfgElement = null;
聽聽聽 public XmlTool(String filename) {
聽聽聽聽聽聽聽 this.filename = filename;
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 saxReader = new SAXReader();
聽聽聽聽聽聽聽聽聽聽聽 document = saxReader.read(new File(filename));
聽聽聽聽聽聽聽 } catch (Exception ex) {
聽聽聽聽聽聽聽聽聽聽聽 ex.printStackTrace();
聽聽聽聽聽聽聽 }
聽聽聽 }
聽聽聽 public void setValue(String key, String value) {
聽聽聽聽聽聽聽 int returnValue = 0;
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 ((Element)( document.selectSingleNode(key))).setText(value);
聽聽聽聽聽聽聽 } catch (Exception ex) {
聽聽聽聽聽聽聽聽聽聽聽 ex.printStackTrace();
聽聽聽聽聽聽聽 }
聽聽聽 }
聽聽聽 public String getValue(String key) {
聽聽聽 int returnValue = 0;
聽聽聽 try {
聽聽聽聽聽聽聽 return ((Element)( document.selectSingleNode(key))).getText();
聽聽聽 } catch (Exception ex) {
聽聽聽聽聽聽聽 ex.printStackTrace();
聽聽聽聽聽聽聽 return "";
聽聽聽 }
}
聽聽聽 public int writeToFile() {
聽聽聽聽聽聽聽 int returnValue = 0;
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 XMLWriter writer = new XMLWriter(new FileWriter(new File(filename)));
聽聽聽聽聽聽聽聽聽聽聽 writer.write(document);
聽聽聽聽聽聽聽聽聽聽聽 writer.close();
聽聽聽聽聽聽聽聽聽聽聽 returnValue = 1;
聽聽聽聽聽聽聽 } catch (Exception ex) {
聽聽聽聽聽聽聽聽聽聽聽 ex.printStackTrace();
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return returnValue;
聽聽聽 }
聽聽聽 public int formatXMLFile(String filename) {
聽聽聽聽聽聽聽 int returnValue = 0;
聽聽聽聽聽聽聽 try {
聽聽聽聽聽聽聽聽聽聽聽 SAXReader saxReader = new SAXReader();
聽聽聽聽聽聽聽聽聽聽聽 Document document = saxReader.read(new File(filename));
聽聽聽聽聽聽聽聽聽聽聽 XMLWriter output = null;
聽聽聽聽聽聽聽聽聽聽聽 OutputFormat format = OutputFormat.createPrettyPrint();
聽聽聽聽聽聽聽聽聽聽聽 format.setEncoding("GBK");
聽聽聽聽聽聽聽聽聽聽聽 output = new XMLWriter(new FileWriter(new File(filename)), format);
聽聽聽聽聽聽聽聽聽聽聽 output.write(document);
聽聽聽聽聽聽聽聽聽聽聽 output.close();
聽聽聽聽聽聽聽聽聽聽聽 returnValue = 1;
聽聽聽聽聽聽聽 } catch (Exception ex) {
聽聽聽聽聽聽聽聽聽聽聽 ex.printStackTrace();
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 return returnValue;
聽聽聽 }
}
import java.sql.Connection;
import java.sql.PreparedStatement;
public class SqlModify
{
private String SQL;
static SqlModify sqlcom = null;
private DBConnManager conn = null;
private Connection con = null;
private PreparedStatement stmt = null;
public SqlModify()
{
}
public SqlModify(boolean connect)
{
if(connect)
connect();
}
public static int modify(String sqlStr)
{
if(sqlcom==null)
sqlcom = new SqlModify();
return sqlcom.exec(sqlStr);
}
public PreparedStatement getStmt()
{
return stmt;
}
public void connect(String sqlStr)
{
try{
connect();
stmt = con.prepareStatement(sqlStr);
}catch(Exception e){
e.printStackTrace();
}
}
public void connect()
{
try{
conn = DBConnManager.getInstance();
con = conn.getConnection("mssql");
}catch(Exception e){
}
}
public int exesqlandClose()
{
int result = exesql();
closeall();
return result;
}
public int exesql()
{
try{
return stmt.executeUpdate();
}catch(Exception e){
e.printStackTrace();
return -1;
}
}
public void setSql(String sql)
{
try{
stmt = con.prepareStatement(sql);
}catch(Exception e){
e.printStackTrace();
}finally{
}
}
public int exec(String sqlStr)
{
int flag=-2;
try{
connect(sqlStr);
int value=stmt.executeUpdate();
flag=value;
}catch(java.lang.Exception ex){
ex.printStackTrace();
}finally{
closeall();
}
return flag;
}
public void closeall()
{
try{
if(stmt!=null)
{
stmt.close();
}
if(conn!=null)
{
conn.releaseConnection("mssql",con);
}
}catch(Exception e){
e.printStackTrace();
}
}
public void setString(int col,String value)
{
try{
stmt.setString(col,value);
}catch(java.lang.Exception ex){
ex.printStackTrace();
}
}
public void setInt(int col,int value)
{
try{
stmt.setInt(col,value);
}catch(java.lang.Exception ex){
ex.printStackTrace();
}
}
public void setLong(int col,long value)
{
try{
stmt.setLong(col,value);
}catch(java.lang.Exception ex){
ex.printStackTrace();
}
}
public void setFloat(int col,float value)
{
try{
stmt.setFloat(col,value);
}catch(java.lang.Exception ex){
ex.printStackTrace();
}
}
}
</td>
</tr>
</table>
<%
}
%>
-------------------------------------------------------------------------------------------------------
myRedirect.java
package com.util;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
public class myRedirect //瀵箄rl鐨勮漿鎹㈢被
{
public static String dealurl(HttpServletRequest request)
{
String url = "";
url = request.getRequestURL()+"?";
url +=param(request);
if(url.indexOf("&")>-1)
url=url.replaceAll("&","@#@");//瀹為檯涓婂氨鏄妸鏈?amp;鐨勫瓧絎﹁漿鍖栨垚浜咢#@
return url;
}
public static String geturl(String url)//榪欎釜鏄繕鍘熸柟娉?BR> {
if(url.indexOf("@#@")>-1)
url=url.replaceAll("@#@","&");
return url;
}
public static String param(HttpServletRequest request)
{
String url = "";
Enumeration param = request.getParameterNames();//寰楀埌鎵鏈夊弬鏁板悕
while(param.hasMoreElements())
{
String pname = param.nextElement().toString();
url += pname+"="+request.getParameter(pname)+"&";
}
if(url.endsWith("&"))
{
url = url.substring(0,url.lastIndexOf("&"));
}
return url;
}
}
榪欐牱鐧誨綍嫻忚鍣ㄥ氨浼?xì)鑷姩铦{鍒扮敤鎴峰垰鍒氳姹傜殑鍦板潃