你好,我的控制器是
$('#fullpage').fullpage({
afterRender: fuction(){
$.fn.fullpage.setAllowScrolling(false, 'down')
}
});
我能够获取pathVariable name.Now我想将名称传递给另一个返回字符串的URL,该字符串将从控制器返回。我试过但是无法从控制器调用URL
答案 0 :(得分:1)
您可以使用Apache的HttpClient调用servlet。这是一个例子:
...
private static final String SERVLETURL = "http://ipaddress/input?input_text=tell";
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpGet = new HttpGet(SERVLETURL);
CloseableHttpResponse response = httpclient.execute(httpGet);
HttpEntity entity = response.getEntity();
String responseBody = getStringFromInputStream(response.getEntity().getContent());
//Processing here
EntityUtils.consume(entity);
...