锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久久久亚洲av无码尤物,国产一区二区三区亚洲综合,国产成人精品日本亚洲专区 http://www.tkk7.com/rain1102/category/37638.html<br/><font color="green" style="font-family: 鍗庢枃琛屾シ;font-size:16px;">瀛愭洶錛氬嵄閭︿笉鍏ワ紝涔遍偊涓嶅眳銆傚ぉ涓嬫湁閬撳垯瑙侊紝鏃犻亾鍒欓殣銆?lt;/font><font color="#3C1435"></font>zh-cnSun, 04 Apr 2010 02:26:21 GMTSun, 04 Apr 2010 02:26:21 GMT60Grails浜旇浠g爜瀹炵幇鍥劇墖涓婁紶涓庡睍紺?/title><link>http://www.tkk7.com/rain1102/archive/2010/04/01/317219.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Thu, 01 Apr 2010 11:52:00 GMT</pubDate><guid>http://www.tkk7.com/rain1102/archive/2010/04/01/317219.html</guid><wfw:comment>http://www.tkk7.com/rain1102/comments/317219.html</wfw:comment><comments>http://www.tkk7.com/rain1102/archive/2010/04/01/317219.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/rain1102/comments/commentRss/317219.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/rain1102/services/trackbacks/317219.html</trackback:ping><description><![CDATA[<p>鍩熶腑鍐欏涓嬩唬鐮侊細<font color="#ff3300"><code><br /> class Something{<br /> byte[] image<br /> }</code></font></p> <p>鎺у埗鍣ㄤ腑灞曠ず鍥劇墖鐨勬柟娉?/p> <p><font color="#ff3300"><code>def image= {<br /> def something = Something.get( params.id )<br /> byte[] image = something.image<br /> response.outputStream << image<br /> }<br /> </code></font></p> <p>欏甸潰灞曠ず</p> <p><font color="#ff3300"><code><img src="${createLink(controller:'something', action:'image', id: something.id)}"/></code></font></p> <!--adcode--><img src ="http://www.tkk7.com/rain1102/aggbug/317219.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/rain1102/" target="_blank">Eric.Zhou</a> 2010-04-01 19:52 <a href="http://www.tkk7.com/rain1102/archive/2010/04/01/317219.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浣跨敤Grails鍜孯ome浜х敓Rss [杞澆]http://www.tkk7.com/rain1102/archive/2008/09/07/227606.htmlEric.ZhouEric.ZhouSun, 07 Sep 2008 14:53:00 GMThttp://www.tkk7.com/rain1102/archive/2008/09/07/227606.htmlhttp://www.tkk7.com/rain1102/comments/227606.htmlhttp://www.tkk7.com/rain1102/archive/2008/09/07/227606.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/227606.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/227606.htmlGrails鏈韓濂藉儚騫舵病鏈変駭鐢焤ss鐨勬彃浠躲傚鏋滆鐢╣rails浜х敓Rss錛屽彲浠ヤ嬌鐢≧ome銆傛柟娉曞ぇ姒傚涓嬶細

涓嬭澆闇瑕佺殑搴撴枃浠?/h2>

鍒?a >https://rome.dev.java.net/涓嬭澆Rome錛屼箣鍚庢妸rome-xxx.jar鏀懼埌浣犵殑grails欏圭洰鐨刲ib鐩綍涓嬨傝繖閲寈xx鏄増鏈彿銆傛瘮濡傛垜鐨勬槸rome-1.0RC1.jar

鍐嶅埌http://www.jdom.org/涓嬭澆JDom銆備箣鍚庡悓鏍鋒槸鎶妀dom.jar鏀懼埌lib鐩綍涓嬨?/p>

涔﹀啓浠g爜

鍒涘緩涓涓猚ontroller錛屽綋鐒朵綘涔熷彲浠ュ湪浣犲凡緇忔湁鐨刢ontroller閲岄潰澧炲姞鐩稿簲鏂規硶銆傝繖閲屾垜浠垱寤轟竴涓彨鍋欶eedController鐨勭被銆?br />

 1 import com.sun.syndication.feed.synd.*;   
 2 import com.sun.syndication.io.SyndFeedOutput;   
 3                
 4 class FeedController {   
 5        
 6     def supportedFormats = [ "rss_0.90""rss_0.91""rss_0.92""rss_0.93""rss_0.94""rss_1.0""rss_2.0""atom_0.3"]   
 7   
 8                   
 9                                 
10        
11     def rss = {   
12                
13             render(text: getFeed("rss_1.0"), contentType:"text/xml", encoding:"UTF-8")   
14        
15     }   
16        
17     def atom = {   
18                
19             render(text: getFeed("atom_1.0"), contentType:"text/xml", encoding:"UTF-8")   
20                        
21     }   
22   
23     // or specify your own feed type   
24     def all = {   
25             def format = params.id   
26             if (supportedFormats.contains(format)) {   
27                 render(text: getFeed(format), contentType:"text/xml", encoding:"UTF-8")   
28             } else {   
29                 response.sendError(response.SC_FORBIDDEN);   
30             }                  
31     }   
32        
33        
34     def getFeed(feedType) {   
35            
36         def items = Post.list(max: 5, sort: "created", order: "desc")   
37                
38         def entries = []   
39         items.each { item ->   
40             def desc = new SyndContentImpl(type: "text/plain", value: item.description);   
41             def entry = new SyndEntryImpl(title: item.name + " - " + item.summary,    
42                     link: 'http://www.ondev.net/item/show/' + item.name,   
43                     publishedDate: item.created, description: desc);   
44             entries.add(entry);   
45   
46         }   
47         SyndFeed feed = new SyndFeedImpl(feedType: feedType, title: '鏍囬',   
48                 link: 'http://www.ondev.net', description: '璇存槑鎬ф枃瀛?/span>',   
49                 entries: entries);   
50            
51         StringWriter writer = new StringWriter();   
52         SyndFeedOutput output = new SyndFeedOutput();   
53         output.output(feed,writer);   
54         writer.close();   
55            
56         return writer.toString();   
57   
58            
59     }   
60        
61 }  
62 

涔嬪悗璁塊棶鐩稿簲鐨勯〉闈紝姣斿璇?a >http://www.ondev.net/feed/rss灝卞彲浠ヤ簡

鍘熻創鍦板潃錛?http://www.ondev.net/story/show/75



Eric.Zhou 2008-09-07 22:53 鍙戣〃璇勮
]]>
緇橤rails娣誨姞楠岃瘉鐮佹彃浠朵箣jcaptcha-1.0http://www.tkk7.com/rain1102/archive/2008/08/28/225433.htmlEric.ZhouEric.ZhouThu, 28 Aug 2008 14:54:00 GMThttp://www.tkk7.com/rain1102/archive/2008/08/28/225433.htmlhttp://www.tkk7.com/rain1102/comments/225433.htmlhttp://www.tkk7.com/rain1102/archive/2008/08/28/225433.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/225433.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/225433.html 鑰宩captcha-1.0緇堜簬鍑烘潵浜? 姣旇搗0.2杞婚噺浜嗗緢澶? 鑰屼笖0.2閲岄潰鏈変笉灝戞棤鐢ㄧ殑涓滆タ...
鐜板湪grails-app涓嬮潰涓昏鐨勬枃浠跺氨鍓╀笅JcaptchaController.groovy, JcaptchaService.groovy, JcaptchaTagLib.groovy浜?
JcaptchaTagLib.groovy閲岄潰鍏跺疄涔熷氨瀹氫箟浜嗕袱涓爣絳? 涓涓敤鎴峰浘鐗囬獙璇?jpeg), 涓涓敤浜庤闊抽獙璇?wav).
JcaptchaController.groovy閲岄潰鍒欏畾涔変簡涓昏涓や釜action(jpeg鍜寃av)鐢ㄤ簬JcaptchaTagLib.groovy鐨勪袱涓爣絳捐皟鐢?
JcaptchaService.groovy鍒欏畾涔変簡鍥涗釜甯哥敤鏂規硶, 涓昏鏄痓oolean validateResponse(captchaName, id, response)鐢ㄤ簬楠岃瘉杈撳叆楠岃瘉鐮佹槸鍚︽紜?br />
涓嬮潰鐪嬬湅浣跨敤楠岃瘉鐮佷唬鐮?
棣栧厛闇瑕佸湪Config.groovy, 娣誨姞:
import Java.awt.Font
import Java.awt.Color
import com.octo.captcha.service.multitype.GenericManageableCaptchaService
import com.octo.captcha.engine.GenericCaptchaEngine
import com.octo.captcha.image.gimpy.GimpyFactory
import com.octo.captcha.component.word.wordgenerator.RandomWordGenerator
import com.octo.captcha.component.image.wordtoimage.ComposedWordToImage
import com.octo.captcha.component.image.fontgenerator.RandomFontGenerator
import com.octo.captcha.component.image.backgroundgenerator.GradientBackgroundGenerator
import com.octo.captcha.component.image.color.SingleColorGenerator
import com.octo.captcha.component.image.textpaster.NonLinearTextPaster

jcaptchas { 
        imageCaptcha = new GenericManageableCaptchaService( 
            new GenericCaptchaEngine( 
                new GimpyFactory( 
                    new RandomWordGenerator( 
                        "abcdefghijklmnopqrstuvwxyz1234567890" 
                    ), 
                    new ComposedWordToImage( 
                        new RandomFontGenerator(                 // 鐢熸垚鍥劇墖鏂囧瓧鐨勫瓧浣撲互鍙婂瓧鍙峰ぇ灝忥紝鍙互鏄縐嶅瓧浣擄紝浼氶殢鏈哄嚭鐜般?br />                             20, // min font size 
                            30, // max font size 
                            [new Font("Arial", 0, 10)] as Font[] 
                        ), 
                        new GradientBackgroundGenerator(       // 閰嶇疆楠岃瘉鍥劇墖鐨勫ぇ灝忓拰鑳屾櫙鑹蹭互鍙婅繃娓¤壊
                            140, // width 
                            35, // height 
                            new SingleColorGenerator(new Color(255, 255, 255)), 
                            new SingleColorGenerator(new Color(200, 200, 200)) 
                        ), 
                        new NonLinearTextPaster( 
                            4, // minimal length of text 
                            4, // maximal length of text 
                            new Color(11, 11, 11) 
                        ) 
                    ) 
                ) 
            ), 
            180, // minGuarantedStorageDelayInSeconds 
            180000 // maxCaptchaStoreSize 
        )


欏甸潰涓坊鍔?
< input id="captchaResponse" maxlength="30" name="captchaResponse" type="text" />
< jcaptcha:jpeg name="imageCaptcha" width="100px" height="25px" >< /jcaptcha:jpeg >

Controller閲岄潰瑕佸仛楠岃瘉
if (!jcaptchaService.validateResponse("imageCaptcha", session.id, params.captchaResponse)){
    flash.message = message(code:'pinpin.login.invalid.jcaptcha')
    return
}

Eric.Zhou 2008-08-28 22:54 鍙戣〃璇勮
]]>
groovy涓璴ist鍘婚櫎閲嶅鏁版嵁http://www.tkk7.com/rain1102/archive/2008/08/02/219567.htmlEric.ZhouEric.ZhouSat, 02 Aug 2008 05:55:00 GMThttp://www.tkk7.com/rain1102/archive/2008/08/02/219567.htmlhttp://www.tkk7.com/rain1102/comments/219567.htmlhttp://www.tkk7.com/rain1102/archive/2008/08/02/219567.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/219567.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/219567.html 1. 寰幆list涓殑鎵鏈夊厓绱犵劧鍚庡垹闄ら噸澶?br />     public   static   List  removeDuplicate(List list)  {
      for  ( int  i  =   0 ; i  <  list.size()  -   1 ; i ++ ) 
{
          for  ( int  j  =  list.size()  -   1 ; j  >  i; j -- ) 
{
               if  (list.get(j).equals(list.get(i))) 
{
                  list.remove(j);
                }

            }

          } 

        return list;
    }

