在jsp页面如何获得url参数

u73869 20 0 PDF 2021-01-15 17:01:43

当一个url过来时,如:http://localhost:8080/pro/demo/hello.jsp?name=john,在hello.jsp页面,我们可以这样得到name的值: 代码如下: <% String path = request.getContextPath(); String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”; String name = request.getParameter(“name”);//

用户评论
请输入评论内容
评分:
暂无评论