Java 如何通过http请求将UI写入表?
我想通过http请求从我的UI写入一个表 我只是一个实习学生,所以我的知识不是很好 到目前为止,我真的不知道该怎么做。我知道我将不得不使用@POST,但我该如何实现它,我的UI中显示的表将写入后端的表Java 如何通过http请求将UI写入表?,java,database,http,Java,Database,Http,我想通过http请求从我的UI写入一个表 我只是一个实习学生,所以我的知识不是很好 到目前为止,我真的不知道该怎么做。我知道我将不得不使用@POST,但我该如何实现它,我的UI中显示的表将写入后端的表 提前感谢您的提示或帮助 在servlet中,需要编写以下内容以检索参数: protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
提前感谢您的提示或帮助 在servlet中,需要编写以下内容以检索参数:
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
HttpSession session = req.getSession();
String nome = req.getParameter("nome");
...
}
在jsp页面中,您需要使用如下表单:
<form action="LoginServlet" method="post">
Name:<input type="text" name="username" /><br />
<br /><input type="submit" value="login" />
</form>
名称: