我写的代码如下。如何使用RedirectAttributes在另一个控制器中调用一个控制器方法
Controller1 {
@Autowired
Controller2 controller2
//Caller method
void method1() {
controller2.furnction1(model,redirectattributes);
}
}
Controller2 {
public void function1(Model model, RedirectAttributes atr){
}
}
的问题是:如何 并初始化在我的新控制器(控制器1)RedirectAttributes(redirectattributes)。 我的Controller1不是表单提交,所以我无法获得RedirectAttributes默认情况下。
如何在controller2中调用funcation1。
Dosent真正的样子代码!可以? – Prashant
寻求调试帮助的问题(“为什么这个代码不工作?”)必须包含所需的行为,特定的问题或错误以及在问题本身中重现问题所需的最短代码。没有明确问题陈述的问题对其他读者无益。请参阅:如何创建最小,完整和可验证示例。 –
我写了高级表示法。 – user3686738