Hoyi教程三

1.hoyi的两种访问访问方法

1.在项目增加demo3包,并增加demo3Controller类继承Hoyipage。

@RequestMode(MODE={RequestType.POST,RequestType.GET})
public class Demo3Controller extends Hoyipage {

@RequestMode(MODE={RequestType.POST,RequestType.GET})
public void testMe(){
this.WriteUTF8HTML("程序员最帅");
}

}

hoyi 的方法访问通常采用  ip:端口/类路径.后缀?behavior=方法 的方式,这种是通过反射的方式去处理。


hoyi现在支持一种效率更高的访问方式(使用缓存内存来处理)  ip:端口/类路径/方法.后缀

底层在DispatcherServlet 增加了dispatchers.add(new MappingDispatcher());

在MappingDispatcher 里做了处理。

http://localhost:8081/order-core/order/controller/Demo3Controller/testMe.html

2.hoyi的方法新特性,带参数的方式

hoyi的增加了支持带参数访问直接获取参数的方式

需要设置在Eclipse编译时保留方法的形参,如图所示:



实例代码:

@RequestMode(MODE={RequestType.POST,RequestType.GET})
public class Demo3Controller extends Hoyipage {

@RequestMode(MODE={RequestType.POST,RequestType.GET})
public void testMe(String param1,String param2){
this.WriteUTF8HTML("第一个参数"+param1+"第二个参数"+param2);
}

}

访问:http://localhost:8081/order-core/order/controller/Demo3Controller/testMe.html?param1=param1&param2=param2



  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值