
TE 2015 Pattern Web Technology Laboratory Manual Prepared by : Prof. A. N. Gharu Semester : VI Course Code: 310256 Pune Vidyarthi Griha’s COLLEGE OF ENGINNERING, NASHIK. Department of Computer Engineering PVGCOE,NASHIK, Department of Computer Engineering List of Experiments Sr. Experiment Title Page No. No. 1 Installation and Configuration of Web Application Servers Tomcat 02 2 Design and develop any suitable web application using HTML, CSS and XML 09 3 Perform validation of all fields in assignment no.2 by using Java script/JQuery 25 4 Add dynamic web application essence in assignment no. 3 using Servlet, JSP 31 and MySQL 5 Add dynamic web application essence in assignment no. 3 using PHP, MySQL 40 database connectivity and AJAX controls. 6 Redesign, develop and deploy assignment no. 4 using Strut 49 7 Redesign, develop and deploy assignment no. 5 using Angular JS 64 8 Design, Develop and Deploy separate web application using 70 EJB/CMS/JSF/Spring/Bootstrap. 9 Mini Project 76 1 | P a g e PVGCOE,NASHIK, Department of Computer Engineering ASSIGNMENT NO - 01 AIM: Installation and Configuration Web application server Tomcat Apache. LEARNING OBJECTIVES: 1. Understanding Working of Web application server 2. Able to install and configure Tomcat Apache. THEORY: Installation and Configuration of Tomcat Apache. Seep 1 Install Java sudo apt-get install default-jdk STEP 2: CREATE TOMCAT USER For security purposes, Tomcat should be run as an unprivileged user (i.e. not root). We will create a new user and group that will run the Tomcat service. a) First, create a new tomcat group: sudo groupadd tomcat b) Next, create a new tomcat user. We'll make this user a member of the tomcat group, with a home directory of /opt/tomcat (where we will install Tomcat), and with a shell of /bin/false (so nobody can log into the account): sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat STEP 3: INSTALL TOMCAT a) Download Tomcat from following link http://tomcat.apache.org/download-80.cgi 2 | P a g e PVGCOE,NASHIK, Department of Computer Engineering b) change to the /tmp directory on your server. This is a good directory to download ephemeral items, like the Tomcat tarball, which we won't need after extracting the Tomcat contents: Create following directories cd /tmp We will install Tomcat to the /opt/tomcat directory. c) Create the directory. sudo mkdir /opt/tomcat d) Copy downloaded package to current directory cp /home/staff1/Downloads/apache-tomcat-8.5.24.tar.gz . e) Extract package to tomcat directory sudo tar xzvf apache-tomcat-8.5.24.tar.gz -C /opt/tomcat –strip-components=1 STEP 4: UPDATE PERMISSIONS The tomcat user that we set up needs to have access to the Tomcat installation. We'll set that up now. a) Change to the directory where we unpacked the Tomcat installation: /tmp$ cd /opt/tomcat b) Give the tomcat group ownership over the entire installation directory: /opt/tomcat$ sudo chgrp -R tomcat /opt/tomcat c) Next, give the tomcat group read access to the conf directory and all of its contents, and execute access to the directory itself: 3 | P a g e PVGCOE,NASHIK, Department of Computer Engineering /opt/tomcat$ sudo chmod -R g+r conf /opt/tomcat$ sudo chmod g+x conf d) Make the tomcat user the owner of the webapps, work, temp, and logs directories: /opt/tomcat$ sudo chown -R tomcat webapps/ work/ temp/ logs/ Now that the proper permissions are set up, we can create a systemd service file to manage the Tomcat process. STEP 5: CREATE A SYSTEMD SERVICE FILE We want to be able to run Tomcat as a service, so we will set up systemd service file. Tomcat needs to know where Java is installed. This path is commonly referred to as "JAVA_HOME". The easiest way to look up that location is by running this command: sudo update-java-alternatives -l Output java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 The correct JAVA_HOME variable can be constructed by taking the output from the last column (highlighted in red) and appending /jre to the end. Given the example above, the correct JAVA_HOME for this server would be: JAVA_HOME /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre Your JAVA_HOME may be different. a) Open tomcat.service file With this piece of information, we can create the systemd service file. Open a file called tomcat.service in the /etc/systemd/system directory by typing: sudo gedit /etc/systemd/system/tomcat.service b) Paste the following contents into your service file. Modify the value of JAVA_HOME if necessary to match the value you found on your system. You may also want to modify the memory allocation settings that are specified in CATALINA_OPTS: 4 | P a g e PVGCOE,NASHIK, Department of Computer Engineering [Unit] Description=Apache Tomcat Web Application Container After=network.target [Service] Type=forking Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true - Djava.security.egd=file:/dev/./urandom' ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh User=tomcat Group=tomcat UMask=0007 RestartSec=10 Restart=always [Install] WantedBy=multi-user.target When you are finished, save and close the file. c) Next, reload the systemd daemon so that it knows about our service file: /opt/tomcat$ sudo systemctl daemon-reload d) Start the Tomcat service by typing: /opt/tomcat$ sudo systemctl start tomcat e) Double check that it started without errors by typing: /opt/tomcat$ sudo systemctl status tomcat STEP 6: ADJUST THE FIREWALL AND TEST THE TOMCAT SERVER Now that the Tomcat service is started, we can test to make sure the default page is available. Before we do that, we need to adjust the firewall to allow our requests to get to the service. If you followed the prerequisites, you will have a ufw firewall enabled currently. Tomcat uses port 8080 to accept conventional requests. 5 | P a g e PVGCOE,NASHIK, Department of Computer Engineering a) Allow traffic to that port by typing: sudo ufw allow 8080 b) With the firewall modified, you can access the default splash page by going to your domain or IP address followed by :8080 in a web browser: http://localhost:8080/ You will see the default Tomcat splash page, in addition to other information. However, if you click the links for the Manager App, for instance, you will be denied access. We can configure that access next. c) Enable the service file so that Tomcat automatically starts at boot: sudo systemctl enable tomcat STEP 7: CONFIGURE TOMCAT WEB MANAGEMENT INTERFACE In order to use the manager web app that comes with Tomcat, we must add a login to our Tomcat server. 6 | P a g e PVGCOE,NASHIK, Department of Computer Engineering a) Edit the tomcat-users.xml file: sudo gedit /opt/tomcat/conf/tomcat-users.xml You will want to add a user who can access the manager-gui and admin-gui (web apps that come with Tomcat). You can do so by defining a user, similar to the example below, between the tomcat- users tags. Be sure to change the username and password to something secure: Add followin line before </tomcat-users> <role rolename="manager-gui"/> <role rolename="admin-gui"/> <user username="admin" password="admin" roles="manager-gui,admin-gui"/> b) To put our changes into effect, restart the Tomcat service: sudo systemctl restart tomcat Output SERVER STATUS GUI 7 | P a g e PVGCOE,NASHIK, Department of Computer Engineering Application Manager GUI Tomcat Manager GUI 8 | P a g e PVGCOE,NASHIK, Department of Computer Engineering ASSIGNMENT NO – 02 AIM: Design and develop any suitable web application using HTML, CSS and XML LEARNING OBJECTIVES: 1. Understand Basic Tags of HTML 2. Understand CSS 3. Understand use of XML in HTML. THEORY: Basic HTML HTML stands for Hyper Text Markup Language. An HTML file is a text file containing markup tags. The markup tags tell the Web browser how to display the page. An HTML file must have an ‘htm’ or ‘html’ file extension. An HTML file can be created using a simple text editor. The rule- making body of the Web is World Wide Web Consortium (W3C). W3C puts together specifications for Web standards. The most essential Web standards are HTML, CSS and XML. The latest HTML standard is XHTML 1.0. Example: Creating a simple web page 1. Start Notepad. 2. Type in the following text <html> <head> <title>Title of page</title> </head> <body> This is a very basic webpage. <b>This text will be displayed in bold</b> </body> </html> 3. Save the file as "firstpage.html". 4. Double click the saved file the browser will display the page. EXAMPLE EXPLAINED: The first tag in your HTML document is <html>. This tag tells your browser that this is the start of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document. The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window. The text between the <title> tags is the title of your document. The title is displayed in your browser's caption. The text between the <body> tags is the text that will be displayed in your browser. The text between the <b> and </b> tags will be displayed in a bold font.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages80 Page
-
File Size-