QuestionQuestion

1. Discuss the advantages of Tier 2 Model over Tier 1 Model.
2. The instance variables (if any) in servlets must be serialized. Why? Discuss the issues with examples, one might face if they are not serialized.

You will process the user's request from the HTML assignment and display the results in another JSP that is dispatched from a servlet. It has several types of inputs, including checkboxes, radio buttons, and lists. Note that the user can choose multiple courses from the list. You will need to examine the source code of the page to determine the name (and the associated value for the radio buttons and the list options), since you will need to use them in your server to acquire the corresponding values entered by the user.

JSP "Business" Logic
• The cost break up for each course is as follows:
o Employee - $850.00
o Student - $1000.00
o Speaker - FREE
o Others - $1350.00
• Hotel Fee is $185.00 (Assume – one night stay only)
• Parking - $10.00 (included with hotel, but add this fee if attending the conference only)

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

@WebServlet(urlPatterns = {"/myServlet"})
public class myServlet extends HttpServlet {

    /**
    * try to find a matching pair of value-name
    * and convert it
    * @param value
    * @param values
    * @param names
    * @return
    */
    private String convert(String value,
            String[] values, String[] names) {
       String val = "";
       // try to find a matching pair of value-name
       for (int i = 0; i < values.length; i++) {
            if (values[i].equals(value)) {
                val = names[i];
                break;
            }
       }
       return val;
    }

    /**
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code>
    * methods.
    *
    * @param request servlet request
    * @param response servlet response
    * @throws ServletException if a servlet-specific error occurs
    * @throws IOException if an I/O error occurs
    */
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
       response.setContentType("text/html;charset=UTF-8");
       // constant value
       final int employee = 850;
       final int student = 1000;
       final int other = 1350;
       final int hotel_fee = 185;
       final int parking = 10;
       final String[] courseValues = {
            "webServices", "J2EEDesignPatterns",
            "serviceOrientedArchitectures", "enterpriseServiceBus",
            "secureMessaing", "webServicesSecurity"
       };

       final String[] courseNames = {
            "A4-Web Services", "A1-J2EE Design Patterns",
            "A3-Service Oriented Architectures",
            "A4-enterprise Service Bus", "A6-Secure Messaging",
            "A5-Web Services Security"
       };...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$108.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Web Development (HTML, XML, PHP, JavaScript, Adobe, Flash, etc.) Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats