Internet Technologies
1.0.0
1.0.0
  • Introduction
  • Contents
  • Practical List
  • HTML & CSS
    • Q1
    • Q2
    • Q3
    • Q4
    • Q5
  • JAVA Programs
    • Q6
    • Q7
    • Q8
    • Q9
    • Q10
    • Q11
    • Q12
  • JAVASCRIPT
    • Q13
    • Q14
    • Q15
  • JDBC
    • Q16
    • Q17
  • JSP
    • Side Note
    • Q18
    • Q19
    • Q20
    • Q21
    • Q22
    • Q23
  • End
Powered by GitBook
On this page
  • Code
  • Output
  • Checkout the full site hosted online here
  • Browse Source Code of the full JSP site here
  1. JSP

Side Note

JSP Programs

PreviousQ17NextQ18

Last updated 4 years ago

The JSP files have been added on a custom domain and arranged the question and answers format so that it can be tested and run from anywhere online.

The URL for the hosted full JSP site is:

All the code is available on: as an ITJSP Java Project.

The server used to host this site is Glassfish 5.0.1, another alternative server is Apache Tomcat but this is hosted and tested on Glassfish.

Also maven build tool is used to manage and build all dependencies, its config file pom.xml is attached below.

There is some code common to whole site which is bootstrap styling sheet and the index.jsp where all questions and corresponding answers are presented.

Code

<%@ page contentType="text/html;charset=UTF-8" 
language="java" %>
<html>
<head>
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
    <title>JSP Programs | Internet Technologies</title>
</head>
<body>
<div style="text-align: center;">
    <div class="container-fluid">

<h1>JSP-Programs | Jatin Kamboj</h1>
    </div>
</div>
<div class="container-fluid mt-5 ">

<table class="table">
    <thead>
    <tr>
        <th scope="col">#</th>
        <th scope="col">Q. No.</th>
        <th scope="col">Question Statement</th>
        <th scope="col">Link</th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <th scope="row">1</th>
        <td>Q-18</td>
        <td>Display the pattern:<br>
            1<br>
            1 2<br>
            1 2 3<br>
            Take ‘n’ in a textbox from user. 
            Display this pattern using Scriptlets</td>
        <td><a href="http://localhost:8080/Q18">
        Check Here</a></td>
    </tr>
    <tr>
        <th scope="row">2</th>
        <td>Q-19</td>
        <td>Make two files as follows:<br>
            a. main.html: shows 2 text boxes and 3
             radio buttons with values "addition",
            "subtraction" and "multiplication"<br>
            b. operate.jsp: depending on what the user
             selects perform the corresponding function
            (Give two implementations: 
            using request.getParameter() and using
             expression<br>
            language)</td>
        <td><a href="http://localhost:8080/Q19">Check Here
        </a></td>
    </tr>

    <tr>
        <th scope="row">3</th>
        <td>Q-20</td>
        <td>Validate User input entered in a form.
         The input must include Name, DOB, Email ID,
            Lucky Number, Favourite food etc.</td>
        <td><a href="http://localhost:8080/Q20">
        Check Here</a></td>
    </tr>
    <tr>
        <th scope="row">4</th>
        <td>Q-21</td>
        <td>Display Good Morning <uname>,
         Good Afternoon <uname> or Good Evening
            <uname> based on the current time of the day</td>
        <td><a href="http://localhost:8080/Q21">Check Here</a>
        </td>
    </tr>
    <tr>
        <th scope="row">5</th>
        <td>Q-22</td>
        <td>Let the user enter a word in a textbox 
        and let her/him select one of even or 
        odd radio buttons. If she/he selects odd, 
        check the odd positions in the word entered, 
        if they all contain vowels, then display the message 
            ‘You win’, else display ‘You lose’. Similarly,
            if the user selects even, check for vowels 
            in all even positions in the word entered.</td>
        <td><a href="http://localhost:8080/Q22">
        Check Here</a></td>
    </tr>
    <tr>
        <th scope="row">6</th>
        <td>Q-23</td>
        <td>Ask a user's name Java Server Pages 
        by Hans Bergsten age on a HTML form. Then
            display Hello <uname> on a JSP. On the same page
             ask the product the user would like
            to buy. Then redirect to another JSP which
             would display: Hello <uname>, You have
            ordered <product>. (Use Session Scope Variable
             using setTag)</td>
        <td><a href="http://localhost:8080/Q23">
        Check Here</a></td>
    </tr>
    </tbody>
</table>
</div>

<div class="card-footer mt-5 text-center">
    <div class="row align-items-start">
        <div class="col-6">
            <div class="container col-lg-6">
                <a class="btn btn-primary"  
                onclick="history.back(-1)"
                 role="button">Back</a>
            </div>

        </div>
        <div class="col-6">
            <div class="container col-lg-6">
                <a class="btn btn-primary" 
                href="http://localhost:8080/" 
                role="button">Home Page</a>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>ITJSP</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>ITJSP</name>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
        <junit.version>5.7.1</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.3.1</version>
            </plugin>
        </plugins>
    </build>
</project>

Output

Checkout the full site hosted online here

Browse Source Code of the full JSP site here

https://jatin.in1.cloudjiffy.net/
https://github.com/MJK618/InternetTechnologies/tree/main/JSP/ITJSP
InternetTechnologies/JSP/ITJSP at main · MJK618/InternetTechnologiesGitHub
http://jatin.in1.cloudjiffy.net/jatin.in1.cloudjiffy.net
Logo
Home Page (index.jsp)