锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲日本在线观看视频,亚洲首页在线观看,亚洲国产一区在线http://m.tkk7.com/chou/records of my java learning process zh-cnWed, 14 May 2025 12:41:07 GMTWed, 14 May 2025 12:41:07 GMT60excel鎿嶄綔http://m.tkk7.com/chou/archive/2009/03/10/258909.htmlchouchouTue, 10 Mar 2009 12:27:00 GMThttp://m.tkk7.com/chou/archive/2009/03/10/258909.htmlhttp://m.tkk7.com/chou/comments/258909.htmlhttp://m.tkk7.com/chou/archive/2009/03/10/258909.html#Feedback0http://m.tkk7.com/chou/comments/commentRss/258909.htmlhttp://m.tkk7.com/chou/services/trackbacks/258909.html/**
 * Excel WorkBook瀵硅薄綾?
 * @author zhouqian
 *
 */
public class ExcelWorkBook {
 /** 宸ヤ綔綈?*/
 private static HSSFWorkbook workbook = new HSSFWorkbook();
 
 /** 宸ヤ綔琛?*/
 private HSSFSheet sheet;
 
 /** 琛ㄥご鏁版嵁 */
 private String[] tableHeader;
 
 /**
  * 鏋勯犲嚱鏁?br />   * @param workbookName 宸ヤ綔琛ㄥ悕
  * @param tableHeader 琛ㄥご鏁版嵁
  */
 public ExcelWorkBook(String workbookName, String[] tableHeader) {
  super();
  this.tableHeader = tableHeader;
  sheet = workbook.createSheet(workbookName);
 }
 
 /**
  * 鍒涘緩琛ㄥご
  * @param headerName
  */
 public void createTableHeader(String headerName) {
  HSSFHeader header = sheet.getHeader();
  header.setCenter(headerName);
  HSSFRow headerRow = sheet.createRow(0);
  int cellNumber = tableHeader.length;
  for (int i = 0; i < cellNumber; i++) {
   HSSFCell headerCell = headerRow.createCell((short)i);
   headerCell.setEncoding(HSSFCell.ENCODING_UTF_16);
   headerCell.setCellValue(tableHeader[i]);
  }
 }
 
 /**
  * 鍒涘緩琛?br />   * @param data 瑕佸啓鍏ョ殑鏁版嵁
  * @param rowIndex 絎瑀owIndex琛?
  */
 public void createTableRow(String[] data, int rowIndex) {
  HSSFRow row = sheet.createRow(rowIndex);
  for (int i = 0; i < data.length; i++) {
   HSSFCell cell = row.createCell((short)i);
   cell.setEncoding(HSSFCell.ENCODING_UTF_16);
   cell.setCellValue(data[i]);
  }
  
 }
 
 /**
  * 鍒涘緩鏁翠釜Excel琛?br />   * @param headerName
  */
 public void createExcelSheet(String headerName, String[][] data) {
  this.createTableHeader(headerName);
  
  String[] rowData;
  for (int i = 0; i < data.length; i++) {
   rowData = data[i];
   createTableRow(rowData, i + 1);
  }
  
 }
 
 /**
  * 瀵煎嚭Excel琛ㄦ牸
  * @param os
  * @throws IOException
  */
 public void exportExcel(OutputStream os) throws IOException {
  sheet.setGridsPrinted(true);
  HSSFFooter footer = sheet.getFooter();
  footer.setRight("Page " + HSSFFooter.page() + " of " + HSSFFooter.numPages());
  workbook.write(os);
 }

 public HSSFSheet getSheet() {
  return sheet;
 }

 public void setSheet(HSSFSheet sheet) {
  this.sheet = sheet;
 }

 public String[] getTableHeader() {
  return tableHeader;
 }

 public void setTableHeader(String[] tableHeader) {
  this.tableHeader = tableHeader;
 }
}



