steps to create a dynamic web application and connect to...
TRANSCRIPT
![Page 1: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/1.jpg)
Steps to create a Dynamic Web Application and connect to MS SQLSERVER to
get the data and display in a web page Using ECLIPSE with JDBC ODBC Bridge:
1) Click on New -> Other
2) Type Dynamic, and select “Dynamic Web Project” and click on Next
(if you don’t find Dynamic Web Project, install using Click "Help" > "Install new software.
Please find steps to get ‘Dynamic Web Project’ in menu at end of this document)
![Page 2: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/2.jpg)
3) Give Project name and click next
4) Click on Next Button
![Page 3: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/3.jpg)
5) Click on Finish. Now the project has been created
Second Phase: Import the required jar’s
1) Right click on the project and click on Properties
![Page 4: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/4.jpg)
2) Import jstl.jar, servlet-api.jar and stardard.jar files into build path.
( Please find the attached jar files with this document)
![Page 5: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/5.jpg)
3) Add the jar files under WebContent->lib folder
Create a JSP Page: index.jsp
Right click on WebContent folder ->New -> JSP File
Step1:
![Page 6: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/6.jpg)
Step 2:
Import jstl library in index.jsp page:
![Page 7: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/7.jpg)
Create a Servlet Page :
step 1: Create a servlet file by right click on src -> New -> Servlet
Step 2:
![Page 8: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/8.jpg)
Running the web application using apache tomcat server:
1) Right click on the project, Click on Run As -> Run on Server
1) Select tomcat server and click on next.
(if you don’t have tomcat server installed, you can download from here)
![Page 9: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/9.jpg)
2) Click on browse and select the Apache Tomcat folder
3) And click on finish.
4) Type ‘localhost:8080/YOUR_PROJECT_NAME/’ in any web browser, your application will
start.
![Page 10: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/10.jpg)
When you Click on ‘Get Employee Details’ Button:
The application will hit the database through java servlet and display the results in jsp page:
The following code is responsible for fetching data from database:
![Page 11: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/11.jpg)
In the above code “Company_DSN” is the domain server name configured to establish
connection between application and ms sqlserver database:
Please follow the steps to create domain server name and use in the java code
1) Click on Administrative Tools
2) Click on Data Sources (ODBC)
![Page 12: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/12.jpg)
3) Click on Add button
4) Select SQL Server and click on Finish
![Page 13: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/13.jpg)
5) Enter Data source Name and Server Name.
To find the server name do the following
![Page 14: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/14.jpg)
6) Click on Next Button
![Page 15: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/15.jpg)
7) Select Check box, Select your database using the dropdown, and click ‘Next’ Button
8) Click on ‘Next’ Button
![Page 16: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/16.jpg)
9) Click on ‘Test Data Source’ Button to test the connection
10) It will show ‘Tests Completed Successfully’. Then Click ok. You are connection to
SQLSERVER has been established now.
![Page 17: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/17.jpg)
Steps to get Dynamic Web Application to the menu list:
1. Click "Help" > "Install new software"
2. In "Work with", Select the dropdown
3. In "Web, XML, Java EE and OSGi Enterprise Development", check:
1. Eclipse Java EE Developer Tools
2. Eclipse Java Web Developer Tools
3. Eclipse Web Developer Tools
4. Eclipse XML Editors and Tools
![Page 18: Steps to create a Dynamic Web Application and connect to ...cis.csuohio.edu/~sschung/cis611/StepsToSetUpWebApplicationJDB… · Steps to create a Dynamic Web Application and connect](https://reader036.vdocument.in/reader036/viewer/2022081404/5f0427b97e708231d40c9567/html5/thumbnails/18.jpg)
4. Finally, click "Next" to install the new software and "Dynamic Web Project" will be
available.