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教程三

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

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

在MappingDispatcher 里做了处理。

Hoyi教程三

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

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

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

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

Hoyi教程三


实例代码:

@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

Hoyi教程三