chou 2009-03-10 20:27 鍙戣〃璇勮
]]>
閭歡瀹㈡埛绔?/title><link>http://m.tkk7.com/chou/archive/2009/03/10/258908.html</link><dc:creator>chou</dc:creator><author>chou</author><pubDate>Tue, 10 Mar 2009 12:26:00 GMT</pubDate><guid>http://m.tkk7.com/chou/archive/2009/03/10/258908.html</guid><wfw:comment>http://m.tkk7.com/chou/comments/258908.html</wfw:comment><comments>http://m.tkk7.com/chou/archive/2009/03/10/258908.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/chou/comments/commentRss/258908.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/chou/services/trackbacks/258908.html</trackback:ping><description><![CDATA[<p>/**<br />  * 閭歡瀹㈡埛绔?br />  * <br />  * @author zhouqian<br />  * <br />  */<br /> public class MailClient {<br />  /** 鏃ュ織瀹炰緥 */<br />  Log logger = LogFactory.getLog(MailClient.class);</p> <p> /** 娑堟伅瀵硅薄 */<br />  private Message message;</p> <p> /** 閭歡浼氳瘽 */<br />  private Session session;</p> <p> public MailClient() {<br />   super();<br />   this.session = createDefaultSession();<br />  }</p> <p> public MailClient(Session session) {<br />   super();<br />   this.session = session;<br />  }</p> <p> public MailClient(Message message) {<br />   this();<br />   this.message = message;<br />  }</p> <p> public MailClient(Session session, Message message) {<br />   super();<br />   this.session = session;<br />   this.message = message;<br />  }</p> <p> /**<br />   * 鍒涘緩閭歡浼氳瘽<br />   * <br />   * @return<br />   */<br />  protected Session createDefaultSession() {<br />   Properties props = new Properties();<br />   props.put("mail.smtp.host", "smtp.163.com");<br />   props.put("mail.smtp.auth", "true");<br />   Session session = Session.getInstance(props);<br />   session.setDebug(true);<br />   return session;<br />  }</p> <p> /**<br />   * 鍒涘緩綰枃鏈偖浠?br />   * <br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   * @return<br />   * @throws MessagingException<br />   */<br />  protected Message createMimeMessage(String subject, String content,<br />    String recipientTO, String recipientCC, String recipientBCC)<br />    throws MessagingException {<br />   Message message = createBlankMessage(recipientTO, recipientCC,<br />     recipientBCC);</p> <p>  // 璁劇疆閭歡鏍囬<br />   message.setSubject(subject);</p> <p>  // 璁劇疆閭歡鍐呭<br />   message.setText(content);</p> <p>  // 璁劇疆鍙戦佹椂闂?br />   message.setSentDate(new Date(System.currentTimeMillis()));</p> <p>  // 瀛樺偍閭歡淇℃伅<br />   message.saveChanges();</p> <p>  return message;<br />  }</p> <p> /**<br />   * 鍒涘緩甯TML鍐呭鐨勯偖浠?br />   * <br />   * @param subject<br />   * @param content<br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   * @return<br />   * @throws MessagingException<br />   */<br />  protected Message createHTMLMessage(String subject, String content,<br />    String recipientTO, String recipientCC, String recipientBCC)<br />    throws MessagingException {<br />   Message message = createBlankMessage(recipientTO, recipientCC,<br />     recipientBCC);</p> <p>  // 璁劇疆閭歡鏍囬<br />   message.setSubject(subject);</p> <p>  // 璁劇疆鍙戦佹椂闂?br />   message.setSentDate(new Date(System.currentTimeMillis()));</p> <p>  // 鍒涘緩瀛樻斁閭歡鍐呭鐨凚odyPart瀵硅薄<br />   BodyPart bp = new MimeBodyPart();<br />   bp.setContent(content, "text/html;charset=gb2312");</p> <p>  // 鍒涘緩涓涓狹imeMultipart鏉ュ瓨鏀綛odyPart瀵硅薄<br />   Multipart mp = new MimeMultipart();<br />   mp.addBodyPart(bp);</p> <p>  message.setContent(mp);<br />   message.saveChanges();</p> <p>  return message;<br />  }</p> <p> /**<br />   * 鍒涘緩甯﹂檮浠剁殑閭歡<br />   * <br />   * @param subject<br />   * @param content<br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   * @return<br />   * @throws MessagingException<br />   */<br />  protected Message createAttachMessage(String subject, String content,<br />    File attachment, String recipientTO, String recipientCC,<br />    String recipientBCC) throws MessagingException {<br />   Message message = createBlankMessage(recipientTO, recipientCC,<br />     recipientBCC);</p> <p>  // 璁劇疆閭歡鏍囬<br />   message.setSubject(subject);</p> <p>  // 璁劇疆鍙戦佹椂闂?br />   message.setSentDate(new Date(System.currentTimeMillis()));</p> <p>  // 鍒涘緩瀛樻斁閭歡鍐呭鐨凚odyPart瀵硅薄<br />   BodyPart bp = new MimeBodyPart();<br />   bp.setContent(content, "text/html;charset=gb2312");</p> <p>  // 鍒涘緩涓涓狹imeMultipart鏉ュ瓨鏀綛odyPart瀵硅薄<br />   Multipart mp = new MimeMultipart();<br />   mp.addBodyPart(bp);</p> <p>  // 璁劇疆閭歡鐨勯檮浠?br />   bp = new MimeBodyPart();<br />   FileDataSource fds = new FileDataSource(attachment.getName());<br />   DataHandler dh = new DataHandler(fds);<br />   try {<br />    bp.setFileName(new String(attachment.getName().getBytes("gb2312")));<br />   } catch (UnsupportedEncodingException e) {<br />    final String errMess = "Caught exception while encoding file name:"<br />      + attachment.getName();<br />    logger.error(errMess);<br />    throw new MailException(errMess, e);<br />   }<br />   bp.setDataHandler(dh);<br />   mp.addBodyPart(bp);</p> <p>  message.setContent(mp);<br />   message.saveChanges();<br />   return message;<br />  }</p> <p> /**<br />   * 鍒涘緩絀虹櫧閭歡<br />   * <br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   * @return<br />   * @throws MessagingException<br />   */<br />  protected Message createBlankMessage(String recipientTO,<br />    String recipientCC, String recipientBCC) throws MessagingException {<br />   Message message = new MimeMessage(session);</p> <p>  // 璁劇疆鍙戜歡浜?br />   InternetAddress from = new InternetAddress("mfktfp2004@163.com");<br />   message.setFrom(from);</p> <p>  // 璁劇疆鏀朵歡浜?br />   InternetAddress to = new InternetAddress(recipientTO);<br />   message.setRecipient(Message.RecipientType.TO, to);<br />   if (StringUtil.isNotEmpty(recipientCC)) {<br />    InternetAddress cc = new InternetAddress(recipientCC);<br />    message.setRecipient(Message.RecipientType.CC, cc);<br />   }<br />   if (StringUtil.isNotEmpty(recipientBCC)) {<br />    InternetAddress bcc = new InternetAddress(recipientBCC);<br />    message.setRecipient(Message.RecipientType.BCC, bcc);<br />   }</p> <p>  return message;<br />  }</p> <p> /**<br />   * 鍙戦侀偖浠?br />   * <br />   * @param message<br />   * @throws MessagingException<br />   */<br />  public void sendEmail(Message message) throws MessagingException {<br />   // 浠mtp鏂瑰紡鐧婚檰閭<br />   Transport transport = session.getTransport("smtp");<br />   transport.connect("smtp.163.com", "mfktfp2004", "19850921"); // SMTP鍦板潃錛岀敤鎴峰悕錛屽瘑鐮?/p> <p>  // 鍙戦侀偖浠?br />   transport.sendMessage(message, message.getAllRecipients());<br />   transport.close();<br />  }</p> <p> /**<br />   * 鍙戦佺函鏂囨湰閭歡<br />   * <br />   * @param subject<br />   * @param content<br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   */<br />  public void sendMimeEmail(String subject, String content,<br />    String recipientTO, String recipientCC, String recipientBCC) {<br />   Message message = null;<br />   try {<br />    message = createMimeMessage(subject, content, recipientTO,<br />      recipientCC, recipientBCC);<br />    sendEmail(message);<br />   } catch (MessagingException e) {<br />    logger.error("Send mime email failure", e);<br />    throw new MailException("Error sending email, failure", e);<br />   }</p> <p> }</p> <p> /**<br />   * 鍙戦佸甫HTML鍐呭鐨勯偖浠?br />   * <br />   * @param subject<br />   * @param content<br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   */<br />  public void sendHTMLEmail(String subject, String content,<br />    String recipientTO, String recipientCC, String recipientBCC) {<br />   Message message = null;<br />   try {<br />    message = createHTMLMessage(subject, content, recipientTO,<br />      recipientCC, recipientBCC);<br />    sendEmail(message);<br />   } catch (MessagingException e) {<br />    logger.error("Send html email failure", e);<br />    throw new MailException("Error sending email, failure", e);<br />   }<br />  }</p> <p> /**<br />   * 鍙戦佸甫闄勪歡鐨勯偖浠?br />   * <br />   * @param subject<br />   * @param content<br />   * @param recipientTO<br />   * @param recipientCC<br />   * @param recipientBCC<br />   */<br />  public void sendAttachEmail(String subject, String content,<br />    File attachment, String recipientTO, String recipientCC,<br />    String recipientBCC) {<br />   Message message = null;<br />   try {<br />    message = createAttachMessage(subject, content, attachment,<br />      recipientTO, recipientCC, recipientBCC);<br />    sendEmail(message);<br />   } catch (MessagingException e) {<br />    logger.error("Send html email failure", e);<br />    throw new MailException("Error sending email, failure", e);<br />   }<br />  }</p> <p> public Message getMessage() {<br />   return message;<br />  }</p> <p> public void setMessage(Message message) {<br />   this.message = message;<br />  }</p> <p> public Session getSession() {<br />   return session;<br />  }</p> <p> public void setSession(Session session) {<br />   this.session = session;<br />  }<br />  <br />  public static void main(String[] args) {<br />   MailClient client = new MailClient();<br />   client.sendMimeEmail("test", "test", "zhouqian1103@163.com", null, null);<br />  }<br /> }<br /> <br /> <br /> </p> <p>public class MailException extends RuntimeException {<br />  private static final long serialVersionUID = 1L;<br />  <br />  /** Throwable瀹炰緥 */<br />  protected Throwable throwable;<br />  <br />  public MailException() {<br />   super();<br />  }<br />  <br />  public MailException(String message) {<br />   super(message);<br />  }<br />  <br />  public MailException(Throwable cause) {<br />   this.throwable = cause;<br />  }<br />  <br />  public MailException(String message, Throwable cause) {<br />   super(message);<br />   this.throwable = cause;<br />  }<br />  <br />  public void printStackTrace(PrintStream ps) {<br />   super.printStackTrace(ps);<br />   if (throwable != null) {<br />    ps.println("with nested Exception:" + throwable);<br />    throwable.printStackTrace(ps);<br />   }<br />  }<br />  <br />  public void printStackTrace(PrintWriter pw) {<br />   super.printStackTrace(pw);<br />   if (throwable != null) {<br />    pw.println("with nested Exception:" + throwable);<br />    throwable.printStackTrace(pw);<br />   }<br />  }<br />  <br />  public String toString() {<br />   if (throwable == null) {<br />    return super.toString();<br />   } else {<br />    return super.toString() + "with nested exception:" + throwable;<br />   }<br />  }</p> <p> public Throwable getThrowable() {<br />   return throwable;<br />  }<br /> }</p> <p><br /> </p> <img src ="http://m.tkk7.com/chou/aggbug/258908.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/chou/" target="_blank">chou</a> 2009-03-10 20:26 <a href="http://m.tkk7.com/chou/archive/2009/03/10/258908.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Hibernate涓瀵瑰鍙屽悜鍏寵仈鍙奿nverse鐨勪綔鐢?杞?http://m.tkk7.com/chou/archive/2008/09/06/227398.htmlchouchouSat, 06 Sep 2008 06:41:00 GMThttp://m.tkk7.com/chou/archive/2008/09/06/227398.htmlhttp://m.tkk7.com/chou/comments/227398.htmlhttp://m.tkk7.com/chou/archive/2008/09/06/227398.html#Feedback0http://m.tkk7.com/chou/comments/commentRss/227398.htmlhttp://m.tkk7.com/chou/services/trackbacks/227398.html鍦ㄦ祴璇旽ibernate鐨勪竴瀵瑰鍙屽悜鍏寵仈鏄犲皠鏃訛紝紕板埌寰堟湁瓚g殑闂錛岃窡inverse灞炴х洿鎺ョ浉鍏熾?br style="line-height: normal" />
1銆丳eople.hbm.xml