2. 閫氳繃HashSet韙㈤櫎閲嶅鍏冪礌
    public   static   List  removeDuplicate(List list)  {
        HashSet h  =   new
 HashSet(list);
        list.clear();
        list.addAll(h);
        return list;
     }

鍦╣roovy涓綋鐒朵篃鍙互浣跨敤涓婇潰鐨勪袱縐嶆柟娉? 浣唃roovy鑷繁鎻愪緵浜唘nique鏂規硶鏉ュ幓闄ら噸澶嶆暟鎹?br />     def list = [1, 2, 3, 2, 4, 1, 5]
    list.unique()  // [1, 2, 3, 4, 5]


Eric.Zhou 2008-08-02 13:55 鍙戣〃璇勮
]]>
Grails Yahoo! UI Library (YUI) Pluginhttp://www.tkk7.com/rain1102/archive/2008/07/29/218550.htmlEric.ZhouEric.ZhouTue, 29 Jul 2008 14:38:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/29/218550.htmlhttp://www.tkk7.com/rain1102/comments/218550.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/29/218550.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/218550.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/218550.htmlThis plugin provides integration with the Yahoo! UI Library. When installing the plugin, it downloads and installs automatically the latest YUI 2.5.2 distribution in your application, and registers itself to be used with the adapative AJAX tags. It also contains two helper tags to easily include additional YUI javascript and css files as well.

Installation

To install the YUI plugin type this command from your project's root folder:

grails install-plugin yui
The complete YUI distribution is downloaded and installed under your project's web-appjsyui2.5.2 folder.

Usage

To use Grails' adaptive AJAX support just add the folowing line in the head section:

<g:javascript library="yui" />
If you want to include additional YUI javascript and css files include them using:
<yui:javascript dir="calendar" file="calendar-min.js" />
<yui:javascript dir="calendar" file="calendar-min.js" version="2.5.2" />
// version to be used in case multiple version installed
<yui:stylesheet dir="calendar/assets" file="calendar.css" />
Refer to the Ajax section of the Grails reference documentation for usage.

Overriding default javascript files

By default only yahoo-dom-event.js and connection-min.js are included when using <g:javascript library="yui" />. Adding additional libraries to the default list can be done in a BootStrap (+) class:

import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib

class BootStrap { def init = { servletContext -> JavascriptTagLib.LIBRARY_MAPPINGS.yui += ["yui/2.5.2/calendar/calendar-min", "yui/2.5.2/container/container-min"] } def destroy = { } }

It's also possible to replace all default included javascript libraries. For example if you want to use the YUI debug javascript files in development mode:
import grails.util.GrailsUtil
import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib

class BootStrap { def init = { servletContext -> if (GrailsUtil.isDevelopmentEnv()) { JavascriptTagLib.LIBRARY_MAPPINGS.yui = ["yui/2.5.2/yahoo/yahoo-debug", "yui/2.5.2/dom/dom-debug", "yui/2.5.2/event/event-debug", "yui/2.5.2/connection/connection-debug"] } } def destroy = { } }

Serving YUI Files from Yahoo! Servers

It's also possible to serve the javascript from the Yahoo! servers. First delete the yui folder from web-appjs after installing the plugin. Then, in a BootStrap class, override the mapping which contains the javascript files to include by default:

import org.codehaus.groovy.grails.plugins.web.taglib.JavascriptTagLib

class BootStrap { def init = { servletContext -> JavascriptTagLib.LIBRARY_MAPPINGS.yui = [] } def destroy = { } }

The only drawback is that you need to include the references to the javascript files manually. Probably the easiest way is to do this in the main.gsp layout.

Upgrading

If you want to upgrade:

  • Delete the plugin from the project's plugins folder
  • (Optional) Delete the previous YUI version folder from web-appjsyui
  • Re-install the plugin by executing grails install-plugin yui


Eric.Zhou 2008-07-29 22:38 鍙戣〃璇勮
]]>
Grails鍒濆鍖栫郴緇熸暟鎹?/title><link>http://www.tkk7.com/rain1102/archive/2008/07/28/218206.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Mon, 28 Jul 2008 15:02:00 GMT</pubDate><guid>http://www.tkk7.com/rain1102/archive/2008/07/28/218206.html</guid><wfw:comment>http://www.tkk7.com/rain1102/comments/218206.html</wfw:comment><comments>http://www.tkk7.com/rain1102/archive/2008/07/28/218206.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/rain1102/comments/commentRss/218206.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/rain1102/services/trackbacks/218206.html</trackback:ping><description><![CDATA[<span style="font-size: 7pt; color: black; font-family: 瀹嬩綋; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial"><span style="font-size: 12pt"><span style="color: black; font-family: 瀹嬩綋; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">姣斿褰撳簲鐢ㄥ惎鍔ㄦ椂鍊欏線user琛ㄤ腑娣誨姞涓鏉℃暟鎹?淇敼</span><span lang="EN-US" style="color: black; font-family: Arial; mso-fareast-font-family: 瀹嬩綋; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"> grails-app\config\BootStrap.groovy </span><span style="color: black; font-family: 瀹嬩綋; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial">鐨勪唬鐮侊細<br />   <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">class BootStrap {</span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">    def init = { servletContext -></span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">        def user = new Users(id:1,username:'rain'</span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">           ,password:'1102')</span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">        user.password = user.password.encodeAsPassword()</span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">        user.save()</span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">    }</span></span></p> <p style="line-height: 14.25pt; text-align: left; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt" align="left"><span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">    def destroy = { }</span></span></p> <span style="font-size: 8.5pt; color: black; font-family: 'Lucida Console'"><span style="font-size: 10pt">}</span></span></span></span></span><img src ="http://www.tkk7.com/rain1102/aggbug/218206.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/rain1102/" target="_blank">Eric.Zhou</a> 2008-07-28 23:02 <a href="http://www.tkk7.com/rain1102/archive/2008/07/28/218206.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Grails涓嬌鐢⊿HA 瀵瑰瘑鐮佸姞瀵?/title><link>http://www.tkk7.com/rain1102/archive/2008/07/28/218205.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Mon, 28 Jul 2008 15:00:00 GMT</pubDate><guid>http://www.tkk7.com/rain1102/archive/2008/07/28/218205.html</guid><wfw:comment>http://www.tkk7.com/rain1102/comments/218205.html</wfw:comment><comments>http://www.tkk7.com/rain1102/archive/2008/07/28/218205.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/rain1102/comments/commentRss/218205.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/rain1102/services/trackbacks/218205.html</trackback:ping><description><![CDATA[鏍規嵁Grails鐨勫懡鍚嶈鑼? 鍒?span lang="EN-US">grails-app\utils </span><span>涓垱寤轟竴涓悕涓?/span><span> </span><span lang="EN-US">PasswordCodec</span><span lang="EN-US"> </span><span>鐨?/span><span lang="EN-US"> Groovy </span><span>綾?寮鴻皟涓涓嬬被鍚嶅繀闇鏄?/span><span lang="EN-US"> XXXCodec)</span> , 浠g爜濡備笅:<br /> <br /> import <a title="Java鐖卞ソ鑰? href="http://www.tkk7.com/rain1102" >Java</a>.security.MessageDigest<br /> import sun.misc.BASE64Encoder<br /> /**<br />  *<br />  * @author eric<br />  */<br /> class PasswordCodec {<br />     static encode = {str -><br />         MessageDigest md = MessageDigest.getInstance('SHA')<br />         md.update(str.getBytes('UTF-8'))<br />         return (new BASE64Encoder()).encode(md.digest())<br />     }<br /> }<br /> 鍐欏ソ浠ュ悗,浣跨敤濡備笅:<br /> user.save()user.password = user.password.<span style="color: red">encodeAsPassword</span>()<br /> user.save()<br /> <br /> def user = User.findByUserNameAndPassword(params.userName, params.password.<span style="color: red">encodeAsPassword</span>())<br /> <br /> <br /><img src ="http://www.tkk7.com/rain1102/aggbug/218205.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/rain1102/" target="_blank">Eric.Zhou</a> 2008-07-28 23:00 <a href="http://www.tkk7.com/rain1102/archive/2008/07/28/218205.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍦∟etBeans IDE涓垱寤篏rails鎻掍歡[杞琞http://www.tkk7.com/rain1102/archive/2008/07/28/218004.htmlEric.ZhouEric.ZhouMon, 28 Jul 2008 03:35:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/28/218004.htmlhttp://www.tkk7.com/rain1102/comments/218004.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/28/218004.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/218004.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/218004.htmlCreating a Grails Plugin in NetBeans IDE

Let's create a plugin for Grails. Grails is, after all, modular and pluggable. Here's the ultimate simple Grails plugin, just to give an idea what is involved, from start to finish. The most useful references I have found so far are these:

Between those three, you should have enough to figure things out. I still found it hard, despite those instructions and so to avoid having to figure things out again some time in the future, I'll write absolutely everything here.

Creating the Plugin

  1. On the command line, run this:
    grails create-plugin SamplePlugin

    Now you have a Grails plugin. However, at the same time it is just another Grails application, which means you can simply open it in NetBeans IDE. (I.e., there is no import process and no NetBeans artifacts are added to the plugin in order to be able to open it in the IDE.)

     

  2. So open the plugin in the IDE. The Projects window isn't very interesting, it just shows you the same as you would normally see for Grails applications:

    The Files window (Ctrl-2) however, shows a lot more:

    Open the "SamplePluginGrailsPlugin.groovy" file and there you see the following:

    class SamplePluginGrailsPlugin {
        def version = 0.1
        def dependsOn = [:]
        def doWithSpring = {
        // TODO Implement runtime spring config (optional)
        }
        def doWithApplicationContext = { applicationContext ->
        // TODO Implement post initialization spring config (optional)
        }
        def doWithWebDescriptor = { xml ->
        // TODO Implement additions to web.xml (optional)
        }
        def doWithDynamicMethods = { ctx ->
        // TODO Implement registering dynamic methods to classes (optional)
        }
        def onChange = { event ->
        // TODO Implement code that is executed when this class plugin class is changed
        // the event contains: event.application and event.applicationContext objects
        }
        def onApplicationChange = { event ->
        // TODO Implement code that is executed when any class in a GrailsApplication changes
        // the event contain: event.source, event.application and event.applicationContext objects
        }
        }

    I.e., you have hooks for integrating your code into meaningful places in the plugin.

     

  3. Now we'll create code that will let our plugin provide a new "constraint". (If you don't know what that is, you will know by the time you finish reading all this.) To do so, we will need to extend org.codehaus.groovy.grails.validation.AbstractConstraint, in a package within src/groovy:
    import org.codehaus.groovy.grails.validation.AbstractConstraint
        import org.springframework.validation.Errors
        class BestFrameworkConstraint extends AbstractConstraint {
        private static final String DEFAULT_MESSAGE_CODE = "default.answer.invalid.message";
        public static final String NAME = "oneCorrectResponse";
        private boolean validateConstraint
        //The parameter which the constraint is validated against:
        @Override
        public void setParameter(Object constraintParameter) {
        if (!(constraintParameter instanceof Boolean))
        throw new IllegalArgumentException("Parameter for constraint ["
        + NAME + "] of property ["
        + constraintPropertyName + "] of class ["
        + constraintOwningClass + "] must be a boolean value");
        this.validateConstraint = ((Boolean) constraintParameter).booleanValue()
        super.setParameter(constraintParameter);
        }
        //Returns the default message for the given message code in the current locale:
        @Override
        protected void processValidate(Object target, Object propertyValue, Errors errors) {
        if (validateConstraint && !validate(target, propertyValue)) {
        def args = (Object[]) [constraintPropertyName, constraintOwningClass,
        propertyValue]
        super.rejectValue(target, errors, DEFAULT_MESSAGE_CODE,
        "not." + NAME, args);
        }
        }
        //Returns whether the constraint supports being applied against the specified type:
        @Override
        boolean supports(Class type) {
        return type != null && String.class.isAssignableFrom(type);
        }
        //The name of the constraint, which the user of the plugin will use
        //when working with your plugin.
        @Override
        String getName() {
        return NAME;
        }
        //Validate this constraint against a property value,
        //In this case, ONLY "Grails" is valid, everything else will cause an error:
        @Override
        boolean validate(target, propertyValue) {
        propertyValue ==~ /^Grails$/
        }
        }

     

  4. Next, back in the Groovy plugin class that we looked at earlier, hook the above class into the plugin, using the "doWithSpring" closure to do so:
    def doWithSpring = {
        org.codehaus.groovy.grails.validation.ConstrainedProperty.registerNewConstraint(
        BestFrameworkConstraint.NAME,
        BestFrameworkConstraint.class);
        }

     

  5. Now, back on the command line, navigate to within the "SamplePlugin" folder. There, run the following:
    grails package-plugin

    Back in the IDE, examine the ZIP file that the above command created:

