锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲ⅴ国产v天堂a无码二区,亚洲AV成人精品网站在线播放,亚洲AV日韩综合一区http://m.tkk7.com/yidishui/java 2006騫?鏈堟柊寮濮?)zh-cnSun, 11 May 2025 03:56:34 GMTSun, 11 May 2025 03:56:34 GMT60Struts 涓枃涔辯爜闂 Filter瑙e喅http://m.tkk7.com/yidishui/archive/2006/09/08/68581.html涓婊存按涓婊存按Fri, 08 Sep 2006 10:41:00 GMThttp://m.tkk7.com/yidishui/archive/2006/09/08/68581.htmlhttp://m.tkk7.com/yidishui/comments/68581.htmlhttp://m.tkk7.com/yidishui/archive/2006/09/08/68581.html#Feedback1http://m.tkk7.com/yidishui/comments/commentRss/68581.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/68581.html榪欎釜涔熶笉鐭ラ亾鏉ヨ嚜緗戜笂閭i噷錛岃嚜宸辯敤榪囦簡錛屾渶榪戞暣鐞嗚祫鏂欒褰曚笅鏉?/p>

鍘熺悊寰堢畝鍗曞氨鏄嬌鐢‵ilter澶勭悊璁劇疆鐨勮姹傜殑 CharacterEncoding

鍏蜂綋瀹炵幇Filter

package yidishui.util;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
public class EncodingFilter implements Filter {
/**
* The default character encoding to set for requests that pass through this
* filter.
*/
protected String encoding = null;
/**
* The filter configuration object we are associated with. If this value is
* null, this filter instance is not currently configured.
*/
protected FilterConfig filterConfig = null;
/**
* Should a character encoding specified by the client be ignored?
*/
protected boolean ignore = true;
// --------------------------------------------------------- Public Methods
/**
* Take this filter out of service.
*/
public void destroy() {
this.encoding = null;
this.filterConfig = null;
}
/**
* Select and set (if specified) the character encoding to be used to
* interpret request parameters for this request.
*
* @param request The servlet request we are processing
* @param response The servlet response we are creating
* @param chain The filter chain we are processing
* @throws IOException if an input/output error occurs
* @throws ServletException if a servlet error occurs
*/
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
// Conditionally select and set the character encoding to be used
if (ignore || (request.getCharacterEncoding() == null)) {
String encoding = selectEncoding(request);
if (encoding != null)
request.setCharacterEncoding(encoding);
}
// Pass control on to the next filter
chain.doFilter(request, response);
}
/**
* Place this filter into service.
*
* @param filterConfig The filter configuration object
*/
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
this.encoding = filterConfig.getInitParameter("encoding");
String value = filterConfig.getInitParameter("ignore");
if (value == null)
this.ignore = true;
else if (value.equalsIgnoreCase("true"))
this.ignore = true;
else if (value.equalsIgnoreCase("yes"))
this.ignore = true;
else
this.ignore = false;
}
// ------------------------------------------------------ Protected Methods
/**
* Select an appropriate character encoding to be used, based on the
* characteristics of the current request and/or filter initialization
* parameters. If no character encoding should be set, return
* <code>null</code>.
* <p/>
* The default implementation unconditionally returns the value configured
* by the <strong>encoding</strong> initialization parameter for this
* filter.
*
* @param request The servlet request we are processing
* @return return encoding
*/
protected String selectEncoding(ServletRequest request) {
return (this.encoding);
}
}// EOC
 

2.鍏蜂綋web.xml閰嶇疆

<filter>
<filter-name>EncodingFilter</filter-name>
<filter-class>yidishui.util.EncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>ignore</param-name>
<param-value>yes</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>EncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


涓婊存按 2006-09-08 18:41 鍙戣〃璇勮
]]>
An Introduction To JSTLhttp://m.tkk7.com/yidishui/archive/2006/08/21/64835.html涓婊存按涓婊存按Mon, 21 Aug 2006 09:20:00 GMThttp://m.tkk7.com/yidishui/archive/2006/08/21/64835.htmlhttp://m.tkk7.com/yidishui/comments/64835.htmlhttp://m.tkk7.com/yidishui/archive/2006/08/21/64835.html#Feedback0http://m.tkk7.com/yidishui/comments/commentRss/64835.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/64835.html闃呰鍏ㄦ枃

