Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In my java class, we need to create a web application using MVC archietecture.Fi

ID: 3833179 • Letter: I

Question

In my java class, we need to create a web application using MVC archietecture.First it needs a web page that has a form which need to have first name, last name, yearly salary. When user submit the form it should be able to calculate user's monthly salary by dividing yearly salary by 12.The user information including the yearly and monthly salary will be processed by the system, written to a database table, and the user will be presented with a summary page that lists what was inserted into the database. The database table will have a primary key of the person’s last name. If the database already has an existing entry with the same primary key, the final summary screen will include a note that the user data was not inserted because it was a duplicate. Create a derby database for this lab.

Explanation / Answer

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;

WebServlet(description = "My First Servlet", urlPatterns = { "/FirstServlet" , "/FirstServlet.do"}, initParams = {@WebInitParam(name="id",value="1"),@WebInitParam(name="name",value="pankaj")})
public class FirstServlet extends HttpServlet {
   private static final long serialVersionUID = 1L;
   public static final String HTML_START="<html><body>";
   public static final String HTML_END="</body></html>";

  
public Servlet()
{
super();
  
}

   protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
       PrintWriter out = response.getWriter();
       Date date = new Date();
       out.println(HTML_START + "<h2>Hi There!</h2><br/><h3>Date="+date +"</h3>"+HTML_END);
   }

   protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      
   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote