Java Server Pages Assignment

In: Computers and Technology

Submitted By anilthakur
Words 2737
Pages 11
Homework – 1
CAP618T: Modern Web Programming Tools and Techniques - I
Max. Marks: 30
Instructions:
i. Each Question is of 5 marks. ii. Do not copy the answers from internet or from other students. iii. All questions are compulsory. iv. Submission should be made online through the upload link available in the UMS.
Q1. What are the various implicit objects available in JSP? Explain each of them with an example.
Ans:
Implicit Objects
In any JSP Page, there are a bunch of implicit objects that are available for the programmer to use. It contains a variety of information that can be used to display stuff on the page. In this chapter, we are going to look at the following JSP Implicit Objects that are available for a programmer.

• request
• response
• out
• session
• config
• application
• page
• pageContext

So, Lets get Started!!!

JSP Implicit Objects

The JSP Implicit objects mentioned in the list in the previous paragraph are available by means of automatically defined variables. These variables have the same name and case as the list above. In the forthcoming paragraphs we will be looking at them one by one.

request

This is the HttpServletRequest instance associated with the client request. As you know, the data between the Servlet and the JSP flows by using the HttpServletRequest and the HttpServletResponse objects. The page receives a request and sends a response. The data sent by a JSP page is available in the request in the Servlet and similarly the data sent by the servlet is available in the JSP again in the request object. There is a surprising amount of information stored in it. For example, you can get the request type (whether it is GET, POST, or HEAD) and the associated cookies. You can extract information from the request object and act on that data.

Let us take a look at a small piece of code that would help us…...

Similar Documents

Java Basics

...1 Learn Java/J2EE core concepts and key areas With Java/J2EE Job Interview Companion By K.Arulkumaran & A.Sivayini Technical Reviewers Craig Malone Stuart Watson Arulazi Dhesiaseelan Lara D’Albreo Cover Design, Layout, & Editing A.Sivayini Acknowledgements A. Sivayini Mr. & Mrs. R. Kumaraswamipillai 2 Java/J2EE Job Interview Companion Copy Right 2005-2007 ISBN 978-1-4116-6824-9 The author has made every effort in the preparation of this book to ensure the accuracy of the information. However, information in this book is sold without warranty either expressed or implied. The author will not be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Please e-mail feedback & corrections (technical, grammatical and/or spelling) to java-interview@hotmail.com First Edition (220+ Q&A): Dec 2005 Second Edition (400+ Q&A): March 2007 3 Outline SECTION DESCRIPTION What this book will do for you? Motivation for this book Key Areas index SECTION 1 Interview questions and answers on: Java Fundamentals Swing Applet Performance and Memory issues Personal and Behavioral/Situational Behaving right in an interview Key Points SECTION 2 Interview questions and answers on: Enterprise Java J2EE Overview Servlet JSP JDBC / JTA JNDI / LDAP RMI EJB JMS XML SQL, Database, and O/R mapping RUP & UML Struts Web and Application servers. Best practices and performance considerations. Testing and deployment. Personal......

Words: 23255 - Pages: 94

Java Applet

...Applet Java Applets were created when the Internet was becoming popular with educational institutions, businesses and consumers. Java Applets were originally meant to be part of products from the cable company, but developers of Java Applets could not convince the cable industry to use their invention. Java Applets were created by programmers at Sun in 1995. They were James Gosig, Patrick Naughton and Mike Sheridan who called themselves the Green Team. Java Applets share some similarities with the java programming language. Java is text and characters that is written as instructions. A programmer is the person who writes the instructions on the computer. The computer will not perform an action without getting instructions from the person who writes the instructions. The java programming language allows a programmer to use the same code on both a personal computer and a Macintosh. The same rule applies to a Web browser. The programmer who creates web pages is called the web master. The web master uses hypertext markup language to create a webpage. In order for the webpage images to move an applet is added. An applet is a small application that is placed inside the hypertext markup language. The most popular web browsers in the 1990s were Netscape and Mosaic. Both browsers displayed still images and text. Java applets allowed the programmer to write applications for the web. For the first time, using Java Applets, images could move. Animation allowed webpages to come alive....

Words: 2297 - Pages: 10

Exercise Java

...Programming Exercises For Chapter 2 -------------------------------------------------------------------------------- THIS PAGE CONTAINS programming exercises based on material from Chapter 2 of this on-line Java textbook. Each exercise has a link to a discussion of one possible solution of that exercise. http://www.java2s.clanteam.com -------------------------------------------------------------------------------- Exercise 2.1: Write a program that will print your initials to standard output in letters that are nine lines tall. Each big letter should be made up of a bunch of *'s. For example, if your initials were "DJE", then the output would look something like: ****** ************* ********** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ******** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ***** **** ********** See the solution! : visit this website http://java2s.clanteam.com/ -------------------------------------------------------------------------------- Exercise 2.2: Write a program that simulates rolling a pair of dice. You can simulate rolling one die by choosing one of the integers 1, 2...