涓婊存按 2006-08-21 17:20 鍙戣〃璇勮
]]>
FCKEditor 鍦↗SP涓嬌鐢?/title><link>http://m.tkk7.com/yidishui/archive/2006/08/17/64121.html</link><dc:creator>涓婊存按</dc:creator><author>涓婊存按</author><pubDate>Thu, 17 Aug 2006 06:25:00 GMT</pubDate><guid>http://m.tkk7.com/yidishui/archive/2006/08/17/64121.html</guid><wfw:comment>http://m.tkk7.com/yidishui/comments/64121.html</wfw:comment><comments>http://m.tkk7.com/yidishui/archive/2006/08/17/64121.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/yidishui/comments/commentRss/64121.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/yidishui/services/trackbacks/64121.html</trackback:ping><description><![CDATA[FCKEditor 鍦↗SP涓嬌鐢?<br />1.涓嬭澆FCKEditor2.3.1<br />2.涓嬭澆FCKeditor.Java<br />====================<br />娓呯悊FCKEdior:<br />聽 1>鍒犻櫎 _samples 閲岄潰鏄緥瀛?_testcases 嫻嬭瘯 瑕佹洿璇︾粏楂樼駭浣跨敤鏌ヤ緥瀛愬拰嫻嬭瘯,榪樻湁涓涓嬫枃浠朵笉鐢ㄧ殑鍒犻櫎<br />聽 2>鍒犻櫎 editor\_source 鍙兘鏄簮浠g爜鎶?娌℃湁浠旂粏鐮旂┒<br />聽 3> editor\filemanager\browser\default\connectors 鍒犻櫎,浣跨敤鐨勬槸servlet鏉ユ搷浣滅殑(浣跨敤鍏跺畠璇█鐨勮瘽灝辮鏍規嵁鎯呭喌澶勭悊浜?<br />聽聽聽聽 editor\filemanager\upload 鍒犻櫎,鍚屾牱浣跨敤鐨勬槸servlet<br />聽 4>editor\lang 璇█鏂囦歡,鏍規嵁鍏蜂綋搴旂敤澶勭悊<br />聽 5>editor\skins聽 鍒犻櫎涓嶆槸鐢ㄧ殑skins<br />====================<br />鍩烘湰浣跨敤:<br />1>鎶奆CKEdior鎷瘋礉鍒版牴鐩綍<br />2>鎷瘋礉FCKeditor.Java 渚嬪瓙閲岄潰鐨凢CKeditor-2.3.jar鏂囦歡<br />3>淇敼fckconfig.js<br /><div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">聽聽FCKConfig.DefaultLanguage聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽'zh</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">cn'聽榛樿璇█<br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽FCKConfig.ToolbarSets[</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Default</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">]聽璁劇疆宸ュ叿鏍?br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽聽FCKConfig.ContextMenu聽璁劇疆涓婁笅鏂囪彍鍗?br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span></div>聽聽涓嬮潰榪樻湁濂藉,鍙互鏍規嵁鍏蜂綋鎯呭喌淇敼<br />4>jsp欏甸潰浣跨敤:<br />聽鎷瘋礉涓涓緥瀛愬氨鍙互浜?<br />聽璇存槑:oFCKeditor.setBasePath("FCKeditor/");榪欎釜璺緞鐨勬牴鎹綘鐨勫叿浣撹礬寰勫彉鍖?br />=====================<br />鏀寔涓婁紶鍔熻兘<br />1>娣誨姞:commons-fileupload.jar<br />2>淇敼Web.xml 鍏蜂綋鍦‵CKeditor.Java鏈変緥瀛?br />聽璇存槑:baseDir涓婁紶鏂囦歡淇濆瓨璺緞<br />聽聽聽聽聽 SimpleUploader涓嬬殑 enabled 鏄惁寮鍚笂浼犲姛鑳?br />聽聽聽聽聽 <url-pattern> 鏍規嵁鍏蜂綋搴旂敤榪涜淇敼<br />3>淇敼:fckconfig.js<br />聽 <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">FCKConfig.LinkBrowserURL聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽FCKConfig.BasePath聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽'filemanager</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">browser</span><span style="COLOR: #000000">/</span><span style="COLOR: #0000ff">default</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">browser.html</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">Connector</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">connectors</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">jsp</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">connector';<br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽FCKConfig.ImageBrowserURL聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽FCKConfig.BasePath聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽'filemanager</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">browser</span><span style="COLOR: #000000">/</span><span style="COLOR: #0000ff">default</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">browser.html</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">Type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Image</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">Connector</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">connectors</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">jsp</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">connector';<br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽FCKConfig.FlashBrowserURL聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽FCKConfig.BasePath聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽'filemanager</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">browser</span><span style="COLOR: #000000">/</span><span style="COLOR: #0000ff">default</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">browser.html</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">Type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Flash</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">Connector</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Connector</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">connectors</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">jsp</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">connector';<br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽FCKConfig.LinkUploadURL聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽FCKConfig.BasePath聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽'filemanager</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">upload</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">simpleuploader</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">Type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">File';<br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽FCKConfig.ImageUploadURL聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽FCKConfig.BasePath聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽'filemanager</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">upload</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">simpleuploader</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">Type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Image'聽;<br /><img src="http://m.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽FCKConfig.FlashUploadURL聽</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">聽FCKConfig.BasePath聽</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">聽'filemanager</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">upload</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">simpleuploader</span><span style="COLOR: #000000">?</span><span style="COLOR: #000000">Type</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">Flash'聽;</span></div><br />聽<br />聽璇存槑:瑕佸拰web.xml 鐨?url-pattern 鐩稿搴?Type=*** 瑕佸搴?br /><br />瀹屾垚!<img src ="http://m.tkk7.com/yidishui/aggbug/64121.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/yidishui/" target="_blank">涓婊存按</a> 2006-08-17 14:25 <a href="http://m.tkk7.com/yidishui/archive/2006/08/17/64121.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Ibtis鍩烘湰閰嶇疆--[娣誨姞ibatis Dao鏀寔]http://m.tkk7.com/yidishui/archive/2006/07/19/59024.html涓婊存按涓婊存按Wed, 19 Jul 2006 09:06:00 GMThttp://m.tkk7.com/yidishui/archive/2006/07/19/59024.htmlhttp://m.tkk7.com/yidishui/comments/59024.htmlhttp://m.tkk7.com/yidishui/archive/2006/07/19/59024.html#Feedback0http://m.tkk7.com/yidishui/comments/commentRss/59024.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/59024.html闃呰鍏ㄦ枃