That ZIP file is your Grails plugin.

Installing the Plugin

Now we will install our plugin in a new application.

  1. First, create a new Grails application by going to the New Project wizard (Ctrl-Shift-N) and choosing Groovy | Grails Application. Click Next and type "SampleApplication" and then click Finish.

     

  2. After the IDE has finished running the "grails create-app" command for you, you will see the new application open in the IDE. Right-click it and choose "Plugins", as shown here:

     

  3. In the Grails Plugins dialog, notice that the list gets filled with many potential plugins that you might want to install, from the Grails plugins repository. Instead, we'll install our own. Click Browse and browse to the ZIP file that we created three steps ago and notice that it appears in the text field at the bottom of the dialog:

     

  4. Click "Install" and then a progress bar appears, ending with the plugin being installed. Notice that you can also uninstall it:

     

  5. Take a look at your application and notice (in the Files window) what's happened to the plugin. It's been unzipped, plus the ZIP file is still there. And all that's been done in the "plugins" folder. Nothing else has changed, which means that uninstallation is as simple as removing the folder from the "plugins" folder:

    Thanks to "convention over configuration", Grails knows exactly where everything is鈥攕o that, for example, the "plugin.xml" file that you see above, if found within the folder structure you see above, is the indicator to Grails that a plugin is available for use.

Using the Functionality Provided By the Plugin

  1. Let's now use our plugin. Create a domain class called "Quiz", after right-clicking the "Domain Classes" node and choosing "Create new Domain Class":

     

  2. Right-click the "Controllers" node and choose "Create new controller". Type "Quiz" and then click Finish. Use the Groovy editor to add one line for adding the scaffolding (and uncomment the other line):

     

  3. Back in the "Quiz" domain class, add your property and use the "oneCorrectResponse" constraint defined in your plugin, as shown here:

    Note: The "oneCorrectResponse" constraint that you see above is the name of the constraint defined in the plugin.

     

  4. And then add the message to the messages.properties file, which is within the "Messages Bundles" node:

     

  5. Run the application and you will see that your constraint will prevent anything other than "Grails" from being considered acceptable, when "Create" is clicked below:

Congratulations, you've created, installed, and used your first Grails plugin!



Eric.Zhou 2008-07-28 11:35 鍙戣〃璇勮
]]>
Grails涓嬌鐢‵ck-editorhttp://www.tkk7.com/rain1102/archive/2008/07/26/217648.htmlEric.ZhouEric.ZhouSat, 26 Jul 2008 05:32:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/26/217648.htmlhttp://www.tkk7.com/rain1102/comments/217648.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/26/217648.html#Feedback2http://www.tkk7.com/rain1102/comments/commentRss/217648.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/217648.htmlhttp://svn.codehaus.org/grails-plugins/grails-fck-editor/tags/RELEASE_0_3/grails-fck-editor-0.3.zip 銆?br /> 鏀懼埌紓佺洏涓?姣斿 D:/down/grails-fck-editor-0.3.zip
瀹夎: grails install-plugin D:/down/grails-fck-editor-0.3.zip
榪欓噷鎴戜嬌鐢ㄧ殑鏄痝rails1.0.3, 鍦ㄥ共瑁呯殑鏃跺欎細鎶ラ敊..
Grails Bug: If the plugin wasn't loaded it should be in the failed plugins list,
but is not. Please report the issue.
Java.lang.IllegalArgumentException: Grails Bug: If the plugin wasn't loaded it s
hould be in the failed plugins list, but is not. Please report the issue.

榪欐椂鍊欏埌鑷繁鐨勫伐紼嬬洰褰曚笅鎵懼埌plugins鏂囦歡澶? 瑙e帇grails-fck-editor-0.3.zip鍒板綋鍓嶇洰褰?
鍦ㄩ〉闈㈤噷浣跨敤fck鏍囩:
<fck:editor id="content" name="content" height="400">
          ${fieldValue(bean:news,field:'content')}
</fck:editor>

鍚姩欏圭洰,


Eric.Zhou 2008-07-26 13:32 鍙戣〃璇勮
]]>
Grails涓璼ortableColumn鏍囩鏀瑰啓鏀寔ajaxhttp://www.tkk7.com/rain1102/archive/2008/07/23/217039.htmlEric.ZhouEric.ZhouWed, 23 Jul 2008 14:49:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/23/217039.htmlhttp://www.tkk7.com/rain1102/comments/217039.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/23/217039.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/217039.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/217039.html鍓嶄袱澶╀粠鍚屼簨閭i噷寰楁潵闇姹? 瑕佹眰涓涓富欏甸潰閲岄潰浣跨敤ajax鍔犺澆涓涓〃鏍? 騫朵笖闇瑕佽〃澶寸偣鍑諱互鍚庡彲浠ユ帓搴? 鍒氭墠鐪嬩簡涓涓媑rails涓殑sortableColumn鏍囩婧愮爜, 璇ユ爣絳炬渶鍚庡叾瀹炲氨鏄敓鎴愪簡涓涓櫘閫氱殑link.
${link(action:action, params:linkParams) { title }}
寰堢畝鍗? 鍙渶瑕佷慨鏀筶ink鐨勭敓鎴愭柟娉? 浣跨敤remoteLink鏉ョ敓鎴愬氨鍙互浜?
def update = attrs.remove("update")
...
${remoteLink(action:action,update:update, params:linkParams) { title }}
褰撶劧update閭d釜鍊奸渶瑕佷紶榪囨潵鐨? 欏甸潰閲岄潰灝辨敼鍐欐垚:
<g:sortableColumnEric property="id" title="Id" update="userlist"/>
涓鍒噊k.
鏈変簡鎺掑簭, 褰撶劧鍒嗛〉涔熻榪欐牱浜? 瀹炵幇搴旇宸笉澶?..
鎶婃墍鏈夌殑link(linkTagAttrs.clone())鏀逛負remoteLink(linkTagAttrs.clone())
榪欓噷涔熷埆蹇樹簡瑕佷紶涓猽pdate鍙傛暟榪囨潵鐨?
淇敼def linkTagAttrs = [action:action]涓?
def update = attrs.remove("update")
def linkTagAttrs = [action:action, update:update]

欏甸潰閲屽氨瑕佹敼涓?
<g:paginateEric update="userlist" total="${User.count()}" maxsteps="3"/>



Eric.Zhou 2008-07-23 22:49 鍙戣〃璇勮
]]>
Grails鐨勫煙綾婚獙璇佽瑙杞琞http://www.tkk7.com/rain1102/archive/2008/07/21/216470.htmlEric.ZhouEric.ZhouMon, 21 Jul 2008 14:47:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/21/216470.htmlhttp://www.tkk7.com/rain1102/comments/216470.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/21/216470.html#Feedback3http://www.tkk7.com/rain1102/comments/commentRss/216470.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/216470.html鍦℅rails閲岋紝鎴戜滑鍙互閫氳繃瀹氫箟綰︽潫灞炴ф潵楠岃瘉涓涓鍩熺被鐨勫疄渚嬨傜害鏉熷睘鎬у湪涓涓彨“constraints”闂寘鐨勫畾涔夈傚彲浠ヤ負棰嗗煙綾婚噷鐨勬瘡涓睘鎬у畾涔夌害鏉熴?br />
class User {
String login
String password
String email
Date age

static constraints = {
login(length:5..15,blank:false,unique:true)
password(length:5..15,blank:false)
email(email:true,blank:false)
age(min:new Date(),nullable:false)
}
}

constraints蹇呴』澹版槑涓簊tatic銆?/p>

鍚屾椂錛屾瘡涓睘鎬х殑綰︽潫灞炴ч兘鏈変笌涔嬪搴旂殑閿欒娑堟伅錛圗rror message code錛夛紝褰撹〃鍗曟湭鑳介氳繃楠岃瘉鐨勬椂鍊欙紝灝嗕細榪斿洖榪欎簺閿欒娑堟伅銆?br /> 榪欎簺閿欒娑堟伅鍦?strong>grails-app/i18n/message.properties閲屽畾涔夈?br /> 渚嬪鎴戜滑瑕佽User鐨別mail涓虹┖鏃惰繑鍥?Please enter your email"錛屽垯鍙互鍦╩essage.properties瀹氫箟錛?br /> user.email.blank=Please enter your email
濡傛灉鐢ㄦ埛娌℃湁鑷畾涔夐敊璇秷鎭紝緋葷粺鍒欎細鐢ㄩ粯璁ょ殑璁劇疆銆傚綋鐒墮粯璁ょ殑娑堟伅鑲畾涓嶄細鏄綘鎯寵鐨?#8230;…

Grails鎻愪緵寰堝楠岃瘉灞炴э紝鍙互婊¤凍涓浜涘熀鏈殑楠岃瘉闇姹傦細

blank
楠岃瘉灞炴ц兘鍚︿負絀猴紝涓嶅厑璁鎬負絀哄垯璁句負false銆?br /> Note: 濡傛灉鍦╢orm閲屼負絀鴻屾彁浜わ紝鍒欏睘鎬х殑鍊兼槸涓涓┖瀛楃涓詫紝鑰屼笉鏄痭ull銆?br /> Example: login(blank:false)
Error message code: className.propertyName.blank

creditCard
濡傛灉瑕佹眰灞炴т負淇$敤鍗″彿鐮侊紝鍒欒涓簍rue銆?br /> Example: cardNumber(creditCard:true)
Error message code: className.propertyName.creditCard.invalid

email
濡傛灉瑕佹眰灞炴т負emial鍦板潃錛屽垯璁句負true銆?br /> Example: contactEmail(email:true)
Error message code: className.propertyName.email.invalid

inList
濡傛灉瑕佹眰灞炴х殑鍊煎繀欏諱負瑙勫畾鐨勫鹼紝鍒欏畾涔夎瀹氱殑鍊箋?br /> Example: name(inList:["Joe", "Fred", "Bob"] )
Error message code: className.propertyName.not.inList

