我正在读一本书,作者在应用程序上下文文件中声明了一个控制器,如下所示:
<bean name="/nominee/*"
class="com.springinpractice.ch03.web.NomineeController"
p:thanksViewName="nominee/thanks"/>
我找到了 bean 名称的注释替代项,这是控制器类的注释:
@Controller
@RequestMapping("/nominee/*")
但我想找到thanksViewName 属性的注释替代方案。
这是控制器类的代码:
package com.springapp.mvc;
import com.springapp.model.Member;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
@RequestMapping("/nominee/*")
public final class NomineeController {
private static final Logger log = Logger.getLogger(NomineeController.class);
private String thanksViewName;
public void setThanksViewName(String thanksViewName) {
this.thanksViewName = thanksViewName;
}
@RequestMapping(method = RequestMethod.GET)
public Member form()
{
return new Member();
}
@RequestMapping(method = RequestMethod.POST)
public String processFormData(Member member)
{
log.info("Processing nominee: " + member);
return thanksViewName;
}
}
有任何想法吗?谢谢你。