我有一个像这样写的GET方法的控制器:
@Controller
public class ThingController {
@RequestMapping( value = "/Thing.html", method = RequestMethod.GET )
public String editThing(@RequestParam( "thingId" ) String thingId, @ModelAttribute ThingBean thing, BindingResult result) {
thing = <some service call using thingId>
logger.debug("The thing to edit is {}", thingBean);
return "thing/edit";
}
}
Run Code Online (Sandbox Code Playgroud)
bean是正确的(getter和setter),服务调用使用thingId返回正确的ThingBean,并且在thing/edit.jsp上的JSP页面显示出来.
JSP是:
<html>
<body>
<h1 id="title" class="title">Edit Thing</h1>
<form:form id="thing" modelAttribute="thing">
<form:input path="subject" id="subject" tabindex="1" />
<form:textarea path="message" />
</form:form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
然而,JSP显示主题和消息的空白值.是的,这些房产上有吸气剂/固定剂.
我有一个非常相似的控制器工作正常,除了在那里的GET映射方法的签名中没有@RequestParam.
我没有在Spring WebMVC文档中看到任何地方说我不能这样做 - 为什么它不起作用?为什么更新后的ModelAttribute对象没有绑定到JSP表单中?
编辑:
这个控制器和GET调用的相同模式已经工作了很多不同的地方 - 用@ModelAttribute注释的变量由方法填充,然后可供JSP页面显示.为什么,通过添加@RequestParam注释,它会停止吗?
@RequestMapping( value = …Run Code Online (Sandbox Code Playgroud) 我使用FirefoxDriver进行WebDriver测试,我尝试将其作为Jenkins作业运行.
它在Windows中运行良好,它也可以在我的Jenkins服务器所在的Linux命令行中运行.
不幸的是,我在执行Jenkins工作时遇到以下错误:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
Run Code Online (Sandbox Code Playgroud)
Jenkins作业包含两个步骤:执行的shell步骤:
Xvfb :1 -screen 0 1024x768x24 &
export DISPLAY=:1
Run Code Online (Sandbox Code Playgroud)
然后是一个maven包来运行测试类.
为什么我不能让Jenkins工作来执行Firefox?