length
綰︽潫瀛楃涓叉垨鑰呮暟緇勭殑闀垮害銆?br /> 榪欎釜綰︽潫灞炴у湪0.5鐗堟湰鏄鍙栨秷錛岀敤size浠f浛銆?/font>
Example: login(length:5..15)
Error message code:
className.propertyName.length.toolong
className.propertyName.length.tooshort

matches
搴旂敤姝e垯琛ㄨ揪寮忓瀛楃涓茶繘琛岄獙璇併?br /> Example: login(matches:"[a-zA-Z]+")
Error message code: className.propertyName.matches.invalid

max
璁懼畾灞炴х殑鏈澶у鹼紝鍊肩殑綾誨瀷蹇呴』璺熷睘鎬т竴鏍楓?br /> Example:
age(max:new Date())
price(max:999F)
Error message code: className.propertyName.max.exceeded

maxLength
璁懼畾瀛楃涓叉垨鑰呮暟緇勭殑鏈澶ч暱搴︺?br /> 鍦?.5鐗堟湰涓鍙栨秷錛岀敱maxSize浠f浛銆?/font>
Example: login(maxLength:5)
Error message code: className.propertyName.maxLength.exceeded

maxSize
璁懼畾涓涓暟瀛楁垨鑰呴泦鍚堢殑鏈澶уぇ灝忋?br /> 鍦?.5鐗堟湰涓笉琚緩璁敤鍦ㄦ暟瀛椾笂錛屾敼鐢╩ax銆?/font>
Example: children(maxSize:25)
Error message code: className.propertyName.maxSize.exceeded

min
璁懼畾灞炴х殑鏈灝忓箋傜被鍨嬪繀欏昏窡灞炴т竴鑷淬?br /> Example:
age(min:new Date())
price(min:0F)
Error message code: className.propertyName.min.notmet

minLength
璁懼畾瀛楃涓插睘鎬ф垨鑰呮暟緇勫睘鎬х殑鏈灝忛暱搴︺?br /> 鍦?.5鐗堟湰涓鍙栨秷錛岀敱minSize浠f浛銆?/font>
Example: login(minLength:5)
Error message code: className.propertyName.minLength.notmet

minSize
璁懼畾涓涓暟瀛楁垨鑰呴泦鍚堢殑鏈灝忓ぇ灝忋?br /> 鍦?.5鐗堟湰涓笉琚緩璁敤鍦ㄦ暟瀛楀睘鎬т笂錛屾敼鐢╩in銆?/font>
Example: children(minSize:5)
Error message code: className.propertyName.minSize.notmet

notEqual
楠岃瘉灞炴х殑鍊兼槸鍚﹁窡鎸囧畾鐨勫肩浉絳夈?br /> Example: login(notEqual:"Bob")
Error message code: className.propertyName.notEqual

nullable
濡傛灉灞炴т笉鍙互涓簄ull錛屽垯璁句負false銆?br /> Note: 濡傛灉鍦ㄨ〃鍗曢噷鏈~浠諱綍涓滆タ鑰屾彁浜ゆ椂錛屽垯浣滀負request parameter錛屽睘鎬х殑鍊間負涓涓┖瀛楃涓詫紝鑰屼笉鏄痭ull銆?br /> Example: age(nullable:false)
Error message code: className.propertyName.nullable

range
闄愬埗灞炴х殑鍊煎湪鎸囧畾鐨勮寖鍥撮噷銆?br /> Example: age(range:minAge..maxAge)
Error message code:
className.propertyName.range.toosmall
className.propertyName.range.toobig

scale
鐗堟湰0.4鎵嶅紑濮嬪嚭鐜扮殑綰︽潫灞炴с?br /> 鏍規嵁璁懼畾鐨剆cale鏁板鹼紝鑷姩鎶婃誕鐐瑰瀷鏁板瓧灝忔暟鐐瑰悗鐨勪綅鏁拌皟鏁翠負璁懼畾鐨勫箋?br /> 閫傜敤浜庝互涓嬫暟鍊肩被鍨嬶細java.lang.Float, Java.lang.Double, and Java.math.BigDecimal (and its subclasses)銆?br /> Example: salary(scale:2)
Error message code: 涓嶈繑鍥為敊璇俊鎭?/p>

size
瑙勫畾涓涓暟鍊鹼紝闆嗗悎鎴栬呭瓧絎︿覆闀垮害鐨勫ぇ灝忋?br /> 鍦ㄧ増鏈?.5涓笉琚緩璁敤鍦ㄦ暟瀛楃被鍨嬬殑灞炴т笂錛屾敼鐢╮ange銆?/font>
Example: children(size:5..15)
Note: 涓嶈兘浣跨敤榪欎釜綰︽潫灞炴у鏋渂lank璁句負true鎴栬卬ullable璁句負true銆?br /> Error message code:
className.propertyName.size.toosmall
className.propertyName.size.toobig

unique
濡傛灉灞炴у繀欏諱負鍞竴錛屽垯璁句負true銆?br /> Example: login(unique:true)
Note: 鏈夊彲鑳戒細鍙戠敓閫氳繃unique楠岃瘉浣嗘槸鍦ㄩ殢鍚庣殑鏁版嵁搴撳偍瀛樺嚭鐜伴敊璇殑鎯呭喌銆傞闃茶繖縐嶆儏鍐靛彂鐢熺殑鏂規硶鏄嬌鐢ㄨ繛緇簨鍔¢殧紱葷駭鍒垨鑰呰繘琛宔ception鐨勫鐞嗐?br /> 浠庣増鏈?.5寮濮嬶紝unique鐨勮寖鍥達紙Scope錛夊彲浠ヨ鎸囧畾銆?Scope"鏄悓涓涓被閲屽叾浠栧睘鎬х殑鍚嶅瓧錛屾垨鑰呰繖浜涘睘鎬у悕瀛楃殑涓涓猯ist銆?br /> Example: group(unique:'department')
涓婇潰鐨勪緥瀛愰噷group鍚嶅湪涓涓猟epartment閲屾槸鍞竴鐨勶紝浣嗘槸鍙兘鍦ㄥ叾浠杁epartment閲屾湁鐩稿悓鍚嶅瓧鐨刧roups銆?br /> Another Example: login(unique:['group','department'])
鍦ㄨ繖涓緥瀛愶紝login鍦╣roup鍜宒epartment閲屽繀欏繪槸鍞竴鐨勩傚彲鑳藉湪涓嶅悓絳塯roup鍜宒epartment閲屼細鏈夌浉鍚岀殑login銆?br /> Error message code: className.propertyName.unique

url
濡傛灉灞炴т負涓涓猆RL鍦板潃錛屽垯璁句負true銆?br /> Example: homePage(url:true)
Error message code: className.propertyName.url.invalid

validator
鍦ㄩ棴鍖呴噷璁懼畾鑷畾涔夌殑楠岃瘉銆?br /> Example:
even( validator: {
return (it % 2) == 0
})
Error message code (default): className.propertyName.validator.invalid
灝嗕細鍦ㄥ彟澶栫殑鏂囩珷閲岃繘琛屼粙緇嶃?/p>

Eric.Zhou 2008-07-21 22:47 鍙戣〃璇勮
]]>
Grails涓璖ervice灞備簨鍔″鐞?/title><link>http://www.tkk7.com/rain1102/archive/2008/07/21/216447.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Mon, 21 Jul 2008 13:29:00 GMT</pubDate><guid>http://www.tkk7.com/rain1102/archive/2008/07/21/216447.html</guid><wfw:comment>http://www.tkk7.com/rain1102/comments/216447.html</wfw:comment><comments>http://www.tkk7.com/rain1102/archive/2008/07/21/216447.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/rain1102/comments/commentRss/216447.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/rain1102/services/trackbacks/216447.html</trackback:ping><description><![CDATA[鍦℅rails涓璖ervice灞傞粯璁ゅ氨鏄敮鎸佷簨鍔$殑,浜嬪姟浼犳挱綰у埆榛樿鏄疨ROPAGATION_REQUIRED.  褰撶劧浣犱篃鍙互璁劇疆transactional = false.<br /> 濡傛灉transactional 璁劇疆涓簍rue, 鍒欏湪Service灞傚浣曟柟娉曞唴閮ㄦ姏鍑篟untimeException綾誨瀷寮傚父, 鎵鏈夋搷浣滃皢浼氬洖婊?<br /> <p>class UserService {</p> <p>    <span style="color: #008000">boolean transactional = true</span></p> <p>    public boolean register(User user, UserInfo userInfo) throws RuntimeException {<br />         if (user.save()) {<br />             userInfo.user = user<br />             if (userInfo.save()) {<br />                 return true<br />             } else {<br />                 throw new <span style="color: #008000">RuntimeException </span>('ServiceException: UserService.register()...');<br />             }<br />         } else {<br />             throw new <span style="color: #008000">RuntimeException </span>('ServiceException: UserService.register()...');<br />         }<br />     }<br /> }</p> 榪欐牱涓嶇鍝釜淇濆瓨澶辮觸, 鏁版嵁閮藉皢浼氬洖婊?<img src ="http://www.tkk7.com/rain1102/aggbug/216447.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/rain1102/" target="_blank">Eric.Zhou</a> 2008-07-21 21:29 <a href="http://www.tkk7.com/rain1102/archive/2008/07/21/216447.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Grails涓殑棰嗗煙綾諱腑綰︽潫,楠岃瘉浠ュ強閿欒娑堟伅澶勭悊http://www.tkk7.com/rain1102/archive/2008/07/20/216253.htmlEric.ZhouEric.ZhouSun, 20 Jul 2008 14:20:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/20/216253.htmlhttp://www.tkk7.com/rain1102/comments/216253.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/20/216253.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/216253.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/216253.htmlGrails鐨勯獙璇佸姛鑳芥槸寤虹珛鍦⊿pring's Validator API鍜屾暟鎹粦瀹氫箣涓婄殑錛屼絾Grails鍦ㄦ鐗規у拰綰︽潫鏈哄埗鐨勫熀紜涓婂張鎻愪緵浜嗙粺涓鐨勫畾涔夐獙璇佺害鏉熺殑鏂規硶銆?br /> 鍦ㄤ竴涓鍩熺被涓紝綰︽潫constraints琚畾涔夊湪constraints灞炴х殑浠g爜鍧椾腑:

class User {

...

    static constraints = {

userName(size:5..15, blank:false, unique:true)

password(size:5..15, blank:false)

email(email:true, blank:false)

age(min:18, nullable:false)

}

}

榪欐牱鍦ㄤ綘姣忔淇濆瓨涓涓璞$殑鏃跺欓兘鍥炲幓璋冪敤validate鏂規硶鏉ラ獙璇?

褰撶劧浣犲彲浠ュ湪浠諱綍瀹炰緥涓婅皟鐢ㄥ叾validate鏂規硶鍘婚獙璇侀鍩熺被.

def user = new User(params)

if(user.validate()) {

// do something with user

} else {

    user.errors.allErrors.each {

println it

}

}

濡傛灉浣犲湪娉ㄥ唽鐨勬椂鍊? 姣斿瑕佽緭鍏ヤ袱嬈″瘑鐮? 榪欐椂鍊欐兂鎶婇敊璇秷鎭篃鏀懼叆棰嗗煙綾葷殑errors灞炴ч噷闈? 鐢變簬棰嗗煙綾葷殑 errors灞炴ф槸Spring鐨凟rrors鎺ュ彛瀹炰緥錛?/span>