錛渉ibernate-mapping default-lazy="false"錛?span class="Apple-converted-space"> 
錛渃lass name="com.persistent.People" table="people"錛?span class="Apple-converted-space"> 
錛渋d name="id" column="peopleId" unsaved-value="0"錛?span class="Apple-converted-space"> 
錛済enerator class="increment"錛?span class="Apple-converted-space"> 
錛?generator錛?span class="Apple-converted-space"> 
錛?id錛?span class="Apple-converted-space"> 
錛減roperty name="name" column="name"錛烇紲/property錛?span class="Apple-converted-space"> 
錛渟et name="addresses" cascade="save-update"錛?br style="line-height: normal" /> 錛渒ey column="peopleId" not-null="true" /錛?br style="line-height: normal" /> 錛渙ne-to-many class="com.persistent.Address"/錛?br style="line-height: normal" /> 錛?set錛?span class="Apple-converted-space"> 
錛?class錛?br style="line-height: normal" /> 錛?hibernate-mapping錛?br style="line-height: normal" />
2銆丄ddress.hbm.xml

錛渉ibernate-mapping錛?br style="line-height: normal" /> 錛渃lass name="com.persistent.Address" table="address"錛?span class="Apple-converted-space"> 
錛渋d name="id" column="addressId" unsaved-value="0"錛?br style="line-height: normal" /> 錛済enerator class="increment"錛?br style="line-height: normal" /> 錛?generator錛?br style="line-height: normal" /> 錛?id錛?span class="Apple-converted-space"> 
錛渕any-to-one name="people" column="peopleId" insert="false" update="false"錛烇紲/many-to-one錛?span class="Apple-converted-space"> 
錛減roperty name="addressName" column="addressName"錛烇紲/property錛?span class="Apple-converted-space"> 
錛減roperty name="codeNumber" column="codeNumber"錛烇紲/property錛?span class="Apple-converted-space"> 
錛?class錛?span class="Apple-converted-space"> 
錛?hibernate-mapping錛?br style="line-height: normal" /> 3銆丳eople.java鍜孉ddress.java

