Introduction

Mallsyok app was created with a sole purpose which is to help shoppers find their way quicker inside Malaysia’s shopping malls. With a tagline #ShoppingIsNowMoreSyok, this app intends to enhance shoppers’ experience. The last two words of the tagline that is “More Syok” which means you get to enjoy more…

Now our web application only says hello world on the page and that’s all it does. Boring. Let’s continue to add more functionality to it. How about let’s create a form that allows users to search for anything and the result will be shown in another page.

Let’s create a…

Previously, we configure our HelloWorld servlet by hooking up with url “/helloworld” in the web.xml. There is another way of configuring this and it is called the servlet annotation and specifically we are going to use @WebServlet.

Let’s start coding

Back in the HelloWorldServlet.java, before the class name, we simply put @WebServlet(“/helloworld”), that is with the url pattern within the parenthesis. Let’s remove the <servlet> and <servlet-mapping> tag inside the web.xml and restart the applciation. When the application has restarted, you should be able see the same result.

package com.davidcheah.webapplication.servlet;import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/helloworld")
public class HelloServlet extends HttpServlet {
public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter out = response.getWriter();
out.println("<html><body><h1>Hello World</h1>");
out.println("<p>The time is " + new Date() + "</p>");
out.println("</body></html>");
out.close();
}
}

Source Code

https://github.com/tattwei46/FirstServletApplication/commit/2a08c4d01b993d1ac42f43002d3ea5bcd6781372

Photo by Micah Williams on Unsplash

What is Cryptography?

Cryptography is a method to secure communication from unauthorized party.

Cryptography allows the following 3 goals to be achieved:

Confidentiality

Cryptography protects the secrecy of information. Even if the transmission or storage medium has been compromised, the encrypted information will be render useless to unauthorized person.

Integrity

Cryptography ensures the information has…

Recently I have been given an assignment to create a simple page that demonstrate the following features:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store