Errors鎺ュ彛鎻愪緵浜嗚闂繖浜涢獙璇侀敊璇殑鏂規硶錛屽茍涓旇繕鍙互鍙栧緱鍘熷鐨勫箋?/span>

鍏蜂綋浣跨敤鐨勫疄鐜扮被鏄疊eanPropertyBindingResult

Java.lang.Object

org.springframework.validation.AbstractErrors

org.springframework.validation.AbstractBindingResult

org.springframework.validation.AbstractPropertyBindingResult

org.springframework.validation.BeanPropertyBindingResult

姣忎竴涓秷鎭搴斾竴涓?span style="color: green">org.springframework.validation.ObjectError瀵硅薄.鎵鏈夊彲浠ユ兂棰嗗煙綾葷殑errors灞炴ч噷闈㈢洿鎺ユ坊鍔燨bjectError瀵硅薄灝卞彲浠ヤ簡.

 def error = new ObjectError('password', message(code:'pinpin.register.valid.password.notequal'))

 user.errors.addError(error)



Eric.Zhou 2008-07-20 22:20 鍙戣〃璇勮
]]>
Grails涓嬌鐢⊿pring鐨凧dbcTemplate澶勭悊SQL璇彞http://www.tkk7.com/rain1102/archive/2008/07/18/215891.htmlEric.ZhouEric.ZhouFri, 18 Jul 2008 12:37:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/18/215891.htmlhttp://www.tkk7.com/rain1102/comments/215891.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/18/215891.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/215891.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/215891.html 浣嗚繖涓ゅ紶琛ㄦ病鏈夊叧鑱斿瓧孌?涔熷氨鏄娌℃湁澶栭敭綰︽潫. 浣嗘垜鎯沖湪grail涓煡璇袱寮犺〃, 鑾峰彇閲岄潰鐨刵ame, password, age, email浠ュ強address絳夌瓑. 鏉′歡鏄袱涓猧d鐩哥瓑.
榪欐椂鍊欏浣曞仛鍛??? 鐩墠涓烘鎴戞兂鍒扮殑灝辨槸浣跨敤Spring涓殑JdbcTemplate鏉ュ鐞哠QL璇彞:
class User {
 String name
 String password
}

class UserInfo {
    int age
    String email
    String address
}

鍦╟ontroller涓啓:

def dataSource
    def list = {
      def template = new JdbcTemplate(dataSource)
      def userList = template.queryForList("select ui.name as name, u.password as password, ui.age as age, ui.email as email, ui.address as address  from user u, user_info ui where u.id = ui.id");
      def map = [userList : userList]

      render(view:"list", model:map)
    }


鍦╣sp涓彧瑕佷嬌鐢╝s鍚庨潰鐨勫埆鍚嶆潵鍙栧搴旂殑鍊煎氨鍙互浜?

<table>
                    <thead>
                        <tr>
                            <g:sortableColumn property="name" title="Name" />

                            <g:sortableColumn property="password" title="Password" />

                                <g:sortableColumn property="email" title="Emial" />

                                <g:sortableColumn property="age" title="Age" />

                                <g:sortableColumn property="address" title="Address" />

                        </tr>
                    </thead>
                    <tbody>
                    <g:each in="${userList}" status="i" var="user">
                        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                            <td>${user.name}</td>
                            <td>${user.password}</td>
                            <td>${user.email}</td>
                            <td>${user.age}</td>
                            <td>${user.address}</td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>

娉ㄦ剰:綰㈣壊鐨勯儴鍒嗚鍚嶅瓧涓鏍? 褰撶劧浣犱篃鍙互涓嶄嬌鐢ㄥ埆鍚? 鐩存帴鐢ㄥ師鏉ュ悕瀛椾篃鍙互!

Eric.Zhou 2008-07-18 20:37 鍙戣〃璇勮
]]>
grails璋冪敤瀛樺偍榪囩▼[杞琞http://www.tkk7.com/rain1102/archive/2008/07/18/215656.htmlEric.ZhouEric.ZhouFri, 18 Jul 2008 01:30:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/18/215656.htmlhttp://www.tkk7.com/rain1102/comments/215656.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/18/215656.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/215656.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/215656.html 

鍦ㄧ壒孌婃儏鍐典笅錛?/span>grails搴旂敤闇瑕佽皟鐢ㄦ暟鎹簱鐨勫瓨鍌ㄨ繃紼嬶紝榪欏湪grails鐨勫畼鏂規枃妗i噷杈瑰ソ鍍忔病鏈夋彁鍒拌繃錛屽湪james鐨?/span>blog閲屼粙緇嶅浣曡В鍐寵繖涓棶棰樸?/span>
   
浠g爜杞創濡備笅

Java 浠g爜

  1. class MainController {  
  2.   
  3.   def dataSource // using the datasource we define in the spring's resources.xml  
  4.   
  5.   def index = {  
  6.       Sql sql = new Sql(dataSource)  
  7.       def row = sql.execute("call create_daily_hours(${new Date()+1})")  
  8.   }  
  9. }  

 闇瑕佽鏄庣殑涓浜涙槸錛?/span>grails鏈韓娌℃湁鎻愪緵璁塊棶瀛樺偍榪囩▼鐨勪究鎹鋒柟娉曪紝鑰?/span>groovy鐨?/span>GSQL鎻愪緵浜嗭紝鍥犳grails鍙互鐩存帴鎷胯繃鏉ョ敤浜嗭紝褰撶劧涔熷彲浠ョ敤spring鐨?/span>JdbcTemplate銆?/span>
 
甯屾湜瀵?/span>grails鐢ㄦ埛鏈夌偣鐢ㄣ?/span>

鍘熸枃鍦板潃錛?/span>http://grails.group.javaeye.com/group/blog/86666



My experience with grails is getting richer the longer I use it for web application developing. It's very nice that grails is built on top of spring framework which we can take advantage of. I am not a spring user before but with a help from the nice people at the grails forum I was able to achieve what I want to do.

Calling a stored procedure from a MySQL database or any other database is simple. First we need a datasource which spring could provide for us. I have the following code place in the resources.xml found in the spring folder in your grails folder.


<bean id="dataSource" class=" org.apache.commons.dbcp.BasicDataSource ">
<property name="driverClassName">
    <value>org.hsqldb.jdbcDriver</value>
</property>
<property name="url">
    <value>jdbc:hsqldb:hsql://localhost</value>
</property>
<property name="username">
    <value>sa</value>
</property>
<property name="password">
    <value></value>
</property>
</bean>



I use connection pooling for better performance. In my controller here is how I use the datasource to call a store procedure.


class MainController {

 def dataSource // using the datasource we define in the spring's resources.xml

 def index = {
      Sql sql = new Sql(dataSource)
      def row = sql.execute("call create_daily_hours(${new Date()+1})")
 }
}



That's it! Notice that I am using Groovy SQL instead of Spring JDBCTemplate. It's a lot more friendlier for a beginner.

Grails really makes everything easy here and provides a lot of flexibility thanks to it's nice integration with spring. From here everything is possible.

鍘熸枃鍦板潃錛?/span>http://james-says.blogspot.com/2007/03/grails-little-of-spring-framework.html



Eric.Zhou 2008-07-18 09:30 鍙戣〃璇勮
]]>
鍦╣rails涓嬌鐢╠ojo涓婁紶鏂囦歡 (杞澆)http://www.tkk7.com/rain1102/archive/2008/07/17/215602.htmlEric.ZhouEric.ZhouThu, 17 Jul 2008 14:58:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/17/215602.htmlhttp://www.tkk7.com/rain1102/comments/215602.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/17/215602.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/215602.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/215602.html
<g:javascript library="dojo" />
<g:javascript>
dojo.require(
"dojo.io.IframeIO");
</g:javascript>
<g:form url="[action:'submitToRemoteCall']" id="form2"
enctype
="multipart/form-data">
File: 
<input name="someFile" type="file"></input>
<g:submitToRemote
value
="Submit Upload"
name
="form2"
action
="submitToRemoteUpload"
update
="[success:'message',failure:'error']" />
</g:form>
娉ㄦ剰 form涓啓鍏rl灞炴э紝 鑰屼笖form涓嶈鏈塰ide綾誨瀷鐨刬nput錛屽惁鍒欎細璋冪敤XMLHttpRequest錛岃屼笉鐢↖frameIO

鍦╟ontroller涓啓鍏?br />
def submitToRemoteUpload =
{
def f 
= request.getFile('someFile')
if(f.empty) {
render 
"No file!"
}
 else {
def fileName 
= f.getOriginalFilename()
render(text:
"<html><body><textarea>You called ${actionName} in
${controllerName} with file ${fileName}</textarea></body></html>",
contentType:"text/html", encoding:"UTF-8")
}

}
IframeIO鐨勯粯璁imetype涓簍ext/plain錛屾墍浠ヤ嬌鐢╮ender 錛坱ext錛?..錛夎屼笖濂楀祵鍦?lt;textarea>涓?br />
濡傛灉瑕佽繑鍥瀝ender view銆?鍙互淇敼dojo鐨刣ojo.io.bind()錛宐ind鍙傛暟鍔犱笂mimetype:"text/html"銆俧orm涓殑<g:submitToRemote>鏀逛負
<input onclick="dojo.io.bind({url:'/test/index/submitToRemoteUpload',  
                mimetype:'text/html',
                load:function(type,data,evt){dojo.byId('message')innerHTML = data.body.innerHTML;},
                error:function(type,error) { dojo.html.textContent( dojo.byId('error'),error.message);},
                formNode:dojo.byId('form2')});return false
"
     type
="submit" name="form2" value="Submit Upload">


Eric.Zhou 2008-07-17 22:58 鍙戣〃璇勮
]]>
瀹氬埗Grails鐨剋eb.xmlhttp://www.tkk7.com/rain1102/archive/2008/07/16/215332.htmlEric.ZhouEric.ZhouWed, 16 Jul 2008 14:17:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/16/215332.htmlhttp://www.tkk7.com/rain1102/comments/215332.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/16/215332.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/215332.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/215332.htmlGrails鐨剋eb.xml鏄嚜鍔ㄧ敓鎴愮殑銆傚鏋滈渶瑕佷慨鏀箇eb.xml璇ユ庝箞鍔烇紵

鍏堣涓涓媑rails鐨剋eb.xml鐨勪駭鐢熻繃紼?/p>

Grails鐨剋eb.xml鏄湪Package.groovy鐨刧enerateWebXml target涓敓鎴愮殑銆傚彲浠ュ湪%Grails_Home%/scripts涓嬫壘鍒板畠銆傚叾瀹炲湪榪愯grails war鏃朵篃鏄厛璧扮殑榪欎竴姝ャ?/p>

鍦╣enerateWebXml閲?/p>

1.鍏堝垽鏂湁娌℃湁config.grails.config.base.webXml灞炴э紝濡傛灉鏈夛紝鍒欎嬌鐢ㄦ寚瀹氱殑config.grails.config.base.webXml鍊間綔涓烘渶緇堢殑web.xml

2.濡傛灉娌℃湁config.grails.config.base.webXml灞炴с傚啀鍒ゆ柇鏄惁瀛樺湪%Project_Home%/src/templates/war/web.xml錛屽鏋滃瓨鍦ㄥ氨浣跨敤榪欎釜浣滀負鏈緇堢殑web.xml

3.濡傛灉涓婇潰涓や釜閮芥病鏈夛紝灝變嬌鐢?Grails_Home%/src/war/WEB-INF/web${servletVersion}.template.xml浣滀負鏈緇堢殑web.xml