public class People ...{ 
private long id; 
private String name; 
private Set addresses = new HashSet(); 
...
}

public class Address ...{ 
private long id; 
private People people; 
private String addressName; 
private String codeNumber; 
...
} 

4銆佹暟鎹簱緇撴瀯

people琛細{peopleId,name}

address琛細{addressId,peopleId,addressName,codeNumber}

5銆佹祴璇曚唬鐮?br style="line-height: normal" />
People people = new People(); 
people.setName("linda"); 
Address address = new Address(); 
address.setAddressName("yunnan"); 
address.setCodeNumber("564123"); 
address.setPeople(people); 
people.getAddresses().add(address); 
Session session = HibernateSessionFactory.getSession(); 
session.beginTransaction(); 
session.save(people); 
session.getTransaction().commit(); 

6銆佽繍琛岀粨鏋?br style="line-height: normal" />
銆銆涓婇潰嫻嬭瘯浠g爜榪愯璧鋒潵姝g‘錛?br style="line-height: normal" />
Hibernate: select max(peopleId) from people
Hibernate: select max(addressId) from address
Hibernate: insert into people (name, peopleId) values (?, ?)
Hibernate: insert into address (addressName, codeNumber, peopleId, addressId) values (?, ?, ?, ?)
Hibernate: update address set peopleId=? where addressId=?

銆銆濡傛灉灝哖eople.hbm.xml鏄犲皠鏀瑰啓涓涓嬶細

錛渟et name="addresses" cascade="save-update" inverse="true"錛?br style="line-height: normal" /> 錛渒ey column="peopleId" not-null="true" /錛?br style="line-height: normal" /> 錛渙ne-to-many class="com.persistent.Address"/錛?br style="line-height: normal" /> 錛?set錛?br style="line-height: normal" />
銆銆涓嶅悓涔嬪鍦ㄤ簬娣誨姞浜唅nverse="true"錛岀粨鏋滐細

Hibernate: select max(peopleId) from people
Hibernate: select max(addressId) from address
Hibernate: insert into people (name, peopleId) values (?, ?)
Hibernate: insert into address (addressName, codeNumber, addressId) values (?, ?, ?)