涓婊存按 2006-07-19 17:06 鍙戣〃璇勮
]]>
Ibatis鍩烘湰閰嶇疆---[鐜鎼緩]http://m.tkk7.com/yidishui/archive/2006/07/19/59021.html涓婊存按涓婊存按Wed, 19 Jul 2006 08:54:00 GMThttp://m.tkk7.com/yidishui/archive/2006/07/19/59021.htmlhttp://m.tkk7.com/yidishui/comments/59021.htmlhttp://m.tkk7.com/yidishui/archive/2006/07/19/59021.html#Feedback4http://m.tkk7.com/yidishui/comments/commentRss/59021.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/59021.html闃呰鍏ㄦ枃

涓婊存按 2006-07-19 16:54 鍙戣〃璇勮
]]>
璇誨彇璧勬簮鏂囦歡http://m.tkk7.com/yidishui/archive/2006/07/18/58841.html涓婊存按涓婊存按Tue, 18 Jul 2006 12:17:00 GMThttp://m.tkk7.com/yidishui/archive/2006/07/18/58841.htmlhttp://m.tkk7.com/yidishui/comments/58841.htmlhttp://m.tkk7.com/yidishui/archive/2006/07/18/58841.html#Feedback1http://m.tkk7.com/yidishui/comments/commentRss/58841.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/58841.html
driver=org.hsqldb.jdbcDriver
url=jdbc:hsqldb:mem:jpetstore
username=sa
password=

java浠g爜
聽聽聽聽聽 Properties聽props聽=聽Resources.getResourceAsProperties("properties/database.properties");
聽聽聽聽聽聽String聽url聽
=聽props.getProperty("url");
聽聽聽聽聽聽String聽driver聽
=聽props.getProperty("driver");
聽聽聽聽聽聽String聽username聽
=聽props.getProperty("username");
聽聽聽聽聽聽String聽password聽
=聽props.getProperty("password");



涓婊存按 2006-07-18 20:17 鍙戣〃璇勮
]]>
hibernate Hql 涓嶆敮鎸佷腑鏂囬棶棰橈紒錛?/title><link>http://m.tkk7.com/yidishui/archive/2006/02/19/31532.html</link><dc:creator>涓婊存按</dc:creator><author>涓婊存按</author><pubDate>Sun, 19 Feb 2006 10:16:00 GMT</pubDate><guid>http://m.tkk7.com/yidishui/archive/2006/02/19/31532.html</guid><wfw:comment>http://m.tkk7.com/yidishui/comments/31532.html</wfw:comment><comments>http://m.tkk7.com/yidishui/archive/2006/02/19/31532.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/yidishui/comments/commentRss/31532.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/yidishui/services/trackbacks/31532.html</trackback:ping><description><![CDATA[<span id="btbx1dp" class=postbody><FONT size=2>   hibernate3.0.2涓墽琛屽涓嬬殑錛?<BR><SPAN style="FONT-WEIGHT: bold">from Persion p where p.name='寮犱笁'</SPAN>log淇℃伅,'寮犱笁'鍦ㄨ繖鏉sql杞垚sql鐨勬椂鍊欏彉鎴愪簡涔辯爜<BR><BR>瑙e喅鏂規硶錛氬崌綰у埌 Hibernate3.1 rc2 ! 鍙渶瑕佹浛鎹?hibernate3.jar 鏂囦歡灝卞彲浠ヤ簡!</FONT></SPAN><img src ="http://m.tkk7.com/yidishui/aggbug/31532.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/yidishui/" target="_blank">涓婊存按</a> 2006-02-19 18:16 <a href="http://m.tkk7.com/yidishui/archive/2006/02/19/31532.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>POI闂璁板綍http://m.tkk7.com/yidishui/archive/2006/02/15/30725.html涓婊存按涓婊存按Tue, 14 Feb 2006 17:51:00 GMThttp://m.tkk7.com/yidishui/archive/2006/02/15/30725.htmlhttp://m.tkk7.com/yidishui/comments/30725.htmlhttp://m.tkk7.com/yidishui/archive/2006/02/15/30725.html#Feedback0http://m.tkk7.com/yidishui/comments/commentRss/30725.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/30725.html闂錛欻SSFSheet sheet1 = wb.createSheet("涓枃涔辯爜");
鏃墮棿錛?006-2-10
瑙e喅鏂規硶錛?nbsp;    

