html - 使用 JSP 将数据库中的自动增量 ID 显示到 html 文本字段中

标签 html mysql jsp auto-increment

这个问题在 2016 年初被问过,但问的人没有得到答案。那么有谁知道如何获取这个已经是 AI 的 ID,但我需要它以 html 形式自动显示。 因此,我要插入一个尚未分配 ID 的新用户。

       <h3>Kreirati korisnika</h3>
    <form action="kreiraj_korisnika.jsp">
      <div class="form-group" >
        <label for="id_clan" >ID:</label>
        <input type="text" class="form-control" id="id_clan" name="id_clan">
      </div>

最佳答案

首先您必须获得下一个可能的 ID。 检查此说明:

https://dev.mysql.com/doc/refman/8.0/en/getting-unique-id.html

然后您可以使用数据:

文本框:

<input type="text" class="form-control" id="id_clan" name="id_clan" value="<%= yourId%>"/>

JSP代码:

<%! String yourId; %>
<%
  //do some code to receive your data
  yourId="YOUR_ID";
%> 

请参阅此处了解更多信息: Assign value to HTML textbox from JSP

https://www.quora.com/How-do-I-pass-the-text-entered-into-an-HTML-text-box-to-a-Java-method-if-I-am-using-JSP

关于html - 使用 JSP 将数据库中的自动增量 ID 显示到 html 文本字段中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50209289/

相关文章:

html - 将图像放在 div 上

mysql - Mediawiki MySQL 的 CPU 负载有时很高

java - 将多个参数从 JSP scriptlet out.println 传递给 javascript 函数

mysql - 如何将子查询写成 not null as join

JSP页面指令

java - 如何在 Struts2 中使用 Bean 将对象从 Action 类传递到 JSP?

jquery - 将动画顺序添加到 animate.css

php - 表单中的静态值

javascript - 保存动态创建的按钮

php - 如何在 SQL 语句中正确引用 PHP session 变量