bboss mvc控制器方法跳转地址设置方法介绍

bboss mvc控制器方法跳转地址设置方法介绍

[size=large][b]1.直接指定跳转地址[/b][/size]

public String showlistjsp(ModelMap model) {
List<ListBean> beans = null;
try {
beans = (List<ListBean>) SQLExecutor.queryList(ListBean.class,
"select * from LISTBEAN");
model.addAttribute("datas", beans);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return "/databind/table.jsp";

}


[size=large][b]2.指定跳转地址别名[/b][/size]
地址别名以path:前缀开头,别名对应的地址在mvc控制器配置文件中指定

	public String showlist(ModelMap model) {
List<ListBean> beans = null;
try {
beans = (List<ListBean>) SQLExecutor.queryList(ListBean.class,
"select * from LISTBEAN");
model.addAttribute("datas", beans);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

// return "/databind/table.jsp";
return "path:showlist-ok";//返回地址别名
}


在mvc控制器中配置别名path:showlist-ok对应的实际页面地址:
 <property name="/pathalias/*.htm"

path:showlist-ok="/databind/table.jsp"
class="org.frameworkset.spi.mvc.PathController"/>

[size=large][b]3.设置地址跳转的方式-forward和redirect[/b][/size]
可以在跳转地址中指定跳转的两种模式:
forward 直接指向到目标页面,forward是默认方式,与来源请求是一个请求
redirect 重定向到目标页面,重新发出http请求
两种方式的使用示例:
redirect:
public String showlistjsp(ModelMap model) {
List<ListBean> beans = null;
try {
beans = (List<ListBean>) SQLExecutor.queryList(ListBean.class,
"select * from LISTBEAN");
model.addAttribute("datas", beans);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return "redirect:/databind/table.jsp";

}


forward:
public String showlistjsp(ModelMap model) {
List<ListBean> beans = null;
try {
beans = (List<ListBean>) SQLExecutor.queryList(ListBean.class,
"select * from LISTBEAN");
model.addAttribute("datas", beans);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

return "forward:/databind/table.jsp";

}

在地址别名中设置forward和redirect
path:showlist-ok="forward:/databind/table.jsp"
path:showlist-ok="redirect:/databind/table.jsp"


[size=large][b]4.从一个地址别名跳转到其他地址别名[/b][/size]
可以从一个地址别名跳转到其他地址别名,设置方法:
 <property name="/pathalias/*.htm"
path:showlist-ok="/databind/table.jsp"
path:delete-ok="path:showlist-ok"
path:deletebatch-ok="path:showlist-ok"
path:update-ok="path:showlist-ok"
path:updatebatch-ok="path:showlist-ok"
path:listbean-ok="path:showlist-ok"
class="org.frameworkset.spi.mvc.PathController"/>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值