HSSFSheet sheet = wb.createSheet();// 寤虹珛鏂扮殑sheet瀵硅薄
        wb.setSheetName(0"瀛︾敓鍩烘湰淇℃伅", (short1);

*********************************************



涓婊存按 2006-02-15 01:51 鍙戣〃璇勮
]]>
jsf Hssf 鍒涘緩騫朵笅杞?M$ Excelhttp://m.tkk7.com/yidishui/archive/2006/01/21/28851.html涓婊存按涓婊存按Fri, 20 Jan 2006 18:29:00 GMThttp://m.tkk7.com/yidishui/archive/2006/01/21/28851.htmlhttp://m.tkk7.com/yidishui/comments/28851.htmlhttp://m.tkk7.com/yidishui/archive/2006/01/21/28851.html#Feedback0http://m.tkk7.com/yidishui/comments/commentRss/28851.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/28851.html鍦╦sf涓氳繃FacesContext璁塊棶涓婁笅鏂囷紱
Hssf閫氳繃 HSSFWorkbook 鍚戣緭鍑烘祦鍐欏叆錛?BR>鍏蜂綋浠g爜錛?BR>
Bean錛?/P>
public class TestBean {
    
public String action() {
        HSSFWorkbook wb 
= new HSSFWorkbook();
        FacesContext context
=FacesContext.getCurrentInstance();
        HttpServletResponse response 
= (HttpServletResponse) context.getExternalContext().getResponse();
        response.reset();
        response.setContentType(
"application/ms-excel");
        
try {
            response.setHeader(
"Content-disposition""attachment;filename="+new String("涓嬭澆Excel.xls".getBytes(),"iso-8859-1"));
            wb.write(response.getOutputStream());
        }
 catch (Exception e1) {
            
// TODO Auto-generated catch block
            e1.printStackTrace();
        }

        FacesContext.getCurrentInstance().responseComplete();
        
return null;
    }

}

浠ヤ笂鍙槸涓涓┖鐨勭畝鍗曠殑Excel 鍏蜂綋鎬庝箞鍒涘緩絎﹀悎欏圭洰瑕佹眰鐨勫弬鐪嬶細HSSF GUIDE錛?BR>faces-config.xml:
<managed-bean>
        
<managed-bean-name>test</managed-bean-name>
        
<managed-bean-class>yds.study.web.TestBean</managed-bean-class>
        
<managed-bean-scope>session</managed-bean-scope>
    
</managed-bean>
jsp錛?BR>
<f:view>
    
<h:form>
        
<h:commandButton id="button" value="涓嬭澆" rendered="true"
            action
="#{test123.action}" />
    
</h:form>
</f:view>

ok榪欐牱灝卞彲浠ヤ簡;)

涓婊存按 2006-01-21 02:29 鍙戣〃璇勮
]]>
Jakata Poi HSSF錛氱函Java鐨凟xcel瑙e喅鏂規 [zz]http://m.tkk7.com/yidishui/archive/2006/01/20/28776.html涓婊存按涓婊存按Fri, 20 Jan 2006 05:52:00 GMThttp://m.tkk7.com/yidishui/archive/2006/01/20/28776.htmlhttp://m.tkk7.com/yidishui/comments/28776.htmlhttp://m.tkk7.com/yidishui/archive/2006/01/20/28776.html#Feedback0http://m.tkk7.com/yidishui/comments/commentRss/28776.htmlhttp://m.tkk7.com/yidishui/services/trackbacks/28776.html
       鍦ㄦ垜浠疄闄呯殑寮鍙戜腑錛岃〃鐜板眰鐨勮В鍐蟲柟妗堣櫧鐒舵湁澶氭牱錛屼絾鏄疘E嫻忚鍣ㄥ凡鎴愪負鏈澶氫漢浣跨敤鐨勬祻瑙堝櫒錛屽洜涓哄ぇ瀹墮兘鐢╓indows銆傚湪浼佷笟鍔炲叕緋葷粺涓紝甯稿父鏈夊鎴瘋繖鏍峰瓙瑕佹眰錛氫綘瑕佹妸鎴戜滑鐨勬姤琛ㄧ洿鎺ョ敤Excel鎵撳紑銆?BR>