鏍規嵁涓婇潰鐨勯『搴忥紝鎴戜滑鏈?涓柟娉曟潵鎸囧畾web.xml

絎竴錛屽彲浠ヤ慨鏀?%Project_Home%/grails-app/conf/Config.groovy 鏂囦歡錛屽湪鏂囦歡涓坊鍔?br /> grails.config.base.webXml = "file:${basedir}/web.xml"
鍏朵腑${basedir}浠h〃%Project_Home%錛屽氨鏄浼氬皢%Project_Home%/web.xml浣滀負鏈緇堢殑web.xml銆?/p>

絎簩錛屼嬌鐢?grails install-templates 鍛戒護錛屽畠浼氬垱寤?Project_Home%/src/templates/war/web.xml 鏂囦歡銆傝繖鏍峰彧瑕佷慨鏀硅繖涓獁eb.xml灝辮浜嗐?/p>

絎笁錛屼慨鏀?Grails_Home%/src/war/WEB-INF/web${servletVersion}.template.xml鏂囦歡錛屼絾鏄渶濂戒笉瑕佽繖鏍峰仛銆?/p>

榪欓噷浣跨敤Grails 1.0.1



Eric.Zhou 2008-07-16 22:17 鍙戣〃璇勮
]]>
Grails and uuid.hex generatorhttp://www.tkk7.com/rain1102/archive/2008/07/15/214880.htmlEric.ZhouEric.ZhouTue, 15 Jul 2008 02:05:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/15/214880.htmlhttp://www.tkk7.com/rain1102/comments/214880.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/15/214880.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/214880.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/214880.htmlclass Country {
    String id
    String name
    Boolean active = true

    static mapping = {
         id generator:'uuid.hex', params:[separator:'-']
    }
}

params:[separator:'-']涓轟富閿腑闂翠嬌鐢?-"鍒嗛殧, 姣斿鐢熸垚鏍煎紡涓? 2c9d004d-1b247311-011b-2473734f-0001
褰撶劧鍙互鍘繪帀params:[separator:'-']鐩存帴鍐欐垚

class Country {
    String id
    String name
    Boolean active = true

    static mapping = {
         id generator:'uuid.hex'
    }
}
榪欐牱灝辯敓鎴愭牸寮忎負: 2c9d004d1b247311011b2473ebf90003



Eric.Zhou 2008-07-15 10:05 鍙戣〃璇勮
]]>
宸ユ鍠勫叾浜?蹇呴』鍒╁叾鍣?NetBeans涓緗甮rails鍜実roovy)http://www.tkk7.com/rain1102/archive/2008/07/14/214797.htmlEric.ZhouEric.ZhouMon, 14 Jul 2008 11:10:00 GMThttp://www.tkk7.com/rain1102/archive/2008/07/14/214797.htmlhttp://www.tkk7.com/rain1102/comments/214797.htmlhttp://www.tkk7.com/rain1102/archive/2008/07/14/214797.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/214797.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/214797.html5ipinpin鍒氬紑濮?蹇呯劧瑕侀夋嫨寮鍙戝伐鍏? 涔嬪墠涓鐩存槸eclipse+myeclipse.
鍒氬紑濮嬩嬌鐢╪etbeans灝遍亣鍒伴棶棰? 鏈潵浠ヤ負鍦╪etbeans閲岄潰鍜宔clipse鏄竴鏍風殑, 瀵筭rails鏀寔鏄渶瑕佷笅杞芥垨鑰呮洿鏂版彃浠剁殑.
鎵浠ヤ粖澶╀笂鍗堣繕鎷呭績榪欎簨....鍒氭墠紿佺劧鐪嬪埌璁劇疆grails鐨勫湴鏂? 澶у枩....
涔嬪墠鍦ㄦ湰鍦頒笂寮勪簡grails1.0.2, 鐒跺悗浠婂ぉ鍙堜笅浜唃rails1.0.3, 鎵鏈夋垜榪欓噷灝卞張涓や釜鐗堟湰浜? 鐒跺悗閫氳繃netbeans鐨勮緗緢綆鍗曞氨鍙互鍒囨崲涓や釜鐗堟湰,騫惰繘琛屽紑鍙?..
搴熻瘽鎵繙浜?.鍏蜂綋璁劇疆濡備笅:
Tools->Options->Groovy
涓嬮潰灝辨湁璁劇疆Grails鍜孏roovy鐨勫湴鏂逛簡, 寰堢畝鍗? 閫夋嫨鏈湴璺緞灝卞彲浠ヤ簡, Ok.

璁劇疆tab閿殑size鍙互鍒癊ditor涓嬮潰鐨処ndentation璁劇疆!



Eric.Zhou 2008-07-14 19:10 鍙戣〃璇勮
]]>
緋葷粺緙栫▼璇█鍜岃剼鏈璦http://www.tkk7.com/rain1102/archive/2008/06/15/208114.htmlEric.ZhouEric.ZhouSun, 15 Jun 2008 09:41:00 GMThttp://www.tkk7.com/rain1102/archive/2008/06/15/208114.htmlhttp://www.tkk7.com/rain1102/comments/208114.htmlhttp://www.tkk7.com/rain1102/archive/2008/06/15/208114.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/208114.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/208114.html 緋葷粺緙栫▼璇█搴旇鐢ㄤ簬濡備笅鐩殑:
1.寮鍙戝鏉傜殑綆楁硶鎴栬呮暟鎹粨鏋?br /> 2.瀹炵幇璁$畻瀵嗛泦鍨嬪簲鐢?br /> 3.鎿嶄綔澶у瀷鏁版嵁闆?br /> 4.瀹炵幇鑹ソ瀹氫箟鐨? 緙撴參鍙樻洿鐨勯渶姹?br /> 5.鏄ぇ鍨嬮」鐩殑涓閮ㄥ垎
鑰岃剼鏈璦搴旇鐢ㄤ簬濡備笅鐩殑:
1.榪炴帴宸叉湁鐨勭粍寤?br /> 2.澶勭悊緇忓父鍙樺寲鐨勫縐嶇被鍨嬬殑瀹炰綋
3.鍏鋒湁鍥懼艦鍖栫敤鎴風晫闈?br /> 4.鎷ユ湁蹇熷彉鍖栫殑鍔熻兘
5.鏄皬鍨嬫垨鑰呬腑鍨嬮」鐩殑涓閮ㄥ垎

Eric.Zhou 2008-06-15 17:41 鍙戣〃璇勮
]]>
XML鍜孞SON鍝嶅簲http://www.tkk7.com/rain1102/archive/2008/06/05/206078.htmlEric.ZhouEric.ZhouThu, 05 Jun 2008 08:21:00 GMThttp://www.tkk7.com/rain1102/archive/2008/06/05/206078.htmlhttp://www.tkk7.com/rain1102/comments/206078.htmlhttp://www.tkk7.com/rain1102/archive/2008/06/05/206078.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/206078.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/206078.html浣跨敤render鏂規硶杈撳嚭XML

Grails鏀寔涓浜涗笉鍚岀殑鏂規硶鏉ヤ駭鐢焁ML鍜孞SON鍝嶅簲銆傜涓涓槸闅愬紡鐨勯氳繃render鏂規硶銆?

render鏂規硶鍙互浼犻掍竴涓唬鐮佸潡鏉ユ墽琛屾爣璁扮敓鎴愬櫒浜х敓XML

def list = {
def results = Book.list()
render(contentType:"text/xml") {
books {
for(b in results) {
book(title:b.title)
}
}
}
}

榪欐浠g爜鐨勭粨鏋滃皢浼氬儚榪欐牱錛?

<books>
<book title="The Stand" />
<book title="The Shining" />
</books>

娉ㄦ剰錛屽綋浣犱嬌鐢ㄦ爣璁扮敓鎴愬櫒鏃訛紝蹇呴』灝忓績閬垮厤鍛藉悕鍐茬獊銆備緥濡傦紝榪欐浠g爜灝嗕駭鐢熶竴涓敊璇細

def list = {
def books = Book.list()  // naming conflict here
render(contentType:"text/xml") {
books {
for(b in results) {
book(title:b.title)
}
}
}
}

鍘熷洜鏄紝榪欓噷鐨勪竴涓湰鍦板彉閲?code>books浼佸浘浣滀負鏂規硶琚皟鐢ㄣ?

浣跨敤render鏂規硶杈撳嚭JSON

render 鏂規硶鍙互鍚屾牱琚敤浜庤緭鍑篔SON:

def list = {
def results = Book.list()
render(contentType:"text/json") {
books {
for(b in results) {
book(title:b.title)
}
}
}
}

鍦ㄨ繖縐嶆儏鍐典笅錛岀粨鏋滃氨浼氭槸澶ц嚧鐩稿悓鐨勶細

[
{title:"The Stand"},
{title:"The Shining"}
]

鍚屾牱鐨勫懡鍚嶅啿紿佸嵄闄╅傜敤浜嶫SON鐢熸垚鍣ㄣ?

鑷姩XML鍒楅泦(Marshalling)

錛堣瘧鑰呮敞錛氬湪姝ら檮涓婂浜庡垪闆?Marshalling)瑙i噴錛氬鍑芥暟鍙傛暟榪涜鎵撳寘澶勭悊寰楄繃紼嬶紝鍥犱負鎸囬拡絳夋暟鎹紝蹇呴』閫氳繃涓瀹氬緱杞崲錛屾墠鑳借鍙︿竴緇勪歡鎵鐞嗚В銆傚彲浠ヨ鍒楅泦(Marshalling)鏄竴縐嶆暟鎹牸寮忕殑杞崲鏂規硶銆傦級

Grails鍚屾牱鏀寔鑷姩鍒楅泦(Marshalling)棰嗗煙綾諱負XML閫氳繃鐗瑰畾鐨勮漿鎹㈠櫒銆?

棣栧厛錛屽鍏?code>grails.converters 綾誨寘鍒頒綘鐨勬帶鍒跺櫒錛圕ontrollers錛変腑錛?

import grails.converters.*

鐜板湪錛屼綘鍙互浣跨敤涓嬪垪楂樺害鏄撹鐨勮娉曟潵鑷姩杞崲棰嗗煙綾繪垚XML錛?

render Book.list() as XML

杈撳嚭緇撴灉鐪嬩笂鍘諱細鍍忎笅鍒楄繖鏍鳳細

<?xml version="1.0" encoding="ISO-8859-1"?>
<list>
<book id="1">
<author>Stephen King</author>
<title>The Stand</title>
</book>
<book id="2">
<author>Stephen King</author>
<title>The Shining</title>
</book>
</list>

涓涓嬌鐢ㄨ漿鎹㈠櫒鐨勬浛浠f柟娉曟槸浣跨敤Grails鐨刢odecs鐗規с俢odecs鐗規ф彁渚涗簡encodeAsXML鍜宔ncodeAsJSON鏂規硶:

def xml = Book.list().encodeAsXML()
render xml

 

鑷姩JSON鍒楅泦(Marshalling)

Grails鍚屾牱鏀寔鑷姩鍒楅泦(Marshalling)涓篔SON閫氳繃鍚屾牱鐨勬満鍒躲傜畝鍗曟浛浠?code>XML 涓?code>JSON

render Book.list() as JSON

杈撳嚭緇撴灉鐪嬩笂鍘諱細鍍忎笅鍒楄繖鏍鳳細

[
{"id":1,
"class":"Book",
"author":"Stephen King",
"title":"The Stand"},
{"id":2,
"class":"Book",
"author":"Stephen King",
"releaseDate":new Date(1194127343161),
"title":"The Shining"}
]

