HTMLフォームからJavaで書かれた残りのWebサービスを呼び出そうとしています
私のWebサービスコードは
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("/hello")
public class Hello {
@POST
@Path("/hello")
@Consumes(MediaType.TEXT_HTML)
@Produces(MediaType.TEXT_HTML)
public String hello( @FormParam("username") String name1) {
return "<html> " + "<title>" + "Hello Jersey" + "</title>"
+ "<body><h1>" + "Hello from helpdesk" + "</body></h1>" + "</html> ";
}
}
そして、私のhtmlページは
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action= "http://localhost:8080/helpdesk/rest/hello" method="POST">
Username: <input type="text" name="username">
<p>
<input type="submit" value="Submit">
</form>
</body>
</html>
ここの HTML フォームでは、Web サービス ../rest/hello を呼び出しています。http://www.vogella.com/articles/REST/から例を参照しました
誰でも方法を教えてもらえますか?
ありがとうございました