Words: 18137 - Pages: 73

Java Assignment 5

...Andy Wu     Assignment 5                             Part 1. Building Database   In this part of our development of Music Galore, we will build the database to which the web front‐ end will connect. Create a MySQL database named  (for  example, CaseJ for Justin Case) and create the following tables.    Database Schema    1. An album table to contain album information:    Field sku title genre label format Use SKU number of album Album title Genre of album Label (distributor) of album Media format of album (CD, CD+DVD, vinyl, etc.) Release date Price of album Data to Contain Integer, must have value, primary key String, up to 96 characters, must have value String, up to 50 characters String, up to 50 characters String, up to 24 characters rlsdate price Date value, in yyyy-mm-dd format Float   2. An artist table to contain information on singers, bands, producers, etc.      Field aid name1 name2 amgid url Artist ID Last name or name of band First name (if band, leave it blank) All Music Guide (allmusic.com) ID URL of artist’s official website Use Data to Contain Integer, must have value, primary key, auto-numbered String, up to 72 characters, must have value String, up to 50 characters String, up to 10 characters Large text field. Input should be limited to 2083 1 characters 1  The length limitation should be enforced programmatically. In MySQL script, simply use text datatype.  BCIS 3680 Enterprise Programming  Assignment 5 ‐......

Words: 2288 - Pages: 10

Java

...purpose of JSP • How JSP pages are invoked • Using JSP expressions to insert dynamic results directly into the output page • Using JSP scriptlets to insert Java code into the method that handles requests for the page • Using JSP declarations to add methods and field declarations to the servlet that corresponds to the JSP page • Predefined variables that can be used within expressions and scriptlets Online version of this first edition of Core Servlets and JavaServer Pages is free for personal use. For more information, please see: • • • Second edition of the book: http://www.coreservlets.com. Sequel: http://www.moreservlets.com. Servlet and JSP training courses from the author: http://courses.coreservlets.com. © Prentice Hall and Sun Microsystems. Personal use only; do not redistribute. Chapter avaServer Pages (JSP) technology enables you to mix regular, static HTML with dynamically generated content from servlets. You simply write the regular HTML in the normal manner, using familiar Web-page-building tools. You then enclose the code for the dynamic parts in special tags, most of which start with . For example, here is a section of a JSP page that results in “Thanks for ordering Core Web Programming” for a URL of http://host/OrderConfirmation.jsp?title=Core+Web+Programming: Thanks for ordering J Separating the static HTML from the dynamic content provides a number of benefits over servlets alone, and the approach used in JavaServer Pages offers......

Words: 1383 - Pages: 6

Java Tutorials

...The Java™ Web Services Tutorial For Java Web Services Developer’s Pack, v2.0 February 17, 2006 Copyright © 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. This distribution may include materials developed by third parties. Sun, Sun Microsystems, the Sun logo, Java, J2EE, JavaServer Pages, Enterprise JavaBeans, Java Naming and Directory Interface, EJB, JSP, J2EE, J2SE and the Java Coffee Cup logo are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. Unless otherwise licensed, software code in all technical materials herein (including articles, FAQs, samples) is provided under this License. Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited. DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS......

Words: 55069 - Pages: 221

Java and Java Script

...and lastly to the Internet, one thing has been a constant, different languages evolved based on a need. For these two languages, the Internet was a perfect fit, and without them the Internet would be a less dynamic and vibrant highway. As the Internet grew, more and more people found it a more viable place to do business. With that came a need for languages that were fairly easy to learn, dynamic, secure, portable, and maintainable. The industry answered that call with languages such as Java and JavaScript. This paper will perform an analysis of both Java and JavaScript. In order for the reader to gain a better understanding of these languages, the history of these languages with overviews will be presented along with a discussion of the benefits and drawbacks. The History of Java In the middle of May 1995 Java was introduced into the world, and along with Netscape it would be the new way for Internet users to access this new information superhighway. But before it got to this point, Java technology was developed almost by accident. Back in 1991, Sun Microsystems was looking into the future in anticipation of the future of computing, and they tasked a team that became know as the “Green Project”. Their main focus was to come up with a plan for the future of computing, but what they came out with was something quite unexpected. Under the guidance of James Gosling, a team was locked away in an external site to work on the project that would define Sun’s technology......

Words: 1329 - Pages: 6

Java