銆銆鍙互鐪嬪埌錛宲eopleId騫舵病鏈夊啓鍏ュ埌鍏寵仈鐨刟ddress褰撲腑錛屾暟鎹簱address琛ㄤ腑鐩稿簲璁板綍鐨刾eopleId瀛楁涓虹┖銆?br style="line-height: normal" />
7銆佸垎鏋?br style="line-height: normal" />
銆銆鍦℉ibernate涓紝鏈inverse鏄弽杞殑鎰忔濓紝鍦ㄥ叧鑱斿叧緋諱腑錛宨nverse="false"涓轟富鎺ф柟錛岀敱涓繪帶鏂硅礋璐g淮鎶ゅ璞$殑鍏寵仈鍏崇郴銆傛墍浠ヤ笂闈㈢殑鏄犲皠鏂囦歡鏀瑰姩涔嬪悗錛宎ddress涓轟富鎺ф柟錛宲eople涓鴻鎺ф柟錛屼絾鏄祴璇曚唬鐮佸彧榪涜浜嗕竴涓繚瀛樻搷浣渟ession.save(people)錛岃繖鏄拡瀵筽eople鐨勶紝鍥犳鏃犳硶姝g‘綰ц仈淇濆瓨address銆傝屽師鏉ョ殑鏄犲皠鏂囦歡涓紙铏界劧娌℃湁鏄庣‘鎸囨槑錛孒ibernate榛樿inverse="false"錛夛紝people涓轟富鎺ф柟錛屽洜姝や繚瀛榩eople鏃跺畠浼氫繚璇佸叧鑱旂殑address鐨勬紜繚瀛樸?br style="line-height: normal" />
銆銆涔熷氨鏄錛孒ibernate浠呬粎鎸夌収涓繪帶鏂瑰璞$殑鐘舵佺殑鍙樺寲鏉ュ悓姝ユ洿鏂版暟鎹簱銆傛寜鐓у師鏉ョ殑鏄犲皠鏂囦歡錛宲eople.getAddresses().add(address)錛屽嵆涓繪帶鏂瑰璞$殑鐘舵佸彂鐢熶簡鏀瑰彉錛屽洜姝ゆ暟鎹簱浼氳窡鐫瀵硅薄鐘舵佺殑鍙樺寲鏉ュ悓姝ユ洿鏂版暟鎹簱錛涜宎ddress.setPeople(people)錛屽嵆琚帶鏂瑰璞$殑鐘舵佸彂鐢熶簡鏀瑰彉錛屽畠鏄笉鑳借Е鍙戝璞″拰鏁版嵁搴撶殑鍚屾鏇存柊鐨勩?/span>

