Spring Course – Hello World Maven Web Project

Day #3 – Hello World Maven Web Project

#1 Configure Apache Tomcat Web Server(https://www.youtube.com/watch?v=JRGZSV79Q74)

  • In Eclipse, Window=>Show View=>Servers
  • In the mid of Servers window=>right click=>New=>Server=>Apache=>select installed version(Tomcat v9.0 Server)=>Next
  • Click Browse=>C:\apache-tomcat-9.0.0.M21(Location of server in your machine)
  • Finish

#2 Create a maven project (Internet is mandatory to download maven dependencies)

  • In Eclipse, File=>New=>Maven Project=>Next=>Type web in Filter
  • Select maven-archetype-webapp=>Next
  • Enter Group Id=>com.janani and Artifact Id=>bookapp-spring=>Finish

#3 Remove web.xml(Since it points to older version-2.3 but recent version is 3.1)

  • In bookapp-spring=>src=>main=>webapp=>WEB-INF=>Right click web.xml and delete

#4 Run the application

Advertisements

Spring Course – Basic Git Commands

Day #2 – Basic Git Commands

  • Download and install git – https://git-scm.com/downloads
  • Create github repository in your github account
  • Go to the project location and type cmd in taskbar
  • Push the project to git using git commands as follows,
    git init
    git add --all
    git commit -m "first commit"
    git remote add origin https://github.com/JananiVelmurugan/bookapp-mvn.git
    git push -u origin master
  • Now reload the repository you should see the uploaded files
  • Go to the project add some code/files and then push the files as follows,
    git add --all
    git commit -m "second commit"
    git push
  • Again reload the repository you should see the recently uploaded files

Spring Course – Core Java & Web Applications

Day #1 – Core Java & Web Applications

Download and import github maven projects

Step #1 : Go to the github link https://github.com/JananiVelmurugan/bookapp-web

Step #2: Click on Clone or download

Step #3: Click Download Zip

Step #4: Right click zip->Extract Here

Step #5:  Copy the extracted project into any location ex: D:\MyWorkspaces\bookapp-web

Step #6: In Eclipse, goto File->Import->Maven->Existing Maven Projects

Step #7: Click Browse and select D:\MyWorkspaces\bookapp-web

Step #8: Click Finish(ensure that pom.xml is checked)

Question 7

Print First N Alternate Prime Numbers

N – range of alternate prime numbers to be printed

Algorithm:

#1 Get the input range

#2 Initialize the number with ‘2’(since prime number starts with 2)

#3 Loop within the input range

#4 Check whether the number is prime

#5 If not prime break the loop

#6 Else it is a prime and check if its an alternate prime number, then add it to the output array

Question 6

Print First N Prime numbers

N – range of prime numbers to be printed

Algorithm:

#1 Get the input range

#2 Initialize the number with ‘2’(since prime number starts with 2)

#3 Loop within the input range

#4 Check whether the number is prime

#5 If not prime break the loop

#6 Else it is a prime add it to the output

 

Question 5

Check a given number is prime or not

Prime number: A number which is divisible by 1 and by itself.

Note: 1 is not a prime number. Prime number starts with ‘2’

Algorithm:

#1 Get the input number

#2 Initialize the loop variable by 2 and continue till the square root of the number

#3 If the input number is exactly divisible by loop variable then its not a prime number, hence break the loop

#4 Else the given number is prime