...Object Oriented System Software Engineering with JAVA Coursework The coursework is 50% of the assessment for the module. Learning Outcomes Have a through knowledge of one object orientated method down to detailed design. Have the experience to implement an object oriented design in an object oriented language. Assessment Criteria IMPORTANT: This is an individual assignment, all submitted components must be your own work or appropriately accredited. The assignment is scenario based (see attached scenario). You are encouraged to make any assumptions you deem necessary when analyzing he requirements outlined in the scenario, however, these must be clearly stated in the report. Your report should address the following three tasks: Task 1: Design the system required using the UML method. Task 2: Implement the system (or part of , see Grading below) using JAVA. Task 3: Objectively evaluate your solution including an appraisal of the suitability of UML and JAVA as tools for implementing object oriented solutions. Deliverable • You should submit a hard-copy and an electronic copy of the assignment • The submission should not be longer that 40 pages including diagrams but excluding the Appendices. • Instructions on how to install and run the program should be provided in an Appendix. Grading Distinction-Grade A (70%) To achieve a Distinction, you must successfully meet all of the criteria for a Merit and Task 1 • The design is comprehensive......

Words: 1035 - Pages: 5

Java Page

...systems extensible and maintainable. To determine an object’s type at execution time. To declare and implement interfaces. Why art thou cast down, O my soul? —Psalms 42:5 ■ ■ © Copyright 1992-2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Chapter 10 Object-Oriented Programming: Polymorphism 307 Assignment Checklist Name: Section: Date: Exercises Assigned: Circle assignments Date Due Prelab Activities Matching Fill in the Blank Short Answer Programming Output Correct the Code YES YES YES YES YES YES 1 NO NO 1 YES NO NO NO NO NO NO Lab Exercises Exercise 1 — Payroll System Modification Follow-Up Question and Activity Follow-Up Question and Activity Debugging Exercise 2 — Accounts Payable System Modification YES Labs Provided by Instructor 1. 2. 3. Postlab Activities Coding Exercises Programming Challenges 1, 2, 3, 4, 5, 6, 7, 8 1, 2 © Copyright 1992-2007 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Chapter 10 Object-Oriented Programming: Polymorphism 309 Prelab Activities Matching Name: Section: After reading Chapter 10 of Java How to Program: Seventh Edition, answer the given questions. The questions are intended to test and reinforce your understanding of key concepts. You may answer the questions before or during the lab. For each term in the left column, write the letter for the description from the right column that best matches the term. Term......

Words: 4624 - Pages: 19

Java

...Software Design Introduction to the Java Programming Language Material drawn from [JDK99,Sun96,Mitchell99,Mancoridis00] Software Design (Java Tutorial) © SERG Java Features • “Write Once, Run Anywhere.” • Portability is possible because of Java virtual machine technology: – Interpreted – JIT Compilers • Similar to C++, but “cleaner”: – No pointers, typedef, preprocessor, structs, unions, multiple inheritance, goto, operator overloading, automatic coercions, free. Software Design (Java Tutorial) © SERG Java Subset for this Course • We will focus on a subset of the language that will allow us to develop a distributed application using CORBA. • Input and output will be character (terminal) based. • For detailed treatment of Java visit: – http://java.sun.com/docs/books/tutorial/index.html Software Design (Java Tutorial) © SERG Java Virtual Machine • Java programs run on a Java Virtual Machine. • Features: – – – – – Security Portability Superior dynamic resource management Resource location transparency Automatic garbage collection Software Design (Java Tutorial) © SERG The Java Environment Java Source File (*.java) Java Compiler (javac) Java Bytecode File (*.class) Java Virtual Machine (java) Software Design (Java Tutorial) © SERG Program Organization Source Files (.java) Running Application Running Applet JAVA BYTECODE COMPILER Class Files (.class) JAVA VIRTUAL MACHINE WEB BROWSER Software Design (Java Tutorial) © SERG Program Organization Standards •...

Words: 5230 - Pages: 21

Java

...1. Lab Exercise for Core Java Section A: a) Write a program to find HCF of two number reading inputs as command line argument. b) Write a program to display all prime numbers between two limits. c) Write a program to implement below diamond pattern. * *** ***** d) Write a program to implement string concatenation, finding string length, find sub string and check the given string is palindrome or not? e) Write a program to implement constructor overloading by passing different number of parameter of different types. f) Write a program to find area of Square and rectangle figures using method. g) Write a program to calculate bonus for different departments using method overriding. h) Write a program to perform the different arithmetic operation show the exception handling. i) Write a program to implement thread priorities. j) Write a program to create a linked list using LinkedList class of Collection Framework k) Write a program, to create a Frame Window in an applet. l) Write a program to create simple student registration using applet, read the input using text boxes and display the output once user click on the button. m) Write a program to draw different polygon by using AWT supported Graphics method n) Write a program to implement the appropriate interface in the key listener so that it will receive the type of event. ASSIGNMENT EXCEPTION Exception and exception handling -introduction, types of......

