Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.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
Javascript 如何在jsp中传递url参数,如果我使用request.getParameter(';type';),我将得到null_Javascript_Angularjs_Html_Jsp_Stored Procedures - Fatal编程技术网

Javascript 如何在jsp中传递url参数,如果我使用request.getParameter(';type';),我将得到null

Javascript 如何在jsp中传递url参数,如果我使用request.getParameter(';type';),我将得到null,javascript,angularjs,html,jsp,stored-procedures,Javascript,Angularjs,Html,Jsp,Stored Procedures,我必须在jsp中传递一个url参数,该参数将在具有输入参数@param的存储过程中使用,该参数应该来自html页面,该页面有一个链接,我在其中提供查询参数 但在我的jsp页面中,如果我使用request.getParameter('type'),我将得到null,并且未设置存储过程param。请在这方面指导我 `String type=request.getParameter(“type”); 打印(打印); sql=“EXEC dbo.GetDetails@PARAM=“+type+”,@U

我必须在jsp中传递一个url参数,该参数将在具有输入参数
@param
的存储过程中使用,该参数应该来自html页面,该页面有一个链接,我在其中提供查询参数

但在我的jsp页面中,如果我使用
request.getParameter('type')
,我将得到null,并且未设置存储过程param。请在这方面指导我

`String type=request.getParameter(“type”);
打印(打印);
sql=“EXEC dbo.GetDetails@PARAM=“+type+”,@USER_ID=“+userid+”,@OUTResult=null,@OutMessage=null;”`
.state(“链接”{
url:“/link?type”,
templateUrl:“views/subscriptions.html”,
控制器:“Xcontroller”,
})
您的request.getParameter('type')为null,这意味着在url中没有传递命名为'type'的参数。查看带有?type='value'的url,如果该url不存在,则表明您的url有问题


正如您所说的,您需要发送包含URL的类型参数

发送URL值时,需要使用
urlcoder.encode(partialURL,“UTF-8”),然后发送到JSP

一旦您收到使用类型paremater的请求,使用
String type=request.getParameter(“type”)
您需要使用
urldecode.decode(urlDecodedURL,“UTF-8”)

请参阅以下代码:

public static void main(String[] args) throws UnsupportedEncodingException {
    String partialURL = "https://www.website.com/document?type=\"http://www.ibm.com/analytics/us/en/technology\"";
    String urlDecodedURL=URLEncoder.encode(partialURL, "UTF-8");
    System.out.println(urlDecodedURL);
    System.out.println("\n");
    System.out.println(URLDecoder.decode(urlDecodedURL, "UTF-8"));

}

希望这能解决你的问题

链接来自上面提到的不同html页面,单击它后,我需要捕获参数并将其传递给jsp。这是我的主意。如果你有任何想法,请提出建议