您的評(píng)價(jià): |
主要特點(diǎn):
1. URL參數(shù)能夠直接綁定至Bean的屬性或方法的參數(shù)。
2. 配置直接采用Java編碼或注釋,不需要額外配置文件。
3. URL映射匹配規(guī)則簡(jiǎn)單。
4. 能夠很方便集成到Web應(yīng)用程序中,只要將jurlmap提供的過濾器 Filter加到項(xiàng)目就可以。
URL 配置方法:
01 | protected void configure() { |
02 | // In this pattern $ means a string, which when matched |
03 | // is bound to parameter `Username` and control forwarded to profile.jsp |
04 | // Parameter will be accessible via request.getParameter() |
05 | forward( "/profile.jsp" , "/profile/$Username" ); |
06 | |
07 | // Here % means integer pattern and * means until end of the pattern. |
08 | // Binds integers to parameter ArticleId and forwards to article.jsp |
09 | forward( "/article.jsp" , "/article/%ArticleId/*" ); |
10 | |
11 | // When matched will send a redirect back to browser and parameters |
12 | // are appended to query string so in this case the target will |
13 | // be `/servlets/profileservlet?Username=...` |
14 | redirect( "/servlets/profileservlet" , "/member/$Username" ); |
15 | |
16 | |
17 | // On match creates an instanc eof LoginPage and calls it's service method |
18 | // LoginPage class implements com.pagegoblin.jurlmap.Page. |
19 | // If it is annotated with a @Deploy(url) annotation |
20 | // the we don't need to pass a url to the deploy method. |
21 | // In this case parameters are bound to bean properties or fields |
22 | // of the newly created LoginPage instance. |
23 | deploy(LoginPage. class ); |
24 | } |
官方網(wǎng)站:http://www.open-open.com/lib/view/home/1323612203561
聯(lián)系客服