精华内容
下载资源
问答
  • jsp修改数据库代码The difference between a good and a bad commit can be huge. It’s no fun having to ask your colleague — or your past self — what a particular change was about, or what the current ...

    jsp修改数据库代码

    The difference between a good and a bad commit can be huge. It’s no fun having to ask your colleague — or your past self — what a particular change was about, or what the current state of things is. If you commit changes to your codebase the right way, you can avoid headaches down the road.

    一次好和一次差的提交之间的差异可能很大。 询问同事或过去的自我,这是什么意思,这是什么有趣的事,或者当前的状况是什么。 如果您以正确的方式提交对代码库的更改,则可以避免日后的麻烦。

    This article aims to provide a thorough guide to the best practices of software commits.

    本文旨在提供有关软件提交最佳实践的详尽指南。

    何必呢? (Why Bother?)

    If you’re already storing your projects on GitHub, you might assume the files are safe and that whenever you need to update code you’ll pull the changes, and that’s enough. All of that might be true. But let’s see what potential problems you can avoid by going the extra mile, and what additional benefits await if you do.

    如果您已经将项目存储在GitHub上,则可以假设这些文件是安全的,并且每当需要更新代码时,都将进行更改,这就足够了。 所有这些可能都是正确的。 但是,让我们看看通过加倍努力可以避免哪些潜在的问题,以及这样做还有哪些其他好处。

    没有人是孤岛,无论是团队合作还是个人 (No Man Is an Island, Either in Teams or Individually)

    The reasoning above typically comes from a developer used to working alone. But the moment they need to share code with somebody else, we can expect that things are going to get messy and require a lot of explanation. Like, a lot.

    上面的推理通常来自习惯于独自工作的开发人员。 但是,当他们需要与他人共享代码时,我们可以预料事情会变得混乱,并且需要大量解释。 就像, 很多

    Remember that our work doesn’t end at just writing code. We also need to manage things, and that requires a degree of organization and methodology. And while working in teams more readily exposes the problems caused by poor organization, we can also benefit from a better approach when working by ourselves.

    请记住,我们的工作并不仅限于编写代码。 我们还需要管理事物,这需要一定程度的组织和方法。 尽管在团队中工作更容易暴露出组织不善所导致的问题,但当我们自己工作时,我们也可以从更好的方法中受益。

    原子与膨胀承诺 (Atomic vs Bloated Commits)

    We’ve all needed to revert a small change and found ourselves searching for it when a massive commit changes dozens of files and adds multiple features. How much easier would the rollback be if it was located in one commit that only addressed that specific issue?

    我们所有人都需要还原一个小的更改,并发现自己在大规模提交更改数十个文件并添加多个功能时正在寻找它。 如果回滚位于仅解决该特定问题的一次提交中,回滚将有多容易?

    凌乱,肿胀的方式 (The Messy, Bloated Way)

    git add *
    git commit -m "new components"

    In this example, we can bet that a large number of files are being affected. Additionally, the message “new components” doesn’t tell us much of anything — such as what components, which functionality for those components, and if the functionality is new or a refactor. Also, are any existing bugs being addressed?

    在此示例中,我们可以打赌大量文件正在受到影响。 此外,“新组件”消息并没有告诉我们任何信息-例如哪些组件,这些组件的功能以及该功能是新功能还是重构功能。 此外,是否解决了任何现有的错误?

    That information will be important when we need to change or recover something. We’ll be trying to find a needle in a haystack, and we might just end up looking at the codebase instead and spending valuable time debugging while we’re at it.

    当我们需要更改或恢复某些东西时,这些信息将很重要。 我们将试图在大海捞针中找到一针刺刀,然后我们可能最终只是看一下代码库,并在调试时花了宝贵的时间进行调试。

    原子方式 (The Atomic Way)

    git add ui/login.html static/js/front-end.js
    git commit -m "validate input fields for login"

    Now we’re getting somewhere, as we start to have a clearer idea of what’s going on with that one commit.

    现在,我们取得了一些进展,当我们开始有什么事情一个承诺的一个清晰的概念。

    The trick is that we can semi-automatically commit changes as part of our workflow. That is, doing a block of work that does something very specific (implementing particular functionality, fixing a bug, optimizing an algorithm), testing (and write a unit test, if need be), adding a description while our memories are fresh, and committing right away. Rinse and repeat.

    诀窍在于, 我们可以半自动提交更改作为工作流的一部分 。 也就是说,这样做,做了非常具体的(实现特定功能,修复bug,优化的算法),检测工作中一个区块 (写一个单元测试,如果需要的话),添加描述,而我们的记忆是新鲜的,并立即承诺。 冲洗并重复。

    良好承诺的结构 (The Structure of a Good Commit)

    These rules aren’t carved in stone, but can help you estimate what a good commit might look like:

    这些规则并不是一成不变的,但是可以帮助您估算良好的提交看起来是什么样的:

    • unambiguous: no second guessing about what those commit changes do.

      明确的 :没有第二次猜测那些提交更改会做什么。

    • insightful: clearly describing what the code does, even providing links or extra information when necessary, and marking the bugs or issues that are being addressed.

      有见地 :清楚地描述代码的作用,甚至在必要时提供链接或其他信息,并标记要解决的错误或问题。

    • atomic: addressing one single thing at the time (think of a “block of work”, which could be anything from 20min to 2h, or even 2min if it was a quick bugfix).

      原子的 :一次只解决一件事情(例如“工作量”,可能是20分钟至2小时,如果是快速的错误修正,则可能是2分钟)。

    Let’s look at a template and break it down:

    让我们看一下模板并将其分解:

    <type/component/subsystem>: <subject>
    <BLANK LINE>
    <body>

    类型,组件或子系统 (Type, Components, or Subsystem)

    This would be a set of functionalities on a software project that can be grouped together. For instance, what AngularJS calls types, or what SrummVM calls subsystems.

    这将是可以组合在一起的软件项目上的一组功能。 例如, AngularJS调用类型 ,或者SrummVM调用子系统

    例子 (Examples)

    On my projects I often use the term “component”, with some examples being:

    在我的项目中,我经常使用“组件”一词,例如:

    • i18n, l18n

      i18n,l18n
    • authentication

      认证方式
    • other, 3rd party

      其他,第三方
    • QA, tests

      质量检查,测试
    • tools

      工具
    • UI, GUI

      UI,GUI

    (必修)科目 (The (Mandatory) Subject)

    The subject is a simple, straightforward line that describes what the commit does so that everybody can get a solid idea on their first glance.

    该主题是一条简单明了的代码行,描述了提交的操作,以便每个人乍一看都可以得到扎实的想法。

    When it comes to formatting the subject, I often follow these simple guidelines:

    在设置主题格式时,我经常遵循以下简单准则:

    1. use the imperative (“change” instead of “changed”)

      使用命令(“更改”而不是“更改”)
    2. don’t capitalize the first letter

      不要大写第一个字母
    3. no period (.) at the end

      最后没有句号(。)
    4. append “(…)” if there’s an optional body available

      如果有可选的正文,请附加“(…)”

    例子 (Examples)

    These would be some valid subjects:

    这些将是一些有效的主题:

    • i18n: support simplified Chinese (zh-hans)

      i18n:支持简体中文(zh-hans)
    • auth: refactor Google Sign-In

      auth:重构Google登录
    • other: add jQuery 3.4.1

      其他:添加jQuery 3.4.1
    • QA: pass AWS deployment test (…)

      质量检查:通过AWS部署测试(…)

    As you can see, there’s no guessing involved as to what these commits do, and on the last QA commit we can also see that there’s more information available (perhaps links to the relevant documentation, or further explanation for the fix).

    如您所见,没有关于这些提交功能的猜测,并且在上一次质量检查提交中,我们还可以看到有更多可用信息(也许链接到相关文档,或对该修复程序进行进一步说明)。

    (可选)主体 (The (Optional) Body)

    Occasionally, we’ll need to provide more detail than fits in a subject line to provide context, such as when fixing a persistent bug, or when hacking an algorithm.

    有时,我们需要提供比主题行更合适的细节以提供上下文,例如,修复持久性错误或破解算法时。

    In these cases, you can simply enter a double break line (so the subject works as a title), and enter as much information as needed.

    在这种情况下,您只需输入一个双折线(使该主题充当标题),然后根据需要输入尽可能多的信息。

    (Example)

    For our previous QA commit, we could do something like this:

    对于之前的质量检查提交,我们可以执行以下操作:

    QA: pass AWS deployment test (...)
    
    I added a `DJANGO_SETTINGS_LIVE` environment variable to 
    [AWS Elastic Beanstalk](https://aws.amazon.com/elasticbeanstalk/)'s 
    `django.config` file, so that the synchronization management commands 
    in `db-migrate` are _only_ executed in production.

    As you can see, the body can be harder to follow, and that’s okay, as it’s intended for those who are actively looking for more detail. Anyone can get an idea of what the commit does just by reading the subject, and the body will serve for further context, saving us back-and-forth emails or exchanges on Slack!

    如您所见,身体可能很难跟随,这没关系,因为它是为那些正在积极寻求更多细节的人而设计的。 任何人都可以通过阅读主题来了解提交的作用,而正文将为进一步的上下文服务,为我们节省来回的电子邮件或Slack上的交流!

    — “Hey, how did you get to …”

    —“嘿,你怎么去的……”

    — “Read the commit 😑.”

    —“读提交😑。”

    不要忘记解决问题! (Don’t Forget to Address Issues!)

    Finally, there’s the issue of addressing issues (pun!). Any decent mid-to-large software development project should use an issue tracker as a way to keep track of tasks, improvements, and bugs — whether it’s Atlassian Jira, Bugzilla, GitHub’s issue tracker, or another.

    最后,是解决问题(双关语)的问题。 任何体面的中型到大型软件开发项目都应使用问题跟踪器来跟踪任务,改进和错误-无论是Atlassian JiraBugzillaGitHub的问题跟踪器还是其他。

    问题管理 (Issues Management)

    In case you didn’t know, with most systems you can manage issues right from the commit message!

    如果您不知道,在大多数系统中,您可以直接从提交消息中管理问题!

    You can:

    您可以:

    • close/resolve an issue

      关闭 / 解决问题

    • re-open an issue if it has been closed before

      重新打开问题(如果之前已关闭)

    • hold an issue, should a feature be postponed for later

      持有一个问题,如果一个功能被推迟后

    All it takes is using those keywords with the ID number for the issue.

    所要做的就是使用带有ID号的关键字来解决问题。

    例子 (Examples)

    • tools: consolidate DB data with cron job; resolve #46

      工具:使用cron作业合并数据库数据; 解决#46
    • UI: add routine to serialize user input; bug found, open #32

      UI:添加例程以序列化用户输入; 发现错误,打开#32
    • auth: comment out Facebook login; hold #12

      auth:注释掉Facebook登录名; 举行#12

    Additionally, you can still reference an issue as a way of providing context, even if you don’t want to modify its status — for example, “see #12”.

    此外,即使您不想修改其状态(例如,参见“#12”),您仍然可以将其作为提供上下文的一种方式来引用。

    All of these references will be visible to anybody opening that issue on the tracker, which makes it easy to follow the progress for a given task or bug.

    所有这些参考对于在跟踪器上打开该问题的任何人都是可见的,这使跟踪给定任务或错误的进度变得容易。

    结语 (Wrapping It Up)

    You won’t always get it right (I, for one, don’t!). Things will get messy and from time to time you won’t follow the rules you’ve set for yourself or your team — and that’s part of the process. But hopefully, you know that you can be very organized with just a few upgrades to your workflow, saving yourself and your team time over the long run.

    您将永远不会做对(我,一个,不要!)。 事情会变得一团糟,您有时会不遵守为自己或团队设定的规则-这是流程的一部分。 但希望您知道,只需对工作流程进行一些升级,您就可以组织得井井有条,从长远来看可以节省您自己和团队的时间。

    I’ve also established from experience that it makes little difference whether a project involves ten developers or if it’s handled entirely by you. Simply put, commit changes to your codebase the right way — it’s a crucial part of good project management.

    我还根据经验确定,一个项目涉及十个开发人员还是完全由您处理,这几乎没有什么区别。 简而言之, 以正确的方式对代码库提交更改-这是良好的项目管理的关键部分

    进一步阅读 (Further Reading)

    翻译自: https://www.sitepoint.com/committing-changes-right-way/

    jsp修改数据库代码

    展开全文
  • 使用JSP数据库进行增删改查注意红体字!首先,打开sql server 2005,输入用户名(我用的登录名是panpan)密码(我设置的是123)。先建个表student,Create table stu(id number(30) ,name varchar(50) ,age number(30)...

    使用JSP对数据库进行增删改查

    注意红体字!

    首先,打开sql server 2005,输入用户名(我用的登录名是panpan)密码(我设置的是123)。

    先建个表student,

    Create table stu(

    id number(30) ,

    name varchar(50) ,

    age number(30),

    sex varchar(30),

    major varchar(50) );

    打开MyEclipse,新建一个新项目,让后将index.jsp删除,然后在webRoot文件中新建以下

    几个jsp文件。

    index.jsp

    String path = request.getContextPath();

    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

    %>

    输入学生信息界面

    function validate()

    {

    var id=document.forms[0].id.value;

    var name=document.forms[0].name.value;

    var age=document.forms[0].age.value;

    var major=document.forms[0].major.value;

    if(id<=0){

    alert("学号不能为空,请输入学号!");

    return false;

    }

    else if(name.length<=0){

    alert("姓名不能为空,请输入姓名!");

    return false;

    }

    else if(age<=0){

    alert("请输入合法年龄!");

    return false;

    }

    else if(major.length<=0){

    alert("专业不能为空,请输入所学专业!");

    return false;

    }

    else{

    return true;

    }

    }

    学生信息输入


    学号:

    姓名:

    年龄:

    性别:男

    专业:

    展开全文
  • <p style="text-align:center"><img alt="" height="315" src="https://img-ask.csdnimg.cn/upload/1619961680574.PNG" width="1261" /></p> <p style="text-align:center"><img alt="" height="352" src... ... ... ...  </p>
  • 改了一晚上,没发现哪错了改了一晚上,没发现哪错了String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()...修改返回修改信息修改之后的信息:Connection ...

    改了一晚上,没发现哪错了

    改了一晚上,没发现哪错了

    String path = request.getContextPath();

    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

    %>

    修改

    返回

    修改信息

    修改之后的信息:

    Connection con;

    Statement sql;

    ResultSet results;

    request.setCharacterEncoding("gb2312");

    String sex1=request.getParameter("sex1");

    System.out.print(sex1);

    String address1=request.getParameter("address1");

    System.out.print(address1);

    String tell1=request.getParameter("tell1");

    System.out.print(tell1);

    String name1=request.getParameter("change");

    try{

    Class.forName("com.mysql.jdbc.Driver");

    }catch(ClassNotFoundException e){}

    try{

    String dbUrl = "jdbc:mysql://localhost:3306/homework";

    String user = "root";

    String password = "";

    con = DriverManager.getConnection(dbUrl, user, password);

    sql=con.createStatement();

    String condition=

    "UPDATE directory SET sex = '"+sex1+"' , address = '"+address1+"', tell= '"+tell1+"' WHERE name="+"'"+name1+"'" ;

    //执行更新操作:

    sql.executeUpdate(condition);

    //System.out.println(sql);

    //显示更新后的表中的记录

    results=sql.executeQuery("SELECT * FROM directory");

    out.print("

    out.print("

    ");

    out.print("

    "+"姓名");

    out.print("

    "+"性别");

    out.print("

    "+"地址");

    out.print("

    "+"电话");

    out.print("

    ");

    while(results.next()){

    out.print("

    ");

    out.print("

    "+results.getString(1)+"");

    out.print("

    "+results.getString(2)+"");

    out.print("

    "+results.getString(3)+"");

    out.print("

    "+results.getString(4)+"");

    out.print("

    ") ;

    }

    out.print("

    ");

    con.close();

    }catch(SQLException e1) {out.print(e1) ;}

    %>

    展开

    展开全文
  • JSP修改数据库页面

    2010-03-09 15:11:27
    org.apache.jasper.JasperException: An exception occurred processing JSP page /modify.jsp at line 20 17: %> 18: 19: <form method="post" action="modify1.jsp"> 20: ("id") %>"> 21: ID:("id") %>">...
  • 项目结构:image.pngjsp(最后正确的)写法:pageEncoding="UTF-8"%>String path = request....数据库增删改查function dosubmit() {var th = document.form1;if (th.id.value == "") {alert("用户名不能为空");th....

    项目结构:

    af7f62a4b172

    image.png

    jsp(最后正确的)写法:

    pageEncoding="UTF-8"%>

    String path = request.getContextPath();

    %>

    --%>

    数据库增删改查

    function dosubmit() {

    var th = document.form1;

    if (th.id.value == "") {

    alert("用户名不能为空");

    th.id.focus();

    return;

    }

    if (th.username.value == "") {

    alert("姓名 不能为空");

    th.username.focus();

    return;

    }

    if (th.age.value == "") {

    alert("密码不能为空");

    th.age.focus();

    return;

    }

    th.action="/xxx/Action"

    th.submit();

    }

    ID:

    姓名:

    年龄:

    数据从jsp页面输入,点击“确定”后触发dosubmit()提交输入信息到Action.java。

    Action.java片段:

    public void doPost(HttpServletRequest request, HttpServletResponse response)

    throws ServletException, IOException {

    String path = request.getContextPath();

    request.setCharacterEncoding("utf-8");

    response.setContentType("text/html; charset=utf-8");

    PrintWriter out = response.getWriter();

    String id = request.getParameter("id");

    String username = request.getParameter("username");

    String age = request.getParameter("age");

    System.out.println("id = " + id + " username = " + username + " age = " + age);

    List params = new ArrayList();

    params.add(id);

    params.add(username);

    params.add(age);

    boolean flag = service.registerUser(params);

    if(flag){

    out.println("注册成功");

    response.sendRedirect(path + "/success.jsp");

    }else{

    out.println("注册失败");

    response.sendRedirect(path + "/fail.jsp");

    }

    out.flush();

    out.close();

    }

    通过request.getParameter获取信息,然后通过Service接口调用Dao,通过jdbc向数据库里存数据。

    遇到的问题:

    最开始1.jsp里的确定按钮是这样写的:

    Action.java里加断点,然后params参数里直接传数据,可以保存成功。但从1.jsp里输入的时候就保存不成功,并且没有走到doPost方法里。证明从servlet-->Dao-->jdbc是通的,但jsp-->servlet不通。所以浏览器进入F12模式检查post的数据和Request URL是否正确。检查结果post数据没有问题,但Request URL是localhost:8080/Data。jsp里的路径写的是/xxx/Action,和web.xml里url pattern一致,证明jsp里并没有触发dosubmit()里的th.action,锁定问题范围:检查确定按钮和dosubmit()有没有绑定。目测标签和标签是绑定不了的?所以改成了:

    最后测试成功。

    假如1.jsp写成这样:

    ID:

    姓名:

    年龄:

    那么信息可以存入数据库,但不是经过dosubmit(),所以姓名或年龄可以为空。

    展开全文
  • 我编写了一个修改弹窗但是修改时只修改最新传入的图片 而且第一个id跟第二个id也是一样的
  • 利用javabean轻松实现对数据库的连接、查询以及增删改作者:未知文章来源:www.jspcn.net发布日期:2005年01月19日我们在做jsp开发的时候,经常需要对数据库进行查询及增删改,而这些操作使用的又是非常频繁,因此,...
  • [img=...[color=#FF0000]经过修改过后,就变成一样的了[/color][b][/b] [img=https://img-bbs.csdn.net/upload/201803/15/1521109082_846340.png][/img]
  • 利用JSP 连接数据库并在此基础上修改数据库内容
  • jsp访问数据库修改

    千次阅读 2017-05-11 19:34:16
    在welcome页面 去掉form表单直接跳转到updateContact.jsp页面更简单<a href="admin/updateContact.jsp?...修改在updateContact.jsp页面 获取contact_id是,将String转为Integerint id=Integer.valueOf(request.
  • 经典 jsp mysql数据库 修改 分页功能 功能非常强大
  • JSP数据库的操作极简入门,案例实操。内容包括:JSP数据库的增删改查-搭建环境、JSP数据库的增删改查-page...增加及数据展示、JSP数据库的增删改查-修改及数据展示、JSP数据库的增删改查-删除及数据展示。
  • 【实例简介】友好而美观的jsp页面实现用户注册,登录(修改数据库中中的相关数据)【实例截图】【核心代码】d74355dd-5e04-4084-a793-45afd7174bdb└── aa├── src│ ├── filter│ │ └── usersFilter.java...
  • jsp操作数据库修改

    千次阅读 2017-03-13 23:11:03
    思路是 要想先修改必须查询到 图片: 查询代码如下:! public static final String DBDRIVER="org.gjt.mm.mysql.Driver"; public static final String DBURL="jdbc:mysql://localhost:3306/user"; public ...
  • 里面包含JSP和比较大型的数据库连接的方法,以及注册登陆范例……
  • <jsp:useBean id="zh" class="xinxi.course.JDBConnection" scope="session"/> String path="images/"; // 新建一个smartupload对象 SmartUpload su = new SmartUpload(); // 上传初始化 su.initialize...
  • JSP数据库MySQL查询,插入,删除,修改操作
  • jsp连接修改MySQL数据库

    千次阅读 2019-03-17 23:58:31
    jsp连接修改MySQL数据库 创建一个jsp文件,定义一个表单 &lt;body&gt; &lt;form action="messagesave.jsp" method="post"&gt; &lt;div class="form-style-agile"...
  • JSP连接数据库

    2013-12-10 21:53:26
    JSP 的连接数据库,实现查询,实现添加,实现删除,实现修改
  • jsp数据库查找

    2013-07-05 18:49:29
    jsp数据库的查找,非常详细和强大,数据库密码和名字你修改一下。
  • 背景:项目本来完美运行,但在修改数据库后出现以下错误 Exception org.apache.jasper.JasperException: 在 [36] 行处理 [/WEB-INF/jsp/welcome.jsp] 时发生异常 33: <div style="margin-left: 250px"> 34...
  • jsp数据库的增加、删除、修改、查找+mysql 软件。
  • 能够实现简单的jsp数据库的查询,增加,删除,修改,但是如果要实现的自建数据源。是很简单的用例,希望对大家的学习有所帮助。
  • JSP数据库查询,插入,删除,修改操作。适合于jsp的初学者!
  • jsp页面已经从数据库中提取数据,可以删除数据,就是在修改数据时,不知道怎么修改
  • JSP数据库类库.rar

    2019-07-09 13:26:04
    当然也可以通过JDBC向数据库发送SQL命令,对数据库进行新增、删除和修改记录等操作,这一切都需要依靠JDBC提供的类与方法来完成。Web服务器还有一项工作,就是将用户操作数据库的结果,以HTML的形式通过HTTP,回传给...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,488
精华内容 1,395
关键字:

jsp修改数据库