Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在spring mvc中将变量发送回服务器_Java_Spring - Fatal编程技术网

Java 在spring mvc中将变量发送回服务器

Java 在spring mvc中将变量发送回服务器,java,spring,Java,Spring,我正在尝试重新加载同一页面上的不同内容,这取决于在页面上单击的链接。页面的url模式是“/owners”,这会触发在OwnerController.java中运行此方法: @RequestMapping(value = "/owners", method = RequestMethod.GET) public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {

我正在尝试重新加载同一页面上的不同内容,这取决于在页面上单击的链接。页面的url模式是
“/owners”
,这会触发在
OwnerController.java
中运行此方法:

@RequestMapping(value = "/owners", method = RequestMethod.GET)
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
    Collection<Owner> results = this.clinicService.findOwnerByLastName("");
    model.put("selections", results);
    model.put("sel_owner",this.clinicService.findOwnerById(ownerId));//ownerId is not defined yet
    return "owners/ownersList";
}  
@RequestMapping(value=“/owner”,method=RequestMethod.GET)
公共字符串processFindForm(所有者、BindingResult、映射模型){
收集结果=this.clinicService.findOwnerByLastName(“”);
模型。放置(“选择”,结果);
model.put(“sel_owner”,this.clinicService.findOwnerById(ownerId));//尚未定义ownerId
返回“所有者/所有者列表”;
}  

jsp包含一个动态生成的
ownerId
整数值列表,每个整数值都可用于将唯一的
ownerId
发送回服务器。当运行
processFindForm()
时,我需要向jsp添加什么才能获得
ownerId
以具有用户指定的值?换句话说,超链接需要什么样的外观

您使用的是GET请求类型。如果您想向控制器发送任何参数,则必须基于需求使用@RequestParam@PathParam注释作为控制器方法的参数。在你的情况下,它会像

public String processFindForm(@RequestParam("ownerID") String ownerId, BindingResult result, Map<String, Object> model) {... } 
公共字符串processFindForm(@RequestParam(“ownerID”)字符串ownerID,BindingResult,映射模型){…}

也可以查看此链接:

谢谢。我问题的另一部分呢?我需要向jsp添加什么,以便用户可以单击jsp中的每个ownerId,只将特定的ownerId发送回服务器?