鍐嶆浣滀負涓縐嶆浛浠o紝浣犲彲浠ヤ嬌鐢?code>encodeAsJSON杈懼埌鐩稿悓鐨勬晥鏋?



Eric.Zhou 2008-06-05 16:21 鍙戣〃璇勮
]]>
Grails鏂囦歡涓婁紶http://www.tkk7.com/rain1102/archive/2008/06/04/205948.htmlEric.ZhouEric.ZhouWed, 04 Jun 2008 15:50:00 GMThttp://www.tkk7.com/rain1102/archive/2008/06/04/205948.htmlhttp://www.tkk7.com/rain1102/comments/205948.htmlhttp://www.tkk7.com/rain1102/archive/2008/06/04/205948.html#Feedback1http://www.tkk7.com/rain1102/comments/commentRss/205948.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/205948.html 鍙互瀵規枃浠剁殑涓浜涘睘鎬ц緗紝姣斿澶у皬錛?br />
<bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
<value>1000000</value>
</property>
</bean>
褰撶劧gsp欏甸潰闇瑕佸湪form閲岄潰璁劇疆enctype="multipart/form-data"
<g:form method="post" action="save" enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit"/>
</g:form>

涓嬮潰灝辨槸澶勭悊涓婁紶鐨勬枃浠朵簡錛?br />

import org.springframework.web.multipart.MultipartHttpServletRequest
import org.springframework.web.multipart.commons.CommonsMultipartFile

class UploadController {
    static String uploadDir = "uploadfile"
    def index = {
        render(view:"upload")
    }
    def save = {
        if (request instanceof MultipartHttpServletRequest) {
            MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request
            CommonsMultipartFile orginalFile = (CommonsMultipartFile) multiRequest.getFile("file")
            // 鍒ゆ柇鏄惁涓婁紶鏂囦歡
            if (orginalFile != null && !orginalFile.isEmpty()) {
                // 鑾峰彇緋葷粺榛樿鏂囦歡璺緞鍒嗛殧絎?br />                 def separator = System.getProperty("file.separator")
                println "file separator is ${separator} "
                // 鑾峰彇鍘熸枃浠跺悕縐?br />                 String originalFilename = orginalFile.getOriginalFilename()
                // 鑾峰彇涓婁紶鏂囦歡鎵╁睍鍚?br />                 def extension = originalFilename.substring(originalFilename.indexOf(".") + 1)
                println "extension is ${extension}"
                def name = ".." + separator + uploadDir + separator + orginalFile.getOriginalFilename()
                println "file name is : ${name}"
                // 浣跨敤瀛樻斁鏂囦歡鐨勭粷瀵硅礬寰勫垱寤鴻緭鍑烘祦
                 /**
                DataOutputStream out = new DataOutputStream(new FileOutputStream(name))
                InputStream is = null
                try {
                    is = orginalFile.getInputStream()
                    byte[] buffer = new byte[1024]
                    while (is.read(buffer) > 0) {
                      out.write(buffer) // 鍐欏叆紓佺洏
                    }
                } catch (IOException exception) {
                    exception.printStackTrace()
                } finally {
                    if (is != null) {
                        is.close()
                    }
                    if (out != null) {
                        out.close()
                    }
                }
                */
                orginalFile.transferTo(new File(name))
                render(view:"success")
            }
          
        } else {
            println "No multipart"
        }
    }
}




Eric.Zhou 2008-06-04 23:50 鍙戣〃璇勮
]]>
浣跨敤Eclipse寮鍙慓railshttp://www.tkk7.com/rain1102/archive/2008/06/04/205744.htmlEric.ZhouEric.ZhouWed, 04 Jun 2008 03:14:00 GMThttp://www.tkk7.com/rain1102/archive/2008/06/04/205744.htmlhttp://www.tkk7.com/rain1102/comments/205744.htmlhttp://www.tkk7.com/rain1102/archive/2008/06/04/205744.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/205744.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/205744.htmleclipse-jee-europa-winter-win32.zip錛岀劧鍚庤В鍘嬪埌紓佺洏涓娿?br /> 2. 瀹夎Groovy鎻掍歡URL: http://dist.codehaus.org/groovy/distributions/updateDev/錛?span>鐐瑰嚮 Help > Software Updates > Find and Install…錛?br /> 3. 鎶奊RAILS_HOME 娣誨姞鍒?/span> Classpath Variables錛?/span>Windows > Preferences > Java > Build Path > Classpath Variables錛?/span>
4. 紱佺敤 Groovy 鎻掍歡鐨?/span> Class auto generate 鐨勫姛鑳斤紝鍦?/span> Contact 涓?/span> 鍙抽敭 > Properties > Groovy Project properties > 閫夋嫨 Disable Groovy Compiler Generating class Files > 鐐瑰嚮 OK銆?br /> 5.閰嶇疆浣?Web tools 鑳藉緙栬緫 GSP銆傛墦寮 Windows > Preference > General > Editors > File Associations錛屾坊鍔?*.gsp錛屽茍鍏寵仈鍒?JSP Editor 鍗沖彲閰嶇疆浣?Web tools 鑳藉緙栬緫 GSP銆傛墦寮 Windows > Preference > General > Editors > File Associations錛屾坊鍔?*.gsp錛屽茍鍏寵仈鍒?JSP Editor 鍗沖彲銆?br /> 6. 璁劇疆 Content Types錛?/span>Windows > Preference > General > Content Types
鐜板湪涓鍒囧氨緇簡銆?br /> 姝ゆ椂濡傛灉閬囧埌錛?span>groovy.lang.MissingMethodException: No signature of method: groovy.util.ConfigSlurper.parse() is applicable for argument types: (DataSource) values:
%7BDataSource@...}閿欒銆?br /> 鍒欑‘璁や竴涓嬫槸鍚﹀凡緇忕鐢℅roovy 鎻掍歡鐨?/span> Class auto generate 錛屼互鍙婂垹闄ら」鐩洰褰曚笅鐨勬墍鏈塩lass鏂囦歡銆?/span>


Eric.Zhou 2008-06-04 11:14 鍙戣〃璇勮
]]>
Groovy Eclipse Plugin 瀹夎鍙婇棶棰樿В鍐?/title><link>http://www.tkk7.com/rain1102/archive/2008/04/08/191413.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 08 Apr 2008 03:28:00 GMT</pubDate><guid>http://www.tkk7.com/rain1102/archive/2008/04/08/191413.html</guid><wfw:comment>http://www.tkk7.com/rain1102/comments/191413.html</wfw:comment><comments>http://www.tkk7.com/rain1102/archive/2008/04/08/191413.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/rain1102/comments/commentRss/191413.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/rain1102/services/trackbacks/191413.html</trackback:ping><description><![CDATA[瀹夎鍙傝冮摼鎺?<a target="_blank">http://<span id="meqkwuq" class="hilite1">groovy</span>.codehaus.org/<span id="yeseowc" class="hilite2">Eclipse</span>+<span id="igismkk" class="hilite3">Plugin</span></a> <br /> 鎸夌収姝ラ瀹夎鍗沖彲. <br /> 闂1. <br /> 浣跨敤<span id="uceikig" class="hilite2">Eclipse</span>鐨凷oftware Updates榪涜鏇存柊瀹夎鏃舵姤閿?configure閿欒,緙哄皯涓浜沺lug <br /> 瑙e喅鏂規硶: <br /> 閲嶆柊瀹夎<span id="qysuema" class="hilite2">Eclipse</span>,濡傛灉瀹夎鏈塎yclipse,鍙兘鏄疢yclipse鐨勯棶棰?瑕嗙洊瀹夎榪樻湁闂,鏈濂藉垹闄ゅ悗閲嶆柊瀹夎. <br /> <br /> 闂2:<span id="kkeeioc" class="hilite1">Groovy</span> TestNG feature 涓嶈兘瀹夎 <br /> 瑙e喅鏂規硶: <br /> 濡傛灉浣跨敤<span id="agikeek" class="hilite1">Groovy</span> TestNG feature, <br /> 鍒欏簲鍏堝埌TestNG update site <br /> (<a target="_blank">http://testng.org/doc/download.html</a>) <br /> 棣栧厛瀹夎 TestNG <span id="ssmoqmc" class="hilite2">Eclipse</span> plug-in <br /> 濡傛灉涓嶇敤<span id="yosmous" class="hilite1">Groovy</span> TestNG feature,鍒欏彇娑?span class="hilite1">Groovy</span> TestNG feature閫夋嫨鍗沖彲. <br /><img src ="http://www.tkk7.com/rain1102/aggbug/191413.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/rain1102/" target="_blank">Eric.Zhou</a> 2008-04-08 11:28 <a href="http://www.tkk7.com/rain1102/archive/2008/04/08/191413.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Grails鑷畾涔夋爣絳?/title><link>http://www.tkk7.com/rain1102/archive/2008/04/02/190236.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Tue, 01 Apr 2008 16:28:00 GMT</pubDate><guid>http://www.tkk7.com/rain1102/archive/2008/04/02/190236.html</guid><wfw:comment>http://www.tkk7.com/rain1102/comments/190236.html</wfw:comment><comments>http://www.tkk7.com/rain1102/archive/2008/04/02/190236.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/rain1102/comments/commentRss/190236.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/rain1102/services/trackbacks/190236.html</trackback:ping><description><![CDATA[<p><span style="color: #008000">RaceTrackTagLib.groovy錛堟斁鍒癵rails-app\taglib鐩綍涓嬶級</span><br /> class RaceTrackTagLib {<br />  def formatDate = { attrs -><br />   def date = attrs.get('date')<br />   <br />   if (!date) {<br />    date = new Date()<br />   }</p> <p>  def format = attrs.get('format')<br />   if (!format) {<br />    format = "yyyy-MM-dd HH:mm:ss z"<br />   }</p> <p>  out << new <a title="Java鐖卞ソ鑰? href="http://www.tkk7.com/rain1102" >Java</a>.text.SimpleDateFormat(format).format(date)<br />  }</p> <p> def formatNumber = { attrs -><br />   def number = attrs.get('number')<br />   <br />   if (!number) {<br />    number = new Double(0)<br />   }</p> <p>  def format = attrs.get('format')<br />   if (!format) {<br />    format = "0"<br />   }</p> <p>  out << new <a title="Java鐖卞ソ鑰? href="http://www.tkk7.com/rain1102" >Java</a>.text.DecimalFormat(format).format((Double)number)<br />  }<br /> }<br /> </p> <br /> <span style="color: #008000">欏甸潰涓嬌鐢?/span><br /> <g:formatDate date="${race.startDateTime}" format="yyyy-MMM-dd HH:mm"/><br /> <br /> <g:formatNumber number="${race.distance}" format="##0.00 mi"/><br /> <br /><img src ="http://www.tkk7.com/rain1102/aggbug/190236.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/rain1102/" target="_blank">Eric.Zhou</a> 2008-04-02 00:28 <a href="http://www.tkk7.com/rain1102/archive/2008/04/02/190236.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Grails--Quick Starthttp://www.tkk7.com/rain1102/archive/2008/04/01/189897.htmlEric.ZhouEric.ZhouMon, 31 Mar 2008 16:02:00 GMThttp://www.tkk7.com/rain1102/archive/2008/04/01/189897.htmlhttp://www.tkk7.com/rain1102/comments/189897.htmlhttp://www.tkk7.com/rain1102/archive/2008/04/01/189897.html#Feedback0http://www.tkk7.com/rain1102/comments/commentRss/189897.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/189897.html 鍒涘緩Grails欏圭洰
涓鏃︿綘瀹夎榪嘒rails涔嬪悗,浣犲氨鍙互浣跨敤鍐呯疆鐨勫懡浠ゆ潵鍒涘緩鏂扮殑欏圭洰浜?
grails create-app
涔嬪悗浼氭彁紺烘偍,璁╂偍杈撳叆欏圭洰鍚嶇О.
涔熷彲浠ョ洿鎺ュ湪鍛戒護鍚庤緭鍏ラ」鐩殑鍚嶇О.
grails create-app puras_app
鍛戒護鎵ц瀹屼箣鍚?浼氱敓鎴愪竴涓互浣犺緭鍏ョ殑欏圭洰鍚嶄負鍚嶇殑鐩綍,閲岄潰鍒欐槸鑷姩鐢熸垚鐨勭洰褰曠粨鏋勫拰涓浜涘熀紜浠g爜浜?緇撴瀯濡備笅:
%PROJECT_HOME%
    
