java url map_jurlmap

软件简介

jurlmap是一个Java类库,能够让你的Web应用程序拥有简洁,类似于REST的URL。

主要特点:

1. URL参数能够直接绑定至Bean的属性或方法的参数。

2. 配置直接采用Java编码或注释,不需要额外配置文件。

3. URL映射匹配规则简单。

4. 能够很方便集成到Web应用程序中,只要将jurlmap提供的过滤器 Filter加到项目就可以。

URL 配置方法:

protected void configure() {

// In this pattern $ means a string, which when matched

// is bound to parameter `Username` and control forwarded to profile.jsp

// Parameter will be accessible via request.getParameter()

forward("/profile.jsp", "/profile/$Username");

// Here % means integer pattern and * means until end of the pattern.

// Binds integers to parameter ArticleId and forwards to article.jsp

forward("/article.jsp", "/article/%ArticleId/*");

// When matched will send a redirect back to browser and parameters

// are appended to query string so in this case the target will

// be `/servlets/profileservlet?Username=...`

redirect("/servlets/profileservlet", "/member/$Username");

// On match creates an instanc eof LoginPage and calls it's service method

// LoginPage class implements com.pagegoblin.jurlmap.Page.

// If it is annotated with a @Deploy(url) annotation

// the we don't need to pass a url to the deploy method.

// In this case parameters are bound to bean properties or fields

// of the newly created LoginPage instance.

deploy(LoginPage.class);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值