chou 2008-09-06 14:41 鍙戣〃璇勮
]]>
涓嶉敊鐨刯s灞傛晥鏋?/title><link>http://m.tkk7.com/chou/archive/2008/08/28/225254.html</link><dc:creator>chou</dc:creator><author>chou</author><pubDate>Thu, 28 Aug 2008 04:42:00 GMT</pubDate><guid>http://m.tkk7.com/chou/archive/2008/08/28/225254.html</guid><wfw:comment>http://m.tkk7.com/chou/comments/225254.html</wfw:comment><comments>http://m.tkk7.com/chou/archive/2008/08/28/225254.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/chou/comments/commentRss/225254.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/chou/services/trackbacks/225254.html</trackback:ping><description><![CDATA[<p>//淇濈暀鐨勪綅緗?<br /> var saveLeft,saveTop,saveWidth,saveHeight; <br /> var theBody; <br /> var eventType;    //浜嬩歡縐嶇被, "move"銆?resize" <br /> var div; </p> <p><br /> //鍒涘緩騫惰瀹歞iv鐨勫弬鏁?<br /> function setDiv(content) <br /> {<br />  <br />   //闃叉閲嶅鎵撳紑 <br />   if (div) <br />   { <br />    eCloseDiv(); <br />   } <br />   var newLeft,newTop,newWidth,newHeight; <br />   theBody = document.body; <br />    <br />   div = document.createElement("div"); <br />   div.id = "panelDiv"; <br />   div.style.position = "absolute"; <br />   div.style.backgroundColor = "#5F86B5" // 杈規棰滆壊 <br />   div.style.padding = "1px 1px 1px 1px"; <br />   div.style.overflow = "hidden"; <br />   div.style.zIndex = 1; <br />      <br />   //璁懼畾鎵撳紑鐨勫ぇ灝忓拰浣嶇疆 <br />   Function() <br />   { <br />    //榛樿澶у皬榛樿浣嶇疆灞呬腑鎵撳紑  <br />    newWidth = "350px"; <br />    newHeight = "260px"; <br />    newLeft = (theBody.clientWidth - parseInt(newWidth)) / 2 + "px"; <br />    newTop = (theBody.clientHeight - parseInt(newHeight)) / 2 + "px"; <br />    div.style.width = newWidth; <br />    div.style.height = newHeight; <br />    div.style.left = newLeft; <br />    div.style.top = newTop; <br />   } <br />   div = setChild(div,content); <br />   theBody.appendChild(div); <br />    <br /> //  var ipt = document.getElementsByTagName("input"); <br /> //  for(var i = 0; i < ipt.length; i++) <br /> //  { <br /> //   ipt[i].disabled = true; <br /> //  } <br /> } </p> <p>function setChild(div,content) <br /> { <br />   //鍙惁縐誨姩銆佽皟鏁?<br />   var isMove = true<br />   var isResize = true; <br />    <br />   //搴曡壊 <br />   var cDiv = document.createElement; <br />   var backDiv = cDiv("div"); <br />   backDiv.style.cssText = "left: 0px; top: 0px; width: 100%; height: 100%; background-color:#DFE8F6;" ; <br />   div.appendChild(backDiv); <br />    <br />   //鏍囬 <br />   var topDiv = cDiv("div"); <br />   topDiv.style.cssText = "left: 1px; top: 1px; width: 100%; height: 22px; border-bottom:1px solid #5F86B5; position: absolute; background: url(images/bgd.gif) repeat-x; vertical-align: middle; z-index: 5"; <br />   if (isMove) <br />   { <br />    topDiv.style.cursor = "move"; <br />    topDiv.setAttribute("onmousedown", function(){setMove(this)}); <br />   } <br />   else <br />   { <br />    topDiv.style.cursor = "default"; <br />   } <br />   topDiv.innerHTML = "<span style='top: 5px; left:5px; font-size: 12px; font-weight: bold; color: #102548; position: relative;' onselectstart='return false'>榪囨護鎻愮ず</span>"; <br />   div.appendChild(topDiv); <br />    <br />   //鍏抽棴鎸夐挳 <br />   var closeDiv = cDiv("div"); <br />   closeDiv.style.cssText = "right: 8px; top : 4px; width: 16px; height: 16px; position: absolute;  text-align: center; vertical-align: middle; cursor: pointer; z-index:10"; <br />   closeDiv.setAttribute("onclick", function() {eCloseDiv()}); <br />   closeDiv.innerHTML = "<span style='font-size: 12px; font-weight: bold; color: #0E377A;' title='Esc蹇嵎閿?><img src = 'images/close.gif'/></span>"; <br />   div.appendChild(closeDiv); <br />    <br />   //鍐呭 <br />   var contentDiv = cDiv("div"); <br />   contentDiv.style.cssText = "left: 1px; top: 35px; background-color:#DFE8F6; width: 100%; position: absolute; overflow: auto;  padding:5px;"; <br />   contentDiv.style.height = (parseInt(div.style.height) - 40) + "px"; <br />   contentDiv.innerHTML = "<table style='width: 100%; height: 100%; text-align: left; vertical-align: hidden'><tr><td><p>"+content+"</p></td></tr></table>"; <br />   div.appendChild(contentDiv); <br />    <br />   //璋冩暣澶у皬 <br />   var reDiv = cDiv("div"); <br />   reDiv.style.cssText = "right: 0px; bottom: 0px; width: 5px; height: 5px; position: absolute;"; <br />   if (isResize) <br />   { <br />    reDiv.style.cursor = "se-resize"; <br />    reDiv.setAttribute("onmousedown", function(){setResize(this)}); <br />   } <br />   else <br />   { <br />    reDiv.style.cursor = "default"; <br />   } <br />   div.appendChild(reDiv); <br />    <br />   return div; <br /> } </p> <p>var oX, oY, oLeft, oTop, oWidth, oHeight; //瀛樺偍鍘熷縐誨姩鍓嶇殑浣嶇疆 <br /> var divClone, oDiv;   //鍏嬮殕鐨勮妭鐐瑰拰鍘熷鑺傜偣 <br /> var oTime; <br /> //clone鎷栫Щ鐨勮妭鐐?<br /> function setMove(obj) <br /> { <br />   if (event.button == 1) <br />   { <br />    if (oTime) <br />    { <br />     clearTimeout(oTime); <br />     divClone.parentNode.removeChild(divClone); <br />    } <br />    oDiv = obj.parentNode; <br />    divClone = oDiv.cloneNode(true); <br />    divClone.style.filter = "Alpha(opacity=50)"; <br />    divClone.childNodes[1].setAttribute("onmousemove", function(){startMove(this)}); <br />    divClone.childNodes[1].setAttribute("onmouseup", function(){endMove()}); <br />    oX = parseInt(event.clientX); <br />    oY = parseInt(event.clientY); <br />    oLeft = parseInt(divClone.style.left); <br />    oTop = parseInt(divClone.style.top); <br />    document.body.appendChild(divClone); <br />    divClone.childNodes[1].setCapture(); <br />    eventType = "move"; <br />   } <br /> } </p> <p>//鎷栫Щ <br /> function startMove(obj) <br /> { <br />   if (eventType == "move" && event.button == 1) <br />   { <br />    var moveDiv = obj.parentNode; <br />    moveDiv.style.left = (oLeft + event.clientX - oX) + "px"; <br />    moveDiv.style.top = (oTop + event.clientY - oY) + "px"; <br />   } <br /> } </p> <p>//鎷栫Щ緇撴潫璋冪敤鍔ㄧ敾 <br /> function endMove() <br /> { <br />   if (eventType == "move") <br />   { <br />    divClone.childNodes[1].releaseCapture(); <br />             move(parseInt(divClone.style.left), parseInt(divClone.style.top)); <br />    eventType = ""; <br />   } <br /> } </p> <p>//縐誨姩鐨勫姩鐢?<br /> function move(aimLeft, aimTop) <br /> { <br />   var nowLeft = parseInt(oDiv.style.left); <br />   var nowTop = parseInt(oDiv.style.top); <br />   var moveSize = 30; <br />   if (nowLeft > aimLeft + moveSize || nowLeft < aimLeft - moveSize || nowTop > aimTop + moveSize || nowTop < aimTop - moveSize) <br />   { <br />    oDiv.style.left = aimLeft > nowLeft + moveSize ? (nowLeft + moveSize) + "px" : aimLeft < nowLeft - moveSize ? (nowLeft - moveSize) + "px" : nowLeft + "px"; <br />    oDiv.style.top = aimTop > nowTop + moveSize ? (nowTop + moveSize) + "px" : aimTop < nowTop - moveSize ? (nowTop - moveSize) + "px" : nowTop + "px"; <br />    oTime = setTimeout("move(" + aimLeft + ", " + aimTop + ")", 1); <br />   } <br />   else <br />   { <br />    oDiv.style.left = divClone.style.left; <br />    oDiv.style.top = divClone.style.top; <br />    divClone.parentNode.removeChild(divClone); <br />    divClone == null; <br />   } <br /> } </p> <p>//clone璋冩暣澶у皬鐨勮妭鐐?<br /> function setResize(obj) <br /> { <br />   if (event.button == 1) <br />   { <br />    if (oTime) <br />    { <br />     clearTimeout(oTime); <br />     divClone.parentNode.removeChild(divClone); <br />    } <br />    oDiv = obj.parentNode; <br />    divClone = oDiv.cloneNode(true); <br />    divClone.style.filter = "Alpha(opacity=50)"; <br />    divClone.childNodes[4].setAttribute("onmousemove", function(){startResize(this)}); <br />    divClone.childNodes[4].setAttribute("onmouseup", function(){endResize()}); <br />    oX = parseInt(event.clientX); <br />    oY = parseInt(event.clientY); <br />    oWidth = parseInt(divClone.style.width); <br />    oHeight = parseInt(divClone.style.height); <br />    document.body.appendChild(divClone); <br />    divClone.childNodes[4].setCapture(); <br />    eventType = "resize"; <br />   } <br /> } </p> <p>//鎷栧姩璋冩暣澶у皬 <br /> function startResize(obj) <br /> { <br />   if (eventType == "resize" && event.button == 1) <br />   { <br />    var nX = event.clientX; <br />    var nY = event.clientY; <br />    if (nX > oX - oWidth && nY > oY - oHeight + 40) <br />    { <br />     var resizeDiv = obj.parentNode; <br />     resizeDiv.style.width = (oWidth + event.clientX - oX) + "px"; <br />     resizeDiv.style.height = (oHeight + event.clientY - oY) + "px"; <br />     resizeDiv.childNodes[3].style.height = (parseInt(resizeDiv.style.height) - 40) + "px"; <br />    } <br />   } <br /> } </p> <p>//璋冩暣澶у皬緇撴潫 <br /> function endResize() <br /> { <br />   if (eventType == "resize") <br />   { <br />    divClone.childNodes[4].releaseCapture(); <br />             resize(parseInt(divClone.style.width), parseInt(divClone.style.height)); <br />    eventType = ""; <br />   } <br /> } </p> <p>//璋冩暣澶у皬鐨勫姩鐢?<br /> function resize(aimWidth, aimHeight) <br /> { <br />   var nowWidth = parseInt(oDiv.style.width); <br />   var nowHeight = parseInt(oDiv.style.height); <br />   var resizeSize = 30; <br />   if (nowWidth > aimWidth + resizeSize || nowWidth < aimWidth - resizeSize || nowHeight > aimHeight + resizeSize || nowHeight < aimHeight - resizeSize) <br />   { <br />    oDiv.style.width = aimWidth > nowWidth + resizeSize ? (nowWidth + resizeSize) + "px" : aimWidth < nowWidth - resizeSize ? (nowWidth - resizeSize) + "px" : nowWidth + "px"; <br />    oDiv.style.height = aimHeight > nowHeight + resizeSize ? (nowHeight + resizeSize) + "px" : aimHeight < nowHeight - resizeSize ? (nowHeight - resizeSize) + "px" : nowHeight + "px"; <br />    oDiv.childNodes[3].style.height = (parseInt(oDiv.style.height) - 40) + "px"; <br />    oTime = setTimeout("resize(" + aimWidth + ", " + aimHeight + ")", 1); <br />   } <br />   else <br />   { <br />    oDiv.style.width = divClone.style.width; <br />    oDiv.style.height = divClone.style.height; <br />    oDiv.childNodes[3].style.height = (parseInt(oDiv.style.height) - 40) + "px"; <br />    divClone.parentNode.removeChild(divClone); <br />    divClone == null; <br />   } <br /> } </p> <p>//鍏抽棴DIV <br /> function eCloseDiv() <br /> {  <br />  <br />   if (div) <br />   { <br />    div.parentNode.removeChild(div); <br /> //   var ipt = document.getElementsByTagName("input"); <br /> //   for(var i = 0; i < ipt.length; i++) <br /> //   { <br /> //    ipt[i].disabled = false; <br /> //   } <br />    div = null; <br />   } <br /> } </p> <p>//淇濈暀浣嶇疆鍜屽ぇ灝?<br /> function saveDiv() <br /> { <br />   if (div) <br />   { <br />    saveLeft = div.style.left; <br />    saveTop = div.style.top; <br />    saveWidth = div.style.width; <br />    saveHeight = div.style.height; <br />   } <br /> } </p> <p>//蹇嵎閿?<br /> document.onkeydown = function() <br /> { <br />   event.keyCode == 27 ? eCloseDiv() : null;  //Esc蹇嵎閿?<br />   event.ctrlKey && (event.keyCode == 83 || event.keyCode == 115) ? saveDiv() : null; //ctrl+s淇濆瓨浣嶇疆 <br />   event.ctrlKey && event.keyCode == 13 ? setDiv() : null //ctrl+enter鎵撳紑Div <br />   !event.ctrlKey && (event.keyCode == 37 || event.keyCode == 38 || event.keyCode == 39 || event.keyCode == 40) ? arrowMove(event.keyCode) : null; <br />   event.ctrlKey && (event.keyCode == 37  || event.keyCode == 38 || event.keyCode == 39 || event.keyCode == 40) ? arrowResize(event.keyCode) : null; <br /> } </p> <p>// 鍗曞嚮灞備互澶栫殑鍦版柟闅愯棌灞?br /> document.onclick = function()<br /> {<br />   if (div)<br />   {<br />       if(typeof event.srcElement.message == "undefined")<br />    {<br />      if (div.componentFromPoint(event.clientX,event.clientY)=="outside")<br />      {<br />      eCloseDiv();<br />       <br />      }<br />    } <br />   }<br /> }</p> <p>//涓婁笅宸﹀彸綆ご縐誨姩div <br /> function arrowMove(eKeyCode) <br /> { <br />   if (div) <br />   { <br />    var isMove = document.getElementById("isMove").checked; <br />    if (isMove) <br />    { <br />     switch(eKeyCode) <br />     { <br />      case 37: <br />       div.style.left = (parseInt(div.style.left) - 1) + "px"; //left <br />       break <br />      case 38: <br />       div.style.top = (parseInt(div.style.top) - 1) + "px"; //up <br />       break <br />      case 39: <br />       div.style.left = (parseInt(div.style.left) + 1) + "px"; //right <br />       break <br />      case 40: <br />       div.style.top = (parseInt(div.style.top) + 1) + "px"; //down <br />       break <br />     } <br />    } <br />   } <br /> } </p> <p>//ctrl+涓婁笅宸﹀彸綆ご璋冩暣div澶у皬 <br /> function arrowResize(eKeyCode) <br /> { <br />   if (div) <br />   { <br />    var isResize = document.getElementById("isResize").checked; <br />    if (isResize) <br />    { <br />     switch(eKeyCode) <br />     { <br />      case 37: <br />       div.style.width = (parseInt(div.style.width) - 1) + "px"; //left <br />       break <br />      case 38: <br />       div.style.height = (parseInt(div.style.height) - 1) + "px"; //up <br />       break <br />      case 39: <br />       div.style.width = (parseInt(div.style.width) + 1) + "px"; //right <br />       break <br />      case 40: <br />       div.style.height = (parseInt(div.style.height) + 1) + "px"; //down <br />       break <br />     } <br />    } <br />   } <br /> } <br /> </p> <img src ="http://m.tkk7.com/chou/aggbug/225254.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/chou/" target="_blank">chou</a> 2008-08-28 12:42 <a href="http://m.tkk7.com/chou/archive/2008/08/28/225254.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>xml鎻愪氦鏁版嵁http://m.tkk7.com/chou/archive/2008/08/28/225252.htmlchouchouThu, 28 Aug 2008 04:37:00 GMThttp://m.tkk7.com/chou/archive/2008/08/28/225252.htmlhttp://m.tkk7.com/chou/comments/225252.htmlhttp://m.tkk7.com/chou/archive/2008/08/28/225252.html#Feedback1http://m.tkk7.com/chou/comments/commentRss/225252.htmlhttp://m.tkk7.com/chou/services/trackbacks/225252.html鍓嶅彴錛?br />      var url = "filter.do?action=filter";
     var xmlDocument = XmlDocument.create();
     var filterInfo = xmlDocument.createElement("filterInfo");
     xmlDocument.appendChild(filterInfo);
     appendSimpleChildNode(xmlDocument, filterInfo, "type", type);
     appendSimpleChildNode(xmlDocument, filterInfo, "condition", condition);  
     xmlHttp = XmlHttp.create();
     xmlHttp.open("POST", url, false);
     xmlHttp.send(xmlDocument.xml);
     var xmlString = xmlHttp.responseText;
     return xmlString;