+ grails-app
       
+ conf                 ---> 鏈湴閰嶇疆鏂囦歡,鍍忔槸鏁版嵁婧?br />        + controllers          ---> 榪欎釜鏂囦歡澶歸噷瀛樻湁Controller綾?br />        + domain               ---> 榪欎釜鏂囦歡澶歸噷瀛樻湁domain綾?br />        + i18n                 ---> 鍥介檯鍖栦俊鎭?br />        + services             ---> location of services
       
+ taglib               ---> 鏍囩搴?br />        + util                 ---> 宸ュ叿搴?br />        + views                ---> 瑙嗗浘
           
+ layouts              ---> 甯冨眬
   
+ hibernate              ---> 鍙夋嫨鐨凥ibernate鐨勯厤緗?br />    + lib
   
+ spring                 ---> 鍙夋嫨鐨凷pring閰嶇疆
   
+ src
       
+ groovy               ---> 鍙夋嫨鐨?groovy婧愪唬鐮?br />        + java                 ---> 鍙夋嫨鐨?java婧愪唬鐮?br />    + war
       
+ WEB-INF
鎺ヤ笅鏉?鍙互閫夋嫨閰嶇疆涓涓暟鎹簮,鍦ㄦ墽琛?create-app"鏃?grails灝卞垱寤轟簡鍑犱釜鏁版嵁婧愬湪浣犵殑%PROJECT_HOME%/grails-app/conf鐩綍閲?瀹冧滑閮芥槸鏍囧噯鐨勭幆澧?DevelopmentDataSource(寮鍙戞暟鎹簮),TestDataSource(嫻嬭瘯鏁版嵁婧?,鍜孭roductionDataSource(浜у搧鏁版嵁婧?.鎵鏈夌殑渚嬪瓙閮芥槸鎿嶄綔鍦ㄥ紑鍙戠幆澧冧箣涓?
鍦ㄦ墽琛屽簲鐢ㄧ殑鏃跺欏彲浠ラ夋嫨鎵灞炵殑鐜(浠ュ悗鏈変粙緇?.
榛樿鐨?姣忎釜鏁版嵁婧愰兘閰嶇疆鐨勬槸鍐呭祵鐨凥SQLDB鏁版嵁搴?鍙互寰堟柟渚跨殑嫻嬭瘯,浣嗘槸鐜板疄鐨勭幆澧冧腑澶ф娌′粈涔堢敤澶?,鎵浠ユ姝ラ鏄彲閫夌殑:
DevelopmentDataSource.groovy
class DevelopmentDataSource {
   
boolean pooling = true
   String dbCreate 
= "create-drop" // one of 'create', 'create-drop','update'
   String url = "jdbc:hsqldb:mem:testDB"
   String driverClassName 
= "org.hsqldb.jdbcDriver"
   String username 
= "sa"
   String password 
= ""
}
閰嶇疆榪欎釜鏁版嵁搴?灝辨槸綆鍗曠殑鏇挎崲涓婃墍甯屾湜浣跨敤鏁版嵁搴撶殑鍊?鍐嶅皢鍏舵墍鐢ㄧ殑椹卞姩鍖呮嫹璐濆埌%PROJECT_HOME%/lib鐩綍涓?
鍒涘緩涓涓疄浣撶被
紜浣犵幇鍦ㄦ墍鍦ㄧ殑鐩綍鏄綘鐨勯」鐩殑涓葷洰褰?涔嬪悗杈撳叆浠ヤ笅鍛戒護
grails create-domain-class
涔嬪悗鍛戒護浼氭彁紺轟綘杈撳叆瑕佸垱寤虹殑綾誨悕,浣犱篃鍙互鐩存帴鍦ㄥ懡浠ゅ悗鐩存帴杈撳叆綾誨悕,濡?
grails create-domain-class Book
鍚戠被閲屾坊鍔犱袱涓睘鎬?
Book.groovy
class Book {
    String title
    String author
}
浣犲彲鑳芥兂瑕佸垱寤轟竴浜涙祴璇曟暟鎹?涓涓畝鍗曠殑鏂規硶灝辨槸鍦?PROJECT_HOME%/grails-app/conf/ApplicationBootStrap.groovy榪欎釜Grails搴旂敤鐨勫惎鍔ㄧ被鐨?init"闂寘閲屽垱寤哄茍淇濆瓨嫻嬭瘯鏁版嵁.
class ApplicationBootStrap {

    def init 
= { servletContext ->
        
// Create some test data
        new Book(author:"Stephen King",title:"The Shining").save()
        
new Book(author:"James Patterson",title:"Along Came a Spider").save()
    }
    def destroy 
= {
    }
}
鍒涘緩Controller
Controllers鏄疓rails搴旂敤鐨勪腑蹇?瀹冧滑澶勭悊WEB璇鋒眰鍜岃姹傜殑URLs,灝嗚姹傚拰璇鋒眰鍙傛暟鏄犲皠鍒版帶鍒跺櫒綾誨拰瀹冮噷闈㈢殑涓涓棴鍖?
鎵ц"grails generate-all"鍛戒護,騫惰緭鍏ユ帶鍒跺櫒鐨勫悕縐?鍦ㄦ垜浠殑渚嬪瓙涓?鎴戜滑鍦ㄧ敓鎴愭帶鍒跺櫒綾葷殑鏃跺欒緭鍏?Book",灝嗕細鍦?PROJECT_HOME%/grails-app/controllers涓嬬敓鎴愪竴涓悕鍙獴ookController.groovy鐨勬枃浠?涔熷彲浠ョ洿鎺ュ湪鍛戒護鍚庣洿鎺ュ姞涓婃帶鍒跺櫒綾葷殑鍚嶇О.
grails generate-all Book
鎵撳紑榪欎釜鏂囦歡,騫舵妸閲岄潰鐨勫唴瀹規浛鎹㈡垚涓嬮潰鎵紺虹殑浠g爜,浣跨敤鍦ㄤ綘鐨勭▼搴忚繍琛岀殑鏃跺欏姩鎬佺敓鎴愮殑鍔ㄦ佽剼鎵嬫灦.
class BookController {
     def scaffold 
= Book
}
瑕佹敞鎰忎綘杈撳叆鐨?Book"鏄ぇ鍐欑殑B寮澶?

褰撶劧,浣犲悓鏍峰彲浠ヤ笉鏇挎崲鑰屼嬌鐢ㄩ粯璁ょ敓鎴愮殑浠g爜.瀹冨彲鏄湁瀛︿範鐨勪環鍊煎摝.

瑕佸紑濮嬩綘鐨凣rails搴旂敤,鎵ц涓嬮潰鐨勫懡浠?br /> grails run-app

榪欎釜鍛戒護灝嗗惎鍔ㄤ竴涓狫etty搴旂敤鏈嶅姟鍣ㄧ殑涓涓疄渚嬭繍琛屽湪8080绔彛涓?涓轟簡鍚姩涓涓繍琛屽湪涓嶅悓绔彛涓?姣斿璇?090,浣跨敤grails -Dserver.port=9090 run-app.瑕佽闂産ooks鐨勪緥琛?鎵撳紑嫻忚鍣?騫惰緭鍏?
http://localhost:8080/puras_app/book/list

綆鍗曠殑灝忓簲鐢ㄥ埌姝ょ粨鏉?鍙傜収瀹?涓句竴榪斾笁,鍋氫竴浜涚畝鍗曠殑灝忓簲鐢ㄨ繕鏄彲浠ョ殑!


Eric.Zhou 2008-04-01 00:02 鍙戣〃璇勮
]]>
瀹夎Grails http://www.tkk7.com/rain1102/archive/2008/03/31/189891.htmlEric.ZhouEric.ZhouMon, 31 Mar 2008 14:49:00 GMThttp://www.tkk7.com/rain1102/archive/2008/03/31/189891.htmlhttp://www.tkk7.com/rain1102/comments/189891.htmlhttp://www.tkk7.com/rain1102/archive/2008/03/31/189891.html#Feedback3http://www.tkk7.com/rain1102/comments/commentRss/189891.htmlhttp://www.tkk7.com/rain1102/services/trackbacks/189891.html1銆侀渶姹?/p>
  • 瑕佹眰瀹夎JDK1.4鎴栦互涓婄増鏈?
  • 璁劇疆JAVA_HOME鐜鍙橀噺錛屾寚鍚慗DK瀹夎浣嶇疆

2銆佸畨瑁匞rails

  • http://grails.codehaus.org/涓嬭澆鏈鏂扮殑Grails鐗堟湰 
  • 灝嗗帇緙╁寘瑙e帇鍒板悎閫傜殑浣嶇疆
  •  璁劇疆GRAILS_HOME鐜鍙橀噺錛屾寚鍚慓rails瀹夎浣嶇疆
  • 灝?GRAILS_HOME%\bin榪藉姞鍒癙ATH鐜鍙橀噺涓?
  • 鍦ㄥ懡浠よ鎵цgrails錛屽鏋滄樉紺篏rails鐨勭増鏈俊鎭紝琛ㄧず瀹夎鎴愬姛錛?/li>


Eric.Zhou 2008-03-31 22:49 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲中文字幕日本无线码| 草久免费在线观看网站| 四虎永久在线精品免费影视| 免费人人潮人人爽一区二区| 国产亚洲精品观看91在线| 国产免费久久精品99re丫y| 无码毛片一区二区三区视频免费播放| 国产aⅴ无码专区亚洲av| 91在线视频免费91| 国产日韩在线视频免费播放| 亚洲成a人片毛片在线| 亚洲AV无码成人精品区大在线| 97在线视频免费播放| 国产成人高清亚洲一区久久| 亚洲午夜久久久精品影院| 国产免费小视频在线观看| 2020因为爱你带字幕免费观看全集| 免费播放美女一级毛片| 久久久久久亚洲精品成人| 亚洲精品无码永久在线观看| 真人做人试看60分钟免费视频 | 美女被免费视频网站a| 亚洲国产高清视频| 国产aa免费视频| 亚洲免费黄色网址| 十八禁视频在线观看免费无码无遮挡骂过| 亚洲激情黄色小说| 亚洲国产成人一区二区精品区| 免费国产成人午夜私人影视| 免费三级毛片电影片| 日本黄色动图免费在线观看| 人人爽人人爽人人片A免费| 国产精品亚洲一区二区麻豆| 久久亚洲精品中文字幕| 亚洲乱码无码永久不卡在线| 亚洲AV网站在线观看| 最好免费观看韩国+日本| 青草草色A免费观看在线| 精品无码国产污污污免费网站| 国产午夜精品理论片免费观看| 亚洲av色香蕉一区二区三区|