我有一个链接
<a href="<c:url value="localhost:8080/CustomerRelationshipManagement/configureUpdate?
firstName=${temp.firstName}&lastName=${temp.lastName}&email=${temp.email}"/>">Update</a>
Run Code Online (Sandbox Code Playgroud)
指向弹簧mvc映射
@RequestMapping(value="configureUpdate", method = RequestMethod.GET)
public String configureUpdate(@RequestParam("firstName") String firstName,
@RequestParam("lastName") String lastName, @RequestParam("email") String email,
Model model)
{
Customer customer = new Customer(firstName, lastName, email);
model.addAttribute("customer", customer);
return "update-customer";
}
Run Code Online (Sandbox Code Playgroud)
因此,eclipse中的浏览器就会显示出来
网页无法显示
我试图解决这个问题,但是在处理完成后没有发现浏览器继续下一个JSP页面的任何方法.
网页无法显示
这是典型的Internet Explorer错误消息,当浏览器无法首先到达目标时将显示该错误消息.例如,由于URL语法损坏.
如果您已经检查过生成的JSP页面的HTML输出,那么您会注意到它生成了以下HTML代码:
<a href="localhost:8080/CustomerRelationshipManagement/configureUpdate?
firstName=&lastName=&email=">Update</a>
Run Code Online (Sandbox Code Playgroud)
它不是以方案或a开头/,因此它变得相对于当前URL.想象一下,当前的URL是http://localhost:8080/CustomerRelationshipManagement/some.jsp,然后目标URL将成为http://localhost:8080/CustomerRelationshipManagement/localhost:8080/CustomerRelationshipManagement/configureUpdate?firstName=&lastName=&email=
这当然无效.目标网址应该已经成为http://localhost:8080/CustomerRelationshipManagement/configureUpdate?firstName=&lastName=&email=.
换句话说,生成的HTML输出应该看起来像:
<a href="http://localhost:8080/CustomerRelationshipManagement/configureUpdate?
firstName=&lastName=&email=">Update</a>
Run Code Online (Sandbox Code Playgroud)
或域相关:
<a href="/CustomerRelationshipManagement/configureUpdate?
firstName=&lastName=&email=">Update</a>
Run Code Online (Sandbox Code Playgroud)
或者,如果当前页面当前位于/CustomerRelationshipManagement文件夹中:
<a href="configureUpdate?firstName=&lastName=&email=">Update</a>
Run Code Online (Sandbox Code Playgroud)
您需要相应地调整JSP代码,使其生成所需的HTML代码.如果JSP页面由与目标URL完全相同的Web应用程序提供,并且您希望继续使用该<c:url>标记,那么它应如下所示:
<c:url var="configureUpdateURL" value="/configureUpdate">
<c:param name="firstName" value="${temp.firstName}" />
<c:param name="lastName" value="${temp.lastName}" />
<c:param name="email" value="${temp.email}" />
</c:url>
<a href="${configureUpdateURL}">Update</a>
Run Code Online (Sandbox Code Playgroud)
它将生成一个域相对URL.
| 归档时间: |
|
| 查看次数: |
152 次 |
| 最近记录: |