国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jsp - javaweb about MVC framework
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-16 17:06:11
0
2
835

For example, on a user registration page, how to obtain the information submitted by the form for processing.
After doGet and doPost are obtained, how to connect to the database to query whether the username (unique) is registered.

  1. Do we need to write database connection code in servlet? If written in DAO, how to connect?
  2. How to transfer data between DAO servlet JavaBeans? Now we only know that DAO and JavaBean are passed through DAO and VO.

There are a lot of questions, and it would be nice to have a simple example to illustrate. Newbie, I haven’t learned the SSH (spring+struts+hibernate) framework yet.

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級(jí)講師

reply all(2)
僅有的幸福

I remember struggling with these problems for the first time like you. In fact, I just started writing these codes. The first thing to know is what you want to do. For example, if you are learning servlet now, it is about how to interact with the browser, accept data, return data, and jump to the page. Wait, for example, if you want to operate the database, the most basic and important thing here is JDBC. You can try to find some relevant information. Generally, there are some simple encapsulated Utils that can help you better understand and quickly operate the database. As for where to write the code, actually You will slowly understand the concept of layering and learn slowly. Don’t rush to learn the framework first!

我想大聲告訴你

How to obtain the information submitted by the form for processing.

The page assumptions are as follows:

<form action="/SignUpServlet" method="post">
    <input type="text" name="username">
</from>

In SignUpServlet.javadoPost(同form中的method對(duì)應(yīng))中,通過request.getParameter("username") you can get the username (in string form) entered on the front-end page

Do I need to write database connection code in servlet? If written in DAO, how to connect?

DAO定義及實(shí)現(xiàn)相應(yīng)方法(通過連接數(shù)據(jù)庫(kù)),servletCall the interface directly

How to transfer data between DAO servlet JavaBean?

servlet中調(diào)用DAO,JavaBeanDAOservlet will appear.

It’s hard to say this. You can leave it to my email and I will send you examples.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template