鍚庡彴錛?/p>

        SAXBuilder saxb = new SAXBuilder();
        Document doc = saxb.build(request.getInputStream());
        Element root = doc.getRootElement();
        String type = root.getChildText("type");
        String inputCondition = root.getChildText("condition");
       



chou 2008-08-28 12:37 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 图图资源网亚洲综合网站| 亚洲国产精品自在拍在线播放| 免费视频成人片在线观看| 精品一区二区三区免费毛片爱| 成熟女人特级毛片www免费| 亚洲精品乱码久久久久久蜜桃 | 亚洲不卡1卡2卡三卡2021麻豆| 久久精品亚洲日本波多野结衣| 91av免费在线视频| 久久精品国产免费观看三人同眠| 日韩一区二区在线免费观看| 亚洲av永久无码制服河南实里| MM1313亚洲国产精品| 亚洲AV中文无码乱人伦在线视色| 三级片免费观看久久| 曰曰鲁夜夜免费播放视频| 中文字幕亚洲一区二区三区| 亚洲综合一区二区三区四区五区| 成年免费a级毛片免费看无码| 成人毛片免费观看视频大全| 亚洲av无码专区首页| 99久久99这里只有免费费精品| 国产亚洲精AA在线观看SEE| 亚洲成年网站在线观看| 99re免费视频| 久久亚洲国产成人影院| 免费午夜爽爽爽WWW视频十八禁 | 精品国产日韩亚洲一区在线| 亚洲片一区二区三区| 久久综合给合久久国产免费| 亚洲人成色77777在线观看| 4399好看日本在线电影免费| 在线观看国产一区亚洲bd| 久久精品国产精品亚洲精品 | 亚洲成在人线中文字幕| 精品成人免费自拍视频| 免费一级毛片在线观看| 日本视频免费高清一本18| 亚洲人成人一区二区三区| 一区二区三区免费视频观看| 免费一级毛片不卡在线播放 |