In this section we continue our work...
Part
III: Create Servlet Application to insert data into MySQl database.
Create New Web application
Fileànew ProjectàSelect
Catogary(Java Web) and Project(Web Application) Click Next
Give Project Name and click Next.
Select Apache Server and Click Finish (No need to go
to Frameworks).
Then you can see your project in left side panel.
Expand it go to Web Pages and click index.html file.
Inside <body> tag write code shows in below.
< a href=”insertrecord.html”>Insert
record</a>
Using this command we create link to
insertrecord.html file & displayrecord.jsp file with in index.html.
Right Click Sample InsertàNewàHTML
create new HTML called insertrecord.html
Right Click Sample InsertàNewàJsp
create new Jsp called displayrecord.jsp(Make sure you enter correct html and
jsp file name)
Then Run the application and you able to see this
page in your Browser.
Click Insert Record Link and you can see this.
Then you need to important thing in project.
Right Click Sample Insert-->New-->Java
Class create new Java Class called DatabaseConnection.java
Inside that write this code.
Specially you need to give same jdbc URL (I discussed
it in part II) inside getConnection() method.
Then goto insertrecord.html and write thic code
inside <body> tag.
You can see I create two text fields and name them
as username and password. So when I insert data to that fields that data assign
to username and password variables.
Make sure you write action=”InsertData”
and method=”Post”. I tell important of it
later.
After run insertrecord.html you can see this.
But when you fill it and click submit you will see
http Error.
Let’s fix that error.
For that we need Java servlets.
Create Java Servlet.
Right Click Sample Insert-->New-->Servlet
create new Servlet called InsertData (This Name
should be same as action name in <form>
tag insertrecord.html. because when we click submit button that data should
pass using POST method into this servlet. POST method is secured than GET method.
Because when we send data using POST method that data doesn’t display in URL)
and Click Next.
Then click (web.xml) check box and Click Finish.
Inside that servlet generally have three methods
called processRequest, doGet, doPost, getServletInfo
We Usually write our codes in processRequest( )method.
So write this code inside it.
First we get submit our input and post it them into
InsertData servlet. Then we need to expand them and same them into variables.
So using request.getParameter( ) we can get those
details into String variables(those variables should be
same as database table attributes).
Then write Sql query to insert data into MySQL
database and execute it.
Then
We Finish.
Save and run application. Enter details and click
submit button.
Finally go to databases àExecute
command and you can see successfully our details goto MySQL database.
I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
ReplyDeleteBest Java Training Institute Chennai
Java Training Institute Bangalore
This comment has been removed by a blog administrator.
ReplyDeleteBCA Colleges in Noida
ReplyDeleteCIIT Noida provides Sofracle Specialized B Tech colleges in Noida based on current industry standards that helps students to secure placements in their dream jobs at MNCs. CIIT provides Best B.Tech Training in Noida. It is one of the most trusted B.Tech course training institutes in Noida offering hands on practical knowledge and complete job assistance with basic as well as advanced B.Tech classes. CIITN is the best B.Tech college in Noida, greater noida, ghaziabad, delhi, gurgaon regoin .
At CIIT’s well-equipped Sofracle Specialized M Tech colleges in Noida aspirants learn the skills for designing, analysis, manufacturing, research, sales, management, consulting and many more. At CIIT B.Tech student will do practical on real time projects along with the job placement and training. CIIT Sofracle Specialized M.Tech Classes in Noida has been designed as per latest IT industry trends and keeping in mind the advanced B.Tech course content and syllabus based on the professional requirement of the student; helping them to get placement in Multinational companies (MNCs) and achieve their career goals.
MCA colleges in Noida we have high tech infrastructure and lab facilities and the options of choosing multiple job oriented courses after 12th at Noida Location. CIIT in Noida prepares thousands of engineers at reasonable B.Tech course fees keeping in mind training and B.Tech course duration and subjects requirement of each attendee.
Engineering College in Noida"
Awesome article. It is so detailed and well formatted that i enjoyed reading it as well as get some new information too.
ReplyDeleteBlueprism training in Chennai
Blueprism training in Bangalore
Blueprism training in Pune
Blueprism training in tambaram
Blueprism training in annanagar
Blueprism training in velachery
Blueprism training in marathahalli
Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
ReplyDeleteDevOps online Training|DevOps Training in USA
Devops Training in Chennai
Devops Training in Bangalore
Awesome..You have clearly explained …Its very useful for me to know about new things..Keep on blogging..
ReplyDeletepython training in rajajinagar
Python training in btm
Python training in usa
Python training in marathahalli
Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
ReplyDeletejava training in annanagar | java training in chennai
java training in marathahalli | java training in btm layout
This comment has been removed by the author.
ReplyDeleteThanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts
ReplyDeleteData Science training in rajaji nagar | Data Science with Python training in chenni
Data Science training in electronic city | Data Science training in USA
Data science training in pune | Data science training in kalyan nagar
The young boys ended up stimulated to read through them and now have unquestionably been having fun with these things.
ReplyDeletebest safety training in chennai
Thanks admin, I learned to create simple java servlet with the help of your blog. Share more like this.
ReplyDeleteAngularjs Training in Chennai
Angularjs Training Chennai
Angularjs course in Chennai
Angularjs Training institute in Chennai
AWS course in Chennai
RPA Training in Chennai
Nice post. Thanks for sharing such a worthy information.
ReplyDeleteSpoken English Classes in Chennai Saidapet
Spoken English Classes in KK Nagar
Spoken English Classes in Mylapore Chennai
Spoken English Coaching near me
Spoken English Class in Anna Nagar
Spoken English Classes in Arumbakkam
Spoken English Classes in Korattur
It was defintely mind refreshing blog.
ReplyDeleteSelenium Training in Chennai
Selenium Course in Chennai
iOS Course in Chennai
Digital Marketing Training in Chennai
J2EE Training in Chennai
Future of testing professional
Different functions in testing
Cloud Computing Courses
Cloud computing course in Chennai
Excellent Blog!!! Such an interesting blog with clear vision, this will definitely help for beginner to make them update.
ReplyDeleteData Science Certification Bangalore
Data Science in Bangalore
data analyst training in bangalore
data analytics institute in bangalore
data analysis courses in bangalore
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteAWS Training in Bangalore | Amazon Web Services Training in bangalore , india
AWS Training in pune | Amazon Web Services Training in Pune, india
Thanks for sharing this valuable information to our vision. You have posted a worthy blog keep sharing.
ReplyDeletehadoop training in bangalore
hadoop training in bangalore
big data training in bangalore
Advanced Java Course in Bangalore
Java Coaching Institutes in Bangalore
Advanced Java Training Institute in Bangalore
Excellent post! keep sharing such a post
ReplyDeleteArticle submission sites
Guest posting sites
your blog information's are really creative and It contains full of new innovative ideas.thank you for sharing with us.please update more data.
ReplyDeleteAWS Training in Saidapet
AWS Training in Ambattur
AWS Certification Training in Bangalore
AWS Certification Training
Big thumbs up for making such a wonderful blog with great content.
ReplyDeleteselenium training in velachery
Selenium Training in Chennai
Big Data Training in Chennai
web designing training in chennai
PHP Training
PHP training in chennai
ReplyDeleteYour post is great. It shows your deep understanding of the subject. Waiting for your future posts.
Pega training in chennai
Pega course in chennai
Pega training institutes in chennai
Pega course
Pega training
SAS Training in Chennai
SAS Course in Chennai
IELTS Coaching in Chennai
IELTS Training in Chennai
My spouse and I love your blog and find almost all of your post’s to be just what I’m looking for
ReplyDeleteiosh course in chennai
I would like to appreciate you for making it very simple and easy
ReplyDeleteRegards,
PHP Training in Chennai | PHP Course in Chennai
Amazing Post. The way of writing is very unique. Your write-up is extra-ordinary. Thanks for Sharing.
ReplyDeleteNode JS Training in Chennai
Node JS Course in Chennai
Node JS Advanced Training
Node JS Training Institute in chennai
Node JS Training in T Nagar
Node JS Training in Anna Nagar
Really very happy to say that your post is very interesting. I never stop myself to say something about it. You did a great job. Keep it up.
ReplyDeleteWe have an excellent IT courses training institute in Hyderabad. We are offering a number of courses that are very trendy in the IT industry. For further information, please once go through our site.AWS Training In Hyderabad
Great post! I am actually getting ready to across this information, It’s very helpful for this blog.
ReplyDeleteBig Data Hadoop Training In Chennai | Big Data Hadoop Training In anna nagar | Big Data Hadoop Training In omr | Big Data Hadoop Training In porur | Big Data Hadoop Training In tambaram | Big Data Hadoop Training In velachery
Wow great blog. If you want to train your pets in a best way then search for Dog training near me will help you. kee it up.
ReplyDeleteAi & Artificial Intelligence Course in Chennai
PHP Training in Chennai
Ethical Hacking Course in Chennai Blue Prism Training in Chennai
UiPath Training in Chennai
"Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.
ReplyDeleteDigital Marketing Training Course in Chennai | Digital Marketing Training Course in Anna Nagar | Digital Marketing Training Course in OMR | Digital Marketing Training Course in Porur | Digital Marketing Training Course in Tambaram | Digital Marketing Training Course in Velachery
"
yurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
5ZKL3
Portekiz yurtdışı kargo
ReplyDeleteRomanya yurtdışı kargo
Slovakya yurtdışı kargo
Slovenya yurtdışı kargo
İngiltere yurtdışı kargo
CRZCWX
صيانة افران
ReplyDeleteشركة صيانة افران بمكة
شركة مكافحة حشرات WYEL1GQCiQ
ReplyDelete