I am using Spring MVC in the backend system and HTML, AJAX, JSON with jQuery in the frontend system. I have two pages. The first one is called: http://localhost:8080/myproject/start
我在后端系统中使用Spring MVC,在前端系统中使用带有jQuery的HTML,AJAX,JSON。我有两页。第一个叫做:http:// localhost:8080 / myproject / start
There I initialize data and make AJAX/JSON calls within jQuery's
在那里我初始化数据并在jQuery中进行AJAX / JSON调用
$(document).ready(function() { ... });
But in this page I have a link on the next page: http://localhost:8080/myproject/nextpage/ID where ID is an unique number.
但是在这个页面中,我在下一页有一个链接:http:// localhost:8080 / myproject / nextpage / ID其中ID是唯一编号。
The problem is, this number do I need in the backend system to load more data. So I have in the backend system:
问题是,在后端系统中我需要这个数字来加载更多数据。所以我在后端系统中:
@RequestMapping(value="/nextpage/{ID}", method=RequestMethod.GET)
public String getCreateForm(Model model) {
return "nextpage/nameofthejsp";
}
So all I do is to call the JSP and there is also a
所以我所做的就是调用JSP,还有一个
$(document).ready(function() { ... });
So, how can I access the ID number of the URL within jQuery? Or, I have this ID number first in the backend system, can I handle this number there instead of loading the frontend and then make a call to the backend?
那么,我如何在jQuery中访问URL的ID号呢?或者,我在后端系统中首先拥有此ID号,我可以在那里处理此号码而不是加载前端然后拨打后端电话吗?
Does anyone has an idea?
有没有人有想法?
Best Regards.
最好的祝福。
1 个解决方案
#1
1
Not sure i understand correctly; You want to access the ID in the next page?
不确定我理解正确;您想在下一页中访问该ID吗?
Is this what you are trying to do?
这是你想要做的吗?
@RequestMapping(value="/nextpage/{ID}", method=RequestMethod.GET)
public String getCreateForm(@PathVariable("ID") int id, Model model) {
/**
Do something
**/
model.addAttribute("ID", id);
return "nextpage/nameofthejsp";
}
and in your nextpage/nameofthejsp JSP, ID will be accessible: ${ID}
在您的nextpage / nameofthejsp JSP中,ID可以访问:$ {ID}
#1
1
Not sure i understand correctly; You want to access the ID in the next page?
不确定我理解正确;您想在下一页中访问该ID吗?
Is this what you are trying to do?
这是你想要做的吗?
@RequestMapping(value="/nextpage/{ID}", method=RequestMethod.GET)
public String getCreateForm(@PathVariable("ID") int id, Model model) {
/**
Do something
**/
model.addAttribute("ID", id);
return "nextpage/nameofthejsp";
}
and in your nextpage/nameofthejsp JSP, ID will be accessible: ${ID}
在您的nextpage / nameofthejsp JSP中,ID可以访问:$ {ID}