鎴栬呮槸錛氭垜浠凡緇忎範鎯敤Excel鎵撳嵃銆傝繖鏍峰瓙濡傛灉鐢?net寮鍙戞槸娌℃湁闂鐨勶紝浣嗘槸鏈塉2EE榪欎釜姣?net鏇存湁鍓嶉旂殑寮鏀懼紡鐨勫紑鍙戠幆澧冿紝闅鵑亾鎴戜負浜嗚В鍐蟲墦鍗扮殑瑕佹眰鍘誨彟鍐欏鎴風鐨勬帶浠訛紵鎴栬呭湪鏈嶅姟鍣ㄧ浣跨敤鏈湴浠g爜錛熺涓縐嶆柟妗堢殑闂鏄叧閿暟鎹殑澶勭悊鏈夋椂鍊欎笉鑳藉湪瀹㈡埛绔仛錛岀2縐嶆柟妗堢殑闂鏄壓鐗蹭簡浠g爜鐨勫彲縐繪鎬у拰紼沖畾鎬с傚鏋滆瀹㈡埛绔彧璐熻矗澶勭悊鐢熸垚濂界殑鎶ヨ〃錛岄偅灝嗘槸涓縐嶈浜虹殑閫夋嫨銆?BR>
Apache鐨凧akata欏圭洰鐨凱OI瀛愰」鐩紝鐩爣鏄鐞唎le2瀵硅薄銆傜洰鍓嶆瘮杈冩垚鐔熺殑鏄疕SSF鎺ュ彛錛屽鐞哅S Excel錛?7-2002錛夊璞°傚畠涓嶈薄鎴戜滑浠呬粎鏄敤csv鐢熸垚鐨勬病鏈夋牸寮忕殑鍙互鐢盓xcel杞崲鐨勪笢瑗匡紝鑰屾槸鐪熸鐨凟xcel瀵硅薄錛屼綘鍙互鎺у埗涓浜涘睘鎬уsheet,cell絳夌瓑銆?BR>
榪欐槸涓涓勾杞葷殑欏圭洰錛屾墍浠ヨ薄HDF榪欐牱鐩存帴鏀寔Word瀵硅薄鐨勫ソ涓滆タ浠嶇劧鍦ㄨ璁′腑銆傚叾瀹冩敮鎸亀ord鏍煎紡鐨勭函Java鏂規榪樻湁itext錛屼笉榪囦篃鏄粛鍦ㄥ鏂椾腑銆備絾鏄疕SSF宸茬粡鎴愮啛鍒拌兘澶熷拰瓚沖鎴戜滑浣跨敤浜嗐?BR>
鍏跺疄錛屼粠寮鍙戝巻鍙茬殑瑙掑害璁詫紝鍦?0騫翠唬涓湡starOffice鐨勫師浣滆呭湪寰峰浗鎴愮珛浜哠tarOffice suite鍏徃錛岀劧鍚庡埌1999騫村澶﹕tarOffice琚玸un鏀惰喘錛屽啀鍒?000騫?鏈坰tarOffice5.2鐨勫彂甯冿紱騫朵笖浠巗tarOffice6.0寮濮嬶紝starOffice寤虹珛鍦∣penOffice鐨刟pi鐨勫熀紜涓婏紝榪欎釜鍏紑浠g爜鐨刼ffice欏圭洰宸茬粡榪涜浜嗗緢闀跨殑鏃墮棿銆傝櫧鐒墮偅鏄敱C++鍐欑殑錛屼絾鏄疨OI鐨勪唬鐮侀儴鍒嗕篃鏄敱openOffice鏀硅繃鏉ョ殑銆傛墍浠ワ紝搴旇瀵筆OI鍏呮弧瓚沖鐨勪俊蹇冦傚浗鍐呭凡緇忔湁閮ㄥ垎鍏徃鍦ㄤ粬浠殑鍔炲叕鑷姩鍖栫瓑Web欏圭洰涓嬌鐢╬oi浜嗭紝濡傛棩鎭掔殑ioffice錛屾搗娉扮殑HTOffice絳夈?BR>
Java褰撳垵鎶婃牳蹇冨鐞嗚鎴怳nicode錛屽甫鏉ョ殑濂藉鏄彟浠g爜閫傚簲浜嗗璇█鐜銆傜劧鑰岀敱浜庤佸鐨勮嫳璇彧鏈?6涓瓧姣嶏紝鏈変簺鎯呭喌涓嬶紝涓浜涚▼搴忓憳鐢?浣嶇殑byte澶勭悊錛屼竴涓嶅皬蹇冨氨鍘繪帀浜咰JK鐨勯珮浣嶃傛垨鑰呮槸鐢變簬涔犳儻鍦ㄧ▼搴忎腑閲囩敤紜紪鐮侊紝榪樻湁澶氱鍘熷洜錛屼嬌寰楄澶欽ava搴旂敤鍦–JK鐨勫鐞嗕笂寰堢儲鎭箋傝繕濂藉湪POI HSSF涓冭檻鍒拌繖涓棶棰橈紝鍙互璁劇疆encoding涓哄弻瀛楄妭銆?BR>
POI鍙互鍒皐ww.apache.org涓嬭澆鍒般傜紪璇戝ソ鐨刯ar涓昏鏈夎繖鏍?涓細poi鍖?poi Browser鍖?poi hdf鍖?poi hssf渚嬬▼鍖呫傚疄闄呰繍琛屾椂錛岄渶瑕佹湁poi鍖呭氨鍙互浜嗐?BR>
濡傛灉鐢↗akarta ant緙栬瘧鍜岃繍琛岋紝涓嬭澆apache Jakarta POI鐨剅elease涓殑src鍖咃紝瀹冮噷闈㈠凡緇忎負浣犵敓鎴愬ソ浜哹uild鏂囦歡浜嗐傚彧瑕佽繍琛宎nt灝卞彲浠ヤ簡(ant 鐨勫畨瑁呭拰浣跨敤鍦ㄦ涓嶈浜?銆傚鏋滄槸鐢↗builder 榪愯錛岃鍦ㄦ柊寤虹殑欏圭洰涓姞鍏oi鍖呫?BR>
浠builder6涓轟緥錛岄夋嫨Tools鑿滃崟欏圭殑config libraries...閫夐」錛屾柊寤轟竴涓猯ib銆傚湪寮瑰嚭鐨勮彍鍗曚腑閫夋嫨poi鍖咃紝濡傝繖涓猨akarta-poi-1.5.1-final-20020820.jar錛屾妸poi娣誨姞鍒癹builder涓傜劧鍚庯紝鍙抽敭鐐瑰嚮浣犵殑欏圭洰錛屽湪project鐨刾roperties鑿滃崟涓璸ath鐨剅equired Libraries涓紝鐐筧dd錛屾坊鍔犲垰鎵嶅姞鍏ュ埌jbuilder涓殑poi鍒頒綘鐜板湪鐨勯」鐩腑銆?BR>
濡傛灉浣犱粎浠呮槸涓轟簡鐔熸倝POI hssf鐨勪嬌鐢紝鍙互鐩存帴鐪婸OI鐨剆amples鍖呬腑鐨勬簮浠g爜錛屽茍涓旇繍琛屽畠銆俬ssf鐨勫悇縐嶅璞¢兘鏈変緥紼嬬殑浠嬬粛銆俬ssf鎻愪緵鐨勪緥紼嬪湪org.apache.poi.hssf.usermodel.examples鍖呬腑錛屽叡鏈?4涓紝鐢熸垚鐨勭洰鏍噚ls閮芥槸workbook.xls銆傚鏋滀綘鎯崇湅鏇村鐨勪緥紼嬶紝鍙互鍙傝僪ssf鐨凧unit test cases錛屽湪poi鐨勫寘鐨勬簮浠g爜涓湁銆俬ssf閮芥湁嫻嬭瘯浠g爜銆?BR>榪欓噷鍙閮ㄥ垎渚嬬▼鐨勫疄鐜板仛浠嬬粛銆?BR>
HSSF鎻愪緵緇欑敤鎴蜂嬌鐢ㄧ殑瀵硅薄鍦╫rg.apache.poi.hssf.usermodel鍖呬腑,涓昏閮ㄥ垎鍖呮嫭Excell瀵硅薄錛屾牱寮忓拰鏍煎紡錛岃繕鏈夎緟鍔╂搷浣溿傛湁浠ヤ笅鍑犵瀵硅薄錛?BR>
HSSFWorkbook excell鐨勬枃妗e璞?BR>
HSSFSheet excell鐨勮〃鍗?BR>
HSSFRow excell鐨勮

HSSFCell excell鐨勬牸瀛愬崟鍏?BR>
HSSFFont excell瀛椾綋

HSSFName 鍚嶇О

HSSFDataFormat 鏃ユ湡鏍煎紡

鍦╬oi1.7涓墠鏈変互涓?欏癸細

HSSFHeader sheet澶?BR>
HSSFFooter sheet灝?BR>
鍜岃繖涓牱寮?BR>
HSSFCellStyle cell鏍峰紡

杈呭姪鎿嶄綔鍖呮嫭

HSSFDateUtil 鏃ユ湡

HSSFPrintSetup 鎵撳嵃

HSSFErrorConstants 閿欒淇℃伅琛?BR>
浠旂粏鐪媜rg.apache.poi.hssf鍖呯殑緇撴瀯錛屼笉闅懼彂鐜癏SSF鐨勫唴閮ㄥ疄鐜伴伒寰殑鏄疢VC妯″瀷銆?BR>
榪欓噷鎴戠敤Rose鎶妎rg.apache.poi.hssf.usermodel鍖呬腑鐨勫璞″弽鍚戝鍏ュ茍鏍規嵁鐩鎬簰鍏崇郴浣滀簡鏁寸悊錛岃瑙佷笅闈袱鍥撅細







鍥? 鍩烘湰瀵硅薄



浠庝腑涓嶉毦鍙互鍙戠幇姣忎竴涓熀鏈璞¢兘鍏寵仈浜嗕竴涓猂ecord瀵硅薄銆俁ecord瀵硅薄鏄竴涓弬鑰僌ffice鏍煎紡鐨勭浉鍏寵褰曘?nbsp;





鍥? HSSFWorkbook



HSSFWorkbook鍗蟲槸涓涓狤xcell瀵硅薄銆傝繖騫呯被鍥句綋鐜扮殑鏄疕SSFWorkbook鍜屽熀鏈璞$殑鐩鎬簰鍏崇郴銆傚彲瑙侊紝璁稿瀵硅薄涓篃寤虹珛浜哤orkbook鐨勫紩鐢ㄣ傝繕闇瑕佹敞鎰忕殑鏄湪HSSFWorkbook鍜孒SSFSheet涓緩绔嬩簡log鏈哄埗POILogger錛岃屼笖POILogger涔熸槸浣跨敤apache Log4J瀹炵幇鐨勩?BR>
鍏堢湅poi鐨別xamples鍖呬腑鎻愪緵鐨勬渶綆鍗曠殑渚嬪瓙錛屽緩绔嬩竴涓┖xls鏂囦歡銆?BR>

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.FileOutputStream;
import java.io.IOException;
public class NewWorkbook
{
public static void main(String[] args)throws IOException
{
HSSFWorkbook wb 
= new HSSFWorkbook();
//寤虹珛鏂癏SSFWorkbook瀵硅薄
FileOutputStream fileOut =
new FileOutputStream("workbook.xls"錛?
wb.write(fileOut);
//鎶奧orkbook瀵硅薄杈撳嚭鍒版枃浠秝orkbook.xls涓?/SPAN>
fileOut.close();
}

}





閫氳繃榪欎釜渚嬪瓙錛屾垜浠緩绔嬬殑鏄竴涓┖鐧界殑xls鏂囦歡錛堜笉鏄┖鏂囦歡錛夈傚湪姝ゅ熀紜涓婏紝鎴戜滑鍙互榪涗竴姝ョ湅鍏跺畠鐨勪緥瀛愩?nbsp;


import org.apache.poi.hssf.usermodel.*;

import java.io.FileOutputStream;

import java.io.IOException;

public class CreateCells

{

public static void main(String[] args)

throws IOException

{

HSSFWorkbook wb 
= new HSSFWorkbook();
//寤虹珛鏂癏SSFWorkbook瀵硅薄

HSSFSheet sheet 
= wb.createSheet("new sheet"錛?
//寤虹珛鏂扮殑sheet瀵硅薄


// Create a row and put some cells in it.
Rows are 0 based.

HSSFRow row 
= sheet.createRow((short)0);
//寤虹珛鏂拌

// Create a cell and put a value in it.

HSSFCell cell 
= row.createCell((short)0);
//寤虹珛鏂癱ell

cell.setCellvalue(
1);//璁劇疆cell鐨勬暣鏁扮被鍨嬬殑鍊?BR>

// Or do it on one line.

row.createCell((
short)1).setCellvalue(1.2);
//璁劇疆cell嫻偣綾誨瀷鐨勫?/SPAN>

row.createCell((
short)2).setCellvalue("test"錛?
//璁劇疆cell瀛楃綾誨瀷鐨勫?/SPAN>

row.createCell((
short)3).setCellvalue(true);
//璁劇疆cell甯冨皵綾誨瀷鐨勫?nbsp;

HSSFCellStyle cellStyle 
= wb.createCellStyle();
//寤虹珛鏂扮殑cell鏍峰紡

cellStyle.setDataFormat
(HSSFDataFormat.getFormat(
"m/d/yy h:mm"錛夛級;
//璁劇疆cell鏍峰紡涓哄畾鍒剁殑鏃ユ湡鏍煎紡

HSSFCell dCell 
=row.createCell((short)4);

dCell.setCellvalue(
new Date());
//璁劇疆cell涓烘棩鏈熺被鍨嬬殑鍊?/SPAN>

dCell.setCellStyle(cellStyle); 
//璁劇疆璇ell鏃ユ湡鐨勬樉紺烘牸寮?/SPAN>

HSSFCell csCell 
=row.createCell((short)5);

csCell.setEncoding(HSSFCell.ENCODING_UTF_16);
//璁劇疆cell緙栫爜瑙e喅涓枃楂樹綅瀛楄妭鎴柇

csCell.setCellvalue(
"涓枃嫻嬭瘯_Chinese Words Test"錛?
//璁劇疆涓タ鏂囩粨鍚堝瓧絎︿覆

row.createCell((
short)6).setCellType
(HSSFCell.CELL_TYPE_ERROR);
//寤虹珛閿欒cell


// Write the output to a file

FileOutputStream fileOut 
= 
new FileOutputStream("workbook.xls"錛?

wb.write(fileOut);

fileOut.close();

}


}





鎴戠◢寰慨鏀逛簡鍘熸潵鐨別xamples鍖呬腑鐨凜reateCells綾誨啓浜嗕笂闈㈢殑鍔熻兘嫻嬭瘯綾匯傞氳繃榪欎釜渚嬪瓙錛屾垜浠彲浠ユ竻妤氱殑鐪嬪埌xls鏂囦歡浠庡ぇ鍒板皬鍖呮嫭浜咹SSFWorkbook HSSFSheet HSSFRow HSSFCell榪欐牱鍑犱釜瀵硅薄銆傛垜浠彲浠ュ湪cell涓緗悇縐嶇被鍨嬬殑鍊箋?nbsp;

灝ゅ叾瑕佹敞鎰忕殑鏄鏋滀綘鎯蟲紜殑鏄劇ず闈炴緹庣殑瀛楃鏃訛紝灝ゅ叾璞′腑鏃ラ煩榪欐牱鐨勮璦錛屽繀欏昏緗紪鐮佷負16浣嶇殑鍗蟲槸HSSFCell.ENCODING_UTF_16錛屾墠鑳戒繚璇佸瓧絎︾殑楂?浣嶄笉琚埅鏂屽紩璧風紪鐮佸け鐪熷艦鎴愪貢鐮併?nbsp;

鍏朵粬嫻嬭瘯鍙互閫氳繃鍙傝僥xamples鍖呬腑鐨勬祴璇曚緥瀛愭帉鎻oi鐨勮緇嗙敤娉曪紝鍖呮嫭瀛椾綋鐨勮緗紝cell澶у皬鍜屼綆綰圭殑璁劇疆絳夈傞渶瑕佹敞鎰忕殑鏄疨OI鏄竴涓粛鐒跺湪瀹屽杽涓殑鍏紑浠g爜鐨勯」鐩紝鎵浠ユ湁浜涘姛鑳芥鍦ㄤ笉鏂殑鎵╁厖銆?nbsp;

濡侶SSFSheet鐨刧etFooter() getHeader()鍜宻etFooter(HSSFFooter hsf) setHeader(HSSFHeader hsh)鏄湪POI1.7涓墠鏈夌殑錛岃孭OI1.5涓氨娌℃湁銆傝繍琛屾祴璇曠啛鎮変唬鐮佹垨鑰呬嬌鐢ㄥ畠鍋氶」鐩椂璇鋒敞鎰廝OI鐨勭増鏈?nbsp;

鍙﹀闇瑕佹敞鎰忕殑鏄疕SSF涔熸湁瀹冪殑瀵箈ls鍩轟簬浜嬩歡鐨勮В鏋愩傚彲浠ュ弬鑰冧緥紼嬩腑鐨凟ventExample.java銆傚畠閫氳繃瀹炵幇HSSFListener瀹屾垚浠庢櫘閫氭祦璁ょ煡Xls涓寘鍚殑鍐呭錛屽湪apache Cocoon涓殑org.apache.cocoon.serialization.HSSFSerializer涓敤鍒頒簡榪欎釜瑙f瀽銆傚洜涓篊ocoon2鏄熀浜庝簨浠剁殑錛屾墍浠OI涓轟簡鎻愪緵蹇熺殑瑙f瀽涔熸彁渚涗簡鐩稿簲鐨勪簨浠躲傚綋鐒舵垜浠嚜宸變篃鍙互瀹炵幇榪欎釜浜嬩歡鎺ュ彛銆?nbsp;

鍥犱負POI榪樹笉鏄竴涓凍澶熸垚鐔熺殑欏圭洰錛屾墍浠ユ湁蹇呰鍋氳繘涓姝ョ殑寮鍙戝拰嫻嬭瘯銆備絾鏄畠宸茬粡涓烘垜浠敤綰疛ava鎿嶄綔ole2瀵硅薄鎻愪緵浜嗗彲鑳斤紝鑰屼笖鍏嬫湇浜唎le瀵硅薄璋冪敤鐨勭己闄鳳紝鎻愪緵浜嗘湇鍔″櫒绔殑Excel瑙e喅鏂規銆?BR>

涓婊存按 2006-01-20 13:52 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 国产亚洲精品观看91在线| 日韩在线看片免费人成视频播放| 亚洲熟妇无码一区二区三区导航| 精品国产日韩亚洲一区在线| 成年女人毛片免费播放人| 亚洲六月丁香婷婷综合| 免费a级毛片高清视频不卡| 亚洲高清免费视频| 久久亚洲AV成人无码国产电影| 国产性生大片免费观看性| 亚洲精品第一国产综合境外资源 | 亚洲AV伊人久久青青草原| 亚洲AV成人精品一区二区三区| 成全动漫视频在线观看免费高清版下载 | 久久精品国产亚洲AV电影| 精品久久久久久亚洲中文字幕| 免费国产黄网站在线观看| 一区国严二区亚洲三区| 亚洲视频在线观看网站| 日本免费网址大全在线观看| 亚洲男人天堂2018av| 免费一级特黄特色大片在线观看| 亚洲人成网站在线观看播放青青| 久久99久久成人免费播放| 久久久久亚洲AV成人无码网站| 国产亚洲精品精品精品| 4338×亚洲全国最大色成网站| 亚洲人成电影网站色| 亚洲福利在线播放| 国产成人va亚洲电影| 亚洲精品无码午夜福利中文字幕| 色多多免费视频观看区一区| 国产亚洲精品国产| 女人被免费视频网站| 三年片免费高清版| 亚洲人成网站18禁止一区 | 国产免费不卡v片在线观看| 久久久久亚洲av无码尤物| 99久久久国产精品免费无卡顿| 国产成人无码综合亚洲日韩| 久久免费精品一区二区|