﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-樂為,學習筆記</title><link>http://www.blogjava.net/lewei/</link><description>你好,好學的人.</description><language>zh-cn</language><lastBuildDate>Mon, 15 Jun 2026 23:09:36 GMT</lastBuildDate><pubDate>Mon, 15 Jun 2026 23:09:36 GMT</pubDate><ttl>60</ttl><item><title>struts2.0 整合tiles 配置</title><link>http://www.blogjava.net/lewei/articles/364775.html</link><dc:creator>lewei</dc:creator><author>lewei</author><pubDate>Fri, 25 Nov 2011 00:50:00 GMT</pubDate><guid>http://www.blogjava.net/lewei/articles/364775.html</guid><description><![CDATA[<div><div>1.在WEB-INF/lib下加入所需的jar包&nbsp;</div><div></div><div>&nbsp; &nbsp; commons-digester-1.6.jar，</div><div></div><div>&nbsp; &nbsp; tiles-core-2.0-20070207.130156-4.jar，</div><div>&nbsp; &nbsp; tiles-api-2.0-20070207.130156-4.jar，</div><div>&nbsp; &nbsp; struts2-tiles-plugin-2.0.6.jar，</div><div>struts2-core-2.0.6.jar</div><div>xwork-2.0.1.jar，</div><div>2. 以下内容添加到web.xml</div><div>&nbsp;&lt;context-param&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;param-name&gt;org.apache.tiles.CONTAINER_FACTORY&lt;/param-name&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;param-value&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;org.apache.struts2.tiles.StrutsTilesContainerFactory</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/param-value&gt;</div><div>&nbsp; &nbsp; &lt;/context-param&gt;</div><div>&nbsp; &nbsp;</div><div>&nbsp; &nbsp; &lt;context-param&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;param-name&gt; &nbsp; org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/param-name&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;param-value&gt;/WEB-INF/tiles.xml&lt;/param-value&gt;</div><div>&nbsp; &nbsp; &lt;/context-param&gt;</div><div>&nbsp;</div><div>&nbsp; &nbsp; &lt;listener&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;listener-class&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;org.apache.struts2.tiles.StrutsTilesListener</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/listener-class&gt;</div><div>&nbsp; &nbsp; &lt;/listener&gt;</div><div>3.在WEB-INF下添加和tiles.tld和tiles.xml文件，其中tiles.tld内容为tiles-core-2.0-20070207.130156-4.jar包中META_INF/tiles-core.tld的内容。</div><div>tiles.xml内容：</div><div>&lt;?xml version="1.0" encoding="GB2312" ?&gt;</div><div>&lt;!DOCTYPE tiles-definitions PUBLIC</div><div>&nbsp; &nbsp; &nbsp; &nbsp;"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"</div><div>&nbsp; &nbsp; &nbsp; &nbsp;"http://jakarta.apache.org/struts/dtds/tiles-config.dtd"&gt;</div><div>&lt;tiles-definitions&gt;</div><div>&nbsp; &nbsp; &lt;definition name="myapp.homepage" template="layout.jsp"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="title" value="Tiles tutorial homepage" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="header" value="/tiles/header.jsp" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="menu" value="/tiles/menu.jsp" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="body" value="/tiles/cBody.jsp" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="footer" value="/tiles/footer.jsp" /&gt;</div><div>&nbsp; &nbsp; &lt;/definition&gt;</div><div>&lt;/tiles-definitions&gt;</div><div>&nbsp; &nbsp;</div><div>4.struts.xml 为：</div><div>&lt;!DOCTYPE struts PUBLIC &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; "http://struts.apache.org/dtds/struts-2.0.dtd"&gt;</div><div>&lt;struts&gt;</div><div>&nbsp; &nbsp; &lt;package name="default" extends="tiles-default"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;action name="go" class="com.action.MyAction"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!--result name="success"&gt;/next.jsp&lt;/result--&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;result name="success" type="tiles"&gt;myapp.homepage&lt;/result&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/action&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/package&gt;</div><div>&lt;/struts&gt;</div><div>红色部分根据自己项目定。注意extends="tiles-default"</div><div>5创建layout.jsp：</div><div>&lt;%@ page contentType="text/html; charset=UTF-8"%&gt;</div><div>&lt;%@ taglib uri="WEB-INF/tiles.tld " prefix="tiles"%&gt;</div><div>&lt;html&gt;</div><div>&nbsp; &nbsp; &lt;head&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;title&gt;&lt;/title&gt;</div><div>&nbsp; &nbsp; &lt;/head&gt;</div><div>&nbsp; &nbsp; &lt;body&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;table width="768px" height="800px" border="2" align="center"&gt;</div><div>&nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td colspan="2" align="center" valign="top" width="768px" height="100px" bgcolor="#80ff80"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tiles:insertAttribute name="header" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="center" width="150px" height="800px" bgcolor="#00ff00"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tiles:insertAttribute name="menu" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td align="right" width="618px" height="800px" bgcolor="#ff80c0"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tiles:insertAttribute name="body" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;td colspan="2" bgcolor="#00ff40" height="100px"&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;tiles:insertAttribute name="footer" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/td&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;</div><div>&nbsp; &nbsp; &lt;/body&gt;</div><div>&lt;/html&gt;</div><div>&nbsp;</div><div>6.根据</div><div>&lt;put name="title" value="Tiles tutorial homepage" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="header" value="/tiles/header.jsp" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="menu" value="/tiles/menu.jsp" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="body" value="/tiles/cBody.jsp" /&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&lt;put name="footer" value="/tiles/footer.jsp" /&gt;</div><div>在WebRoot下创建tiles目录和相应jsp文件</div></div><img src ="http://www.blogjava.net/lewei/aggbug/364775.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewei/" target="_blank">lewei</a> 2011-11-25 08:50 <a href="http://www.blogjava.net/lewei/articles/364775.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDBC连接各种数据库的写法</title><link>http://www.blogjava.net/lewei/articles/364090.html</link><dc:creator>lewei</dc:creator><author>lewei</author><pubDate>Thu, 17 Nov 2011 07:51:00 GMT</pubDate><guid>http://www.blogjava.net/lewei/articles/364090.html</guid><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 以下是JDBC连接各种数据库的写法&nbsp; &nbsp; &nbsp;1、Oracle8/8i/9i数据库（thin模式）Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();&nbsp; &nbsp;String&nbsp;url="jdbc:oracle:thin:@localhost:1521:orcl";&nbsp...&nbsp;&nbsp;<a href='http://www.blogjava.net/lewei/articles/364090.html'>阅读全文</a><img src ="http://www.blogjava.net/lewei/aggbug/364090.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lewei/" target="_blank">lewei</a> 2011-11-17 15:51 <a href="http://www.blogjava.net/lewei/articles/364090.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>