Words: 275 - Pages: 2

Active Server Pages

... PAGE NO. 1. INTRODUCTION 2 2. EVOLUTION OF ASP 3 3. SERVER-SIDE SCRIPTS –SYNTAX 4 4. FEATURES OF ASP 4 5. ADVANTAGES OF USING ASP 6 6. WHAT YOU NEED TO RUN ASP 6 7. ASP SCRIPTS 7 8. THE OBJECT MODEL 8 9. COOKIES 14 10. SUBROUTINES, FUNCTIONS AND INCLUDES 15 11. HANDLING USER INPUT: FORMS AND QUERYSTRINGS 17 12. GET AND POST METHODS 18 13. CONCLUDING REMARKS 19 14. REFERENCES 20 introduction In the language of Microsoft, Active Server Pages is an open,......

Words: 4762 - Pages: 20

Java

...Release Team[oR] 2001 [x] java Java 2: The Complete Reference by Patrick Naughton and Herbert Schildt Osborne/McGraw-Hill © 1999, 1108 pages ISBN: 0072119764 This thorough reference reads like a helpful friend. Includes servlets, Swing, and more. Table of Contents Back Cover Synopsis by Rebecca Rohan Java 2: The Complete Reference blends the expertise found in Java 1: The Complete Reference with Java 2 topics such as "servlets" and "Swing." As before, there's help with Java Beans and migrating from C++ to Java. A special chapter gives networking basics and breaks out networking-related classes. This book helps you master techniques by doing as well as reading. Projects include a multi-player word game with attention paid to network security. The book is updated where appropriate throughout, and the rhythm of text, code, tables, and illustrations is superb. It's a valuable resource for the developer who is elbow-deep in demanding projects. Table of Contents Java 2 Preface - 7 Part l The Java Language - The Complete Reference - 4 Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9 hapter 10 - The Genesis of Java - 9 - An Overview of Java - 20 - Data Types, Variables, and Arrays - 36 - Operators - 57 - Control Statements - 75 - Introducing Classes - 94 - A Closer Look at Methods and Classes - 111 - Inheritance - 134 - Packages and Interfaces - 156 - Exception Handling - 174 Chapter 11 - Multithreaded......

Words: 78285 - Pages: 314

Importanat Terms of Java

...A Abstract: A Java keyword used in a class definition to specify that a class is not to be instantiated, but rather inherited by other classes. An abstract class can have abstract methods that are not implemented in the abstract class, but in subclasses. Abstract class: A class that contains one or more abstract methods, and therefore can never be instantiated. Abstract classes are defined so that other classes can extend them and make them concrete by implementing the abstract methods. Abstract method: A method that has no implementation. Abstract Window Toolkit (AWT): A collection of graphical user interface (GUI) components that were implemented using native-platform versions of the components. These components provide that subset of functionality which is common to all native platforms. Largely supplanted by the Project Swing component set. See also Swing. Access control: The methods by which interactions with resources are limited to collections of users or programs for the purpose of enforcing integrity, confidentiality, or availability constraints. ACID: The acronym for the four properties guaranteed by transactions: atomicity, consistency, isolation, and durability. Actual parameter list: The arguments specified in a particular method call. See also formal parameter list. API: Application Programming Interface. The specification of how a programmer writing an application accesses the behavior and state of classes and objects. Applet: A component that......

Words: 6835 - Pages: 28

Java

...JMaster list of Java interview questions - 115 questions By admin | July 18, 2005 115 questions total, not for the weak. Covers everything from basics to JDBC connectivity, AWT and JSP. 1. What is the difference between procedural and object-oriented programs?- a) In procedural program, programming logic follows certain procedures and the instructions are executed one after another. In OOP program, unit of program is object, which is nothing but combination of data and code. b) In procedural program, data is exposed to the whole program whereas in OOPs program, it is accessible with in the object and which in turn assures the security of the code. 2. What are Encapsulation, Inheritance and Polymorphism?- Encapsulation is the mechanism that binds together code and data it manipulates and keeps both safe from outside interference and misuse. Inheritance is the process by which one object acquires the properties of another object. Polymorphism is the feature that allows one interface to be used for general class actions. 3. What is the difference between Assignment and Initialization?- Assignment can be done as many times as desired whereas initialization can be done only once. 4. What is OOPs?- Object oriented programming organizes a program around its data, i. e. , objects and a set of well defined interfaces to that data. An object-oriented program can be characterized as data controlling 5. access to code. What are Class,......

Words: 6762 - Pages: 28

Contact Us | Jude Law | Michael McElhatton