<a href="/my/edit.htm?ServiceRequestId=${history.serviceRequestId}">
修改</a>
/ <a href="/my/delete.htm?id=${history.serviceRequestId}">
删除</a>
上面的URL应该是什么样的模式。我正在使用以下但它不起作用
<intercept-url pattern="/index*" access="permitAll" />
<intercept-url pattern="/register*" access="permitAll" />
<intercept-url pattern="/welcome*" access="hasRole('Techincian')" />
<intercept-url pattern="/my/*" access="hasRole('Techincian')" />
<intercept-url pattern="/my/*\?param=value" access="hasRole('Techincian')" />
答案 0 :(得分:0)
<intercept-url pattern="/my/**" access="hasRole('Techincian')" />
应该有效,但请注意这将匹配<root of the project>/my/something
的内容。以上链接是相对的,可能导致其他一些网址不会被匹配。为了确保从root用户启动,如果你在jsp中,可以使用c:url
。
答案 1 :(得分:0)
Spring Form。我想通过更改其状态更新客户提出的请求。来自控制器的字段。我想将表单提交给控制器以获取值
h2>Update Request</h2>
>form:form method="POST" action="/my/update.htm" commandName="servicehistory">
table align="center" border="0">
<tr><td>Request Id: </td>
<td><form:input path="sr.ServiceRequestId" value="${sr.serviceRequestId}"></form:input> < other fields..............
<tr><td><input type="submit" value="Save" /></td></tr>
控制器访问表单值并更新数据库中的请求。但它没有发生.GUI显示资源不可用。它没有Spring Security。
@RequestMapping(value="/my/update.htm",method=RequestMethod.POST)
public ModelAndView update(@ModelAttribute("servicehistory") @Valid ServiceHistories sh1,BindingResult result,ModelMap map)
{
Redirect it to another page after validating the form
return new ModelAndView(("redirect:/displaylist.htm"));
}
>Spring Security which implement security after matching url and user role
&LT; http auto-config =“true”use-expressions =“true”&gt;
<intercept-url pattern="/admin/*" access="hasRole('Technician')" />
<intercept-url pattern="/my/**" access="hasRole('Techincian')" />
答案 2 :(得分:0)
这是用于将投诉分配给技术人员的JSp页面。点击提交后,它会给出数字格式例外。
<c:forEach items="${hlist}" var="history" varStatus="i">
<tr>
<td><form:input path="requests[${i.index}].ServiceRequestId" value="${history.serviceRequestId }"></form:input></td>
<td><form:input path="requests[${i.index}].Description" value="${history.description }"></form:input></td>
<td><form:select multiple="false" path="requests[${i.index}].userto.UserId">
<form:option value="NONE" label="--- Select ---" />
<c:forEach items="${user}" var="u" varStatus="index">
<form:option label="${u.userName}" value="${u.userId}" />
</c:forEach>
</form:select>
</tr>
</c:forEach>
<tr><td> <input type="submit" value="Assign Technicians"></td></tr>
>Controller : I am using Autopopulating list to access list coming from above form.But it gives Number format exception. But it is working for another scenario which is identical to this one.
@ModelAttribute("requestForm")
public RequestForm getRequest()
{
RequestForm rf=new RequestForm();
rf.setRequests(new AutoPopulatingList(ServiceRequests.class));
return rf;
}
@RequestMapping(value="/admin/assigntech.htm",method=RequestMethod.POST)
public String assign(@ModelAttribute("requestForm") RequestForm requestForm,BindingResult result,ModelMap map)
{
List<ServiceRequests> sr=(List<ServiceRequests>)requestForm.getRequests();
System.out.println(sr.size());
System.out.println(sr.get(0).getUserto().getUserId());
return "Welcome";
}
答案 3 :(得分:0)
要匹配像/ my /这样的文件夹下的所有内容,你应该使用双星**,因为模式匹配遵循Ant标准。