﻿<?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-不曾真实-随笔分类-JSP</title><link>http://www.blogjava.net/wenzhoou/category/8734.html</link><description>虽然工人可能是锤子的主人，但锤子却依然故我。
工具精确地知道自己应被如何使用，而使用者对此却只会有模糊的概念。</description><language>zh-cn</language><lastBuildDate>Wed, 28 Feb 2007 07:44:59 GMT</lastBuildDate><pubDate>Wed, 28 Feb 2007 07:44:59 GMT</pubDate><ttl>60</ttl><item><title>JSP图标合成的例子</title><link>http://www.blogjava.net/wenzhoou/archive/2006/03/22/36898.html</link><dc:creator>不曾真实</dc:creator><author>不曾真实</author><pubDate>Wed, 22 Mar 2006 10:48:00 GMT</pubDate><guid>http://www.blogjava.net/wenzhoou/archive/2006/03/22/36898.html</guid><wfw:comment>http://www.blogjava.net/wenzhoou/comments/36898.html</wfw:comment><comments>http://www.blogjava.net/wenzhoou/archive/2006/03/22/36898.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/wenzhoou/comments/commentRss/36898.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/wenzhoou/services/trackbacks/36898.html</trackback:ping><description><![CDATA[
		<p>  今天做了一个Jsp页面合成图标的例子。<br />  起因每次网上去合成Gmail图片，觉得不爽<img height="20" src="http://www.blogjava.net/Emoticons/QQ/icon18.gif" width="25" border="0" />（偶这里联网慢拉）。然后就找了一份合成Gmail图片的代码，<a href="http://playtime.uni.cc/downloads.php?page=gmail">http://playtime.uni.cc/downloads.php?page=gmail</a>。下下来一看，php的，而且还需要一个GD的库。不过代码倒是看明白了。很短，也很无趣。<img height="20" src="http://www.blogjava.net/Emoticons/QQ/09.gif" width="20" border="0" /><br /><br />  于是我就想能不能用Jsp合成图标阿。<img height="20" src="http://www.blogjava.net/Emoticons/QQ/05.gif" width="20" border="0" /><br />  然后搜了一下，网上果然有介绍。于是就自己照猫画虎做了一个爱因斯坦的图片合成的例子。<br /><br />   </p>
		<p align="center">
				<img height="480" alt="r_ai.JPG" src="http://www.blogjava.net/images/blogjava_net/wenzhoou/8793/r_ai.JPG" width="576" border="0" />
		</p>
		<p>
				<br />
				<br />
		</p>
		<p>  下边是代码。总共不到100行。<br />  通过测试，响应速度还挺快的<img height="20" src="http://www.blogjava.net/Emoticons/QQ/knife.gif" width="20" border="0" />。这里是核心<img height="20" src="http://www.blogjava.net/Emoticons/QQ/icon19.gif" width="20" border="0" />部分<br /><br /></p>
		<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">
				<span style="COLOR: #008000">/*</span>
				<span style="COLOR: #008000"> =====ImageGen.jsp======== </span>
				<span style="COLOR: #008000">*/</span>
				<span style="COLOR: #000000">
						<br />
				</span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> @ page language </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> java </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">  contentType </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> image/jpeg </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> @ page </span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> java.io.* </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> @ page </span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> java.awt.* </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> @ page </span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> java.awt.image.* </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> @ page </span>
				<span style="COLOR: #0000ff">import</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> com.sun.image.codec.jpeg.* </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /><br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">static</span>
				<span style="COLOR: #000000"> Font fnt  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #0000ff">null</span>
				<span style="COLOR: #000000"> ;  </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">!</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">static</span>
				<span style="COLOR: #000000"> BufferedImage bg  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #0000ff">null</span>
				<span style="COLOR: #000000"> ;  </span>
				<span style="COLOR: #000000">%&gt;</span>
				<span style="COLOR: #000000"> <br /></span>
				<span style="COLOR: #000000">&lt;%</span>
				<span style="COLOR: #000000"> <br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  DEBUG:  -&gt;   long  st  =  System.currentTimeMillis();</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    request.setCharacterEncoding( </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> shift_jis </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> );<br />     String  text  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  request.getParameter( </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> text </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> );<br />     </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (text  </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #0000ff">null</span>
				<span style="COLOR: #000000"> ) text  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #000000">""</span>
				<span style="COLOR: #000000"> ;<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  DEBUG:  -&gt;  System.err.println( " text:  " + text);<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> because font  and  background need only read once, so make it static.</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">     </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (fnt  </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #0000ff">null</span>
				<span style="COLOR: #000000"> )     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  handwriting font make it looks funny.s</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">        fnt  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  Font.createFont(Font.TRUETYPE_FONT, </span>
				<span style="COLOR: #0000ff">new</span>
				<span style="COLOR: #000000">  FileInputStream(getServletContext().getRealPath( </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> / </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ) </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> LHANDW.TTF </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ));<br />     </span>
				<span style="COLOR: #0000ff">if</span>
				<span style="COLOR: #000000"> (bg  </span>
				<span style="COLOR: #000000">==</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #0000ff">null</span>
				<span style="COLOR: #000000"> )<br />    {<br />        JPEGImageDecoder decoder  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  JPEGCodec.createJPEGDecoder( </span>
				<span style="COLOR: #0000ff">new</span>
				<span style="COLOR: #000000">  FileInputStream(getServletContext().getRealPath( </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> / </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ) </span>
				<span style="COLOR: #000000">+</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> einstein.jpg </span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000"> ));<br />        bg  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  decoder.decodeAsBufferedImage();<br />    }<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  draw background</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  width  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  bg.getWidth();<br />    </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  height  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  bg.getHeight();<br />    BufferedImage bi  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">   </span>
				<span style="COLOR: #0000ff">new</span>
				<span style="COLOR: #000000">  BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);<br />    Graphics2D g  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  bi.createGraphics();<br />    g.drawImage(bg, </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> , </span>
				<span style="COLOR: #000000">0</span>
				<span style="COLOR: #000000"> , </span>
				<span style="COLOR: #0000ff">null</span>
				<span style="COLOR: #000000"> );<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  start draw text that user input</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    g.setColor(Color.WHITE);<br />    g.setFont(fnt.deriveFont(20f));<br />     </span>
				<span style="COLOR: #0000ff">int</span>
				<span style="COLOR: #000000">  stringwidth  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  g.getFontMetrics().stringWidth(text);<br />    g.drawString(text, </span>
				<span style="COLOR: #000000">300</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">-</span>
				<span style="COLOR: #000000"> stringwidth </span>
				<span style="COLOR: #000000">/</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #000000">2</span>
				<span style="COLOR: #000000"> , </span>
				<span style="COLOR: #000000">120</span>
				<span style="COLOR: #000000"> );<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">   end  draw</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    g.dispose();<br />    bi.flush();<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  encode  and  output result</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">    JPEGImageEncoder encoder  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  JPEGCodec.createJPEGEncoder(response.getOutputStream());<br />    JPEGEncodeParam param  </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000">  encoder.getDefaultJPEGEncodeParam(bi);<br />    param.setQuality( </span>
				<span style="COLOR: #000000">1</span>
				<span style="COLOR: #000000"> .0f,  </span>
				<span style="COLOR: #0000ff">false</span>
				<span style="COLOR: #000000"> );<br />    encoder.setJPEGEncodeParam(param);<br />    encoder.encode(bi);<br /><br />     </span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">  DEBUG:  -&gt;  System.err.println( " Time Cost:  " + (System.currentTimeMillis()  -  st));</span>
				<span style="COLOR: #008000">
						<br />
				</span>
				<span style="COLOR: #000000">%&gt;</span>
		</div>
		<br />下边是界面部分<img height="20" src="http://www.blogjava.net/Emoticons/QQ/44.gif" width="20" border="0" /><br /><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"><span style="COLOR: #000000">/* ======Image.jsp====== */<br /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ page language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">java</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> contentType</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">text/html;charset=shift_jis</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ page import</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">java.net.URLEncoder</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Image Gen</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">meta </span><span style="COLOR: #ff0000">http-equiv</span><span style="COLOR: #0000ff">="Content-Type"</span><span style="COLOR: #ff0000"> content</span><span style="COLOR: #0000ff">="text/html; charset=shift_jis"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table </span><span style="COLOR: #ff0000">width</span><span style="COLOR: #0000ff">="100%"</span><span style="COLOR: #ff0000"> border</span><span style="COLOR: #0000ff">="0"</span><span style="COLOR: #ff0000"> align</span><span style="COLOR: #0000ff">="center"</span><span style="COLOR: #ff0000"> cellspacing</span><span style="COLOR: #0000ff">="1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><br />    request.setCharacterEncoding(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">shift_jis</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br />    </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">String</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> text </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> request.getParameter(</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">text</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">);<br />    </span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">if</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">(text</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">==</span><span style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">null</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> || text.length() </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">==</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">0</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">) text </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Please input !</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">;<br /></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">IMG </span><span style="COLOR: #ff0000">src</span><span style="COLOR: #0000ff">=&lt;%= </span><span style="COLOR: #ff0000">"ImageGen.jsp?text</span><span style="COLOR: #0000ff">="+URLEncoder.encode(text,"</span><span style="COLOR: #ff0000">shift_jis") %</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> border="0" /&gt;<br /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><br /></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr </span><span style="COLOR: #ff0000">valign</span><span style="COLOR: #0000ff">="top"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br />   </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="gen"</span><span style="COLOR: #ff0000"> action</span><span style="COLOR: #0000ff">="Image.jsp"</span><span style="COLOR: #ff0000"> method</span><span style="COLOR: #0000ff">="post"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br />        </span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000"> textarea name="text" rows="8" cols="70" </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000"><br />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="text"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br />        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">input </span><span style="COLOR: #ff0000">type</span><span style="COLOR: #0000ff">="submit"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="Create Image"</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br />    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /><br /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"><br /></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div><br />用到的图片和字体在这里：<a href="/Files/wenzhoou/Resource_JSPImgGen.zip">http://www.blogjava.net/Files/wenzhoou/Resource_JSPImgGen.zip</a><img src ="http://www.blogjava.net/wenzhoou/aggbug/36898.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wenzhoou/" target="_blank">不曾真实</a> 2006-03-22 18:48 <a href="http://www.blogjava.net/wenzhoou/archive/2006/03/22/36898.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JspWiki的存储和版本管理</title><link>http://www.blogjava.net/wenzhoou/archive/2006/03/21/36635.html</link><dc:creator>不曾真实</dc:creator><author>不曾真实</author><pubDate>Tue, 21 Mar 2006 06:28:00 GMT</pubDate><guid>http://www.blogjava.net/wenzhoou/archive/2006/03/21/36635.html</guid><wfw:comment>http://www.blogjava.net/wenzhoou/comments/36635.html</wfw:comment><comments>http://www.blogjava.net/wenzhoou/archive/2006/03/21/36635.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/wenzhoou/comments/commentRss/36635.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/wenzhoou/services/trackbacks/36635.html</trackback:ping><description><![CDATA[
		<p>  今天又折腾了下JspWiki，（恩，为什么说又呢？因为我以前折腾过。哈哈，其实我今天突然想知道JspWiki的数据存储和版本管理是怎么实现的。）这么一折腾，发现这个东西还是挺不错，挺好玩儿的。<br />  JspWiki的官方网站：<a href="http://www.jspwiki.org/">http://www.jspwiki.org</a><br />  下载后安装，（其实也不用安装，很简单的拷贝和修改配置文件拉<img height="19" src="http://www.blogjava.net/Emoticons/regular_smile.gif" width="19" border="0" />，我直接用我以前安装的一个版本）<br />  有一条配置“jspwiki.fileSystemProvider.pageDir”要改了，不然在系统盘下生成一个“/p/web/www-data/jspwiki/”的目录。挺郁闷的。<br />  启动后，页面上都是空空一片。觉得不爽。<br />  然后从下载的bin包下边找到一个“JSPWiki-samplepages.zip”文件，解开到刚才设定的pageDir下边，重启动以后，就有东西了。<br />  感觉纯英文不爽，上<a href="http://sourceforge.net/projects/startemplate">http://sourceforge.net/projects/startemplate</a>去下了个Template。恩，感觉不错了。<br />  （编辑了一下，发现LeftMenu有些问题，估计是一个小BUG吧。）<br /><br />  收获：<br />            1.发现原来JSPWiki默认采用的是文本存储<br />            2.pageProvider有三种，决定了版本是用什么管理的。<br />               FileSystemProvider 没有版本管理<br />               VersioningFileProvider 直接文本方式的版本管理<br />               RCSFileProvider 就是和RCS集成进行管理（我是这么想的，RCS是什么东东改天继续研究）<br />             3.FileSystemProvider和VersioningFileProvider因为直接存储的文本文件，而且没有分目录，<br />                所以不是一个很好的方案。<br />             4.VersioningFileProvider的版本管理就是直接把旧文件存到另外一个Old目录下边<br />                （当然是要改名字拉）。<br />                实际上按照版本，改为1.txt,2.txt等等<br />                我怎么没想到呢<img height="20" src="http://www.blogjava.net/Emoticons/QQ/21.gif" width="20" border="0" />。<br /></p>
<img src ="http://www.blogjava.net/wenzhoou/aggbug/36635.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wenzhoou/" target="_blank">不曾真实</a> 2006-03-21 14:28 <a href="http://www.blogjava.net/wenzhoou/archive/2006/03/21/36635.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>