我尝试根据本教程创建一个友好的网址政策 https://www.liferay.com/fr/community/wiki/-/wiki/Main/FriendlyURLMapper 但是我想将url重定向到一个函数而不是一个页面(使用faces config),因为在运行之前页面需要在模型上设置很多参数 换句话说,我想在重定向页面之前设置bean模型值 有什么建议吗?
答案 0 :(得分:0)
正如我所假设的,您想要制作某种后端逻辑,然后只需将用户重定向到某个页面即可。这是一个简单的例子,我将如何自己实现它。
@ActionMapping(params = {"param1", "param2"})
public void setMethod(@RequestParam String param1, @RequestParam String param1, ActionRequest actionRequest, ActionResponse actionResponse, Model model){
//your rocket science logic...
actionResponse.setRenderParameter("action", "redirectActionName");
}
@RequestMapping(params= {"action=redirectActionName"})
public String view(RenderRequest renderRequest, RenderResponse renderResponse, Model model) {
//target of redirection
return "viewPath";
}
然后根据刚刚引用的文章制作正确的路线映射。希望它有所帮助。