gpt4 book ai didi

jquery - 电话和手机中jquery的设计模式保存在mysql中

转载 作者:行者123 更新时间:2023-11-30 01:30:46 26 4
gpt4 key购买 nike

您好,我有一个 Web 表单 cadastra.jsp,其中包含电话和手机字段。我的 Mysql Db 的 pf_telefone 和 pf_celular int(10) 列分别不为空。我有一个 jquery 函数来设计这些字段的输入。看:

<script>
jQuery(function($){
$("#tel").mask("(99) 9999-9999");

});
</script>
<script>
jQuery(function($){
$("#cel").mask("(99) 9999-9999");

});
</script>

我的servlet:

    public class AddDados extends HttpServlet{
protected void service(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {


PrintWriter out = response.getWriter();
String telefone = request.getParameter("tel");
String celular = request.getParameter("cel");

但我收到错误 HTTP 状态 500 - com.mysql.jdbc.MysqlDataTruncation:数据截断:不正确的整数值:第 1 行的“pf_telefone”列的“(98) 8714-3765”我该如何修复它?

最佳答案

嗯,(98) 8714-3765 不是整数。如果这是您需要存储电话号码的格式,那么您需要将数据库字段转换为字符。我认为 char(14) 根据您使用的掩码适合您。

或者,如果您确实想将它们存储为整数,则应该相应地更改您的输入掩码。

关于jquery - 电话和手机中jquery的设计模式保存在mysql中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17493451/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com