This document provides an overview of Java Server Pages (JSP) technology. Some key points:
- JSP allows separation of work between web designers and developers by allowing HTML/CSS design and Java code to be placed in the same file.
- A JSP page is compiled into a servlet, so it can take advantage of servlet features like platform independence and database-driven applications.
- JSP pages use tags like <jsp:include> and <jsp:useBean> to include content and access JavaBeans. Scriptlets, expressions, declarations, and directives are also used.
- Implicit objects like request, response, out, and session are automatically available in JSP pages
Java Server Pages (JSP) allow Java code to be embedded within HTML pages to create dynamic web content. JSP pages are translated into servlets by the web server. This involves compiling the JSP page into a Java servlet class that generates the HTML response. The servlet handles each request by executing the jspService() method and produces dynamic content which is returned to the client browser.
This document discusses JavaScript objects and methods for manipulating strings and performing mathematical calculations. It introduces the Math object which allows common mathematical operations and contains constants like PI. It also covers the String object which allows manipulating and processing strings, including character-level methods, searching/extracting substrings, and generating XHTML tags. Methods like split(), indexOf(), toLowerCase() are described.
JSP stands for Java Server Pages and enables developers to embed Java code directly into HTML pages. JSP pages have a .jsp extension and allow for platform-independent development since Java code can run on any system. The JSP request is sent to the web server, which passes the .jsp file to the JSP servlet engine. If it is the first request, the JSP file is parsed into a servlet class file; otherwise, an instantiated servlet handles the request. The servlet output is then sent to the user's browser.
Threads allow multiple tasks to run concurrently within a single Java program. A thread represents a separate path of execution and threads can be used to improve performance. There are two main ways to create threads: by extending the Thread class or implementing the Runnable interface. Threads transition between different states like new, runnable, running, blocked, and terminated. Synchronization is needed to prevent race conditions when multiple threads access shared resources simultaneously. Deadlocks can occur when threads wait for each other in a circular manner.
This document introduces JavaScript, explaining that it allows for interactivity on web pages by manipulating the browser and reacting to user actions. It is embedded in HTML and executes on the client side for fast interactions without a connection. JavaScript statements can include code combined with HTML tags. The document also discusses using JavaScript with HTML forms to process and display user input on the page.
This document provides an overview of Spring MVC including:
- Spring MVC is a web framework built on the Servlet API that uses the MVC pattern. It features a DispatcherServlet that handles requests and delegates to controllers.
- The request processing workflow in Spring MVC involves the DispatcherServlet dispatching tasks to controllers, which interact with services and return a view name. The view is then rendered using a ViewResolver.
- Spring MVC applications use a WebApplicationContext containing web-related beans like controllers and mappings, which can override beans in the root context. Configuration can be done via XML or Java-based approaches. Important annotations map requests and bind parameters.
Introduction to JavaScript course. The course was updated in 2014-15.
Will allow you to understand what is JavaScript, what's it history and how you can use it.
The set of slides "Introduction to jQuery" is a follow up - which would allow the reader to have a basic understanding across JavaScript and jQuery.
Objects in JavaScript can be created using object literals, the new keyword, or Object.create(). Objects are collections of properties and methods that are mutable and manipulated by reference. Arrays are objects that represent ordered collections of values of any type and are created using array literals or the Array constructor. Common array methods include concat, join, pop, push, reverse, and sort. The Math object provides common mathematical functions like pow, round, ceil, floor, random, and trigonometric functions.
The document discusses the ASP.NET page lifecycle, which begins when a client requests a page from the server. It goes through initialization, loading, validation, event handling, and rendering steps. Key parts of the lifecycle include initializing controls and themes, loading view state and postback data, validating controls, firing server-side events, and rendering the output. Master pages and user controls follow the same lifecycle but are initialized differently and have their events called at different times in the process. The full lifecycle ensures the correct processing and output of the requested page.
This document discusses AJAX (Asynchronous JavaScript and XML). It defines AJAX as a group of interrelated web development techniques used on the client-side to create interactive web applications. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server without reloading the entire page. The document outlines the technologies that power AJAX like HTML, CSS, XML, JavaScript, and XMLHttpRequest and how they work together to enable asynchronous updates on web pages.
This document provides an introduction to JavaScript and its uses for web programming. It explains that JavaScript is a client-side scripting language that allows web pages to become interactive. Some key points covered include:
- JavaScript can change HTML content, styles, validate data, and make calculations.
- Functions are blocks of code that perform tasks when invoked by events or called in code.
- Events like clicks or keyboard presses trigger JavaScript code.
- The DOM (Document Object Model) represents an HTML document that JavaScript can access and modify.
- Forms and user input can be accessed and processed using the DOM.
- Programming flow can be controlled with conditional and loop statements.
-
AngularJS is a JavaScript framework for building dynamic web applications. It augments HTML with custom attributes and directives to bind data and behaviors to the DOM. Key features include two-way data binding, reusable components, dependency injection, routing, and templating. AngularJS uses an MVC or MVVM pattern, with scopes providing the view model. The framework enhances HTML, encourages test-driven development, and makes single page apps possible.
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
The document discusses client-side scripting and scripts. It notes that scripts automate tasks that could otherwise be done manually. Scripts can be used in software applications, web pages, operating system shells, and more. Scripting languages make writing scripts easy and support interfaces to operating system facilities. Examples of scripting languages include JavaScript, Python, and Perl. The document then contrasts interpreters with compilers and compares how scripts and software code are developed and executed.
This document is a presentation about JavaScript that covers what JavaScript is, where it came from, and what it can do. It introduces JavaScript as a scripting language that is easy to use and learn and runs in web browsers. The presentation explains that JavaScript is unrelated to Java but borrows some naming conventions. It provides overviews of JavaScript basics like variables, operators, and functions, as well as more advanced topics like objects, events, and DOM manipulation.
This document provides an introduction and overview of ASP.NET and Web Forms. It discusses the background of ASP and how ASP.NET was developed to address challenges with ASP. The key features of ASP.NET, including Web Forms, Web Services, and the .NET Framework are described. The document then covers the ASP.NET programming model based on controls and events, and how postbacks maintain page state without requiring additional code. It also introduces the ASP.NET object model and server-side controls.
The document discusses JavaScript error and exception handling using try, catch, and finally blocks. It provides examples of using try and catch to handle exceptions, catch to retrieve error details, and finally to execute code regardless of exceptions. It also shows how to use window.onerror to handle uncaught exceptions and access error details.
This document provides an overview of conditional statements and loops in JavaScript. It discusses the if, else, else if, and switch conditional statements and their syntax and usage. It also covers the for, for/in, while, and do/while loops in JavaScript, explaining what each one is used for and including examples of their syntax. The goal of the lesson is for students to understand how to use conditional logic and loops to control program flow in JavaScript.
Debugging in JavaScript
It is common to have errors while writing codes and the errors can be due to syntax or logical. These errors create a lot of ambiguity in the logic and understanding of both users and programmers. There can also be errors in the code which can remain invisible to the programmer’s eye and can create havoc. To identify these errors we need Debuggers that can go through the entire code or program, identify the errors and also fix them.
-Debugger
The debugger keyword is used in the code to force stop the execution of the code at a breaking point and calls the debugging function. The debugger function is executed if any debugging is needed at all else no action is performed.
The document discusses JavaScript, including its history and differences from Java. It describes JavaScript's uses in modifying HTML documents dynamically and embedding it in HTML. The document outlines JavaScript's object-based nature, primitive data types, variables, operators, and functions. It provides examples of numeric, string, and boolean literals as well as type conversions.
The .NET Framework provides a common platform and language runtime for multiple programming languages. It includes the Common Language Specification (CLS), which defines interoperability standards, and the Common Language Runtime (CLR), which handles memory management, security, and code execution. The .NET Framework also includes a large class library called the Framework Class Library (FCL) that contains types and methods for building applications. Developers can use Visual Studio to create .NET applications using languages like C# and VB.NET, which compile to Microsoft Intermediate Language (MSIL) code that is executed within the CLR.
This document provides an overview of the Struts framework, which implements the Model-View-Controller design pattern for JavaServer Pages. It describes the core components of Struts, including action handlers, result handlers, and custom tags. It also explains how Struts uses interceptors to apply common functionality like validation. Finally, it provides a step-by-step example of creating a basic login application using Struts.
The document discusses exception handling in Java. It defines exceptions as abnormal conditions that arise during runtime and disrupt normal program flow. There are three types of exceptions: checked exceptions which must be declared, unchecked exceptions which do not need to be declared, and errors which are rare and cannot be recovered from. The try, catch, and finally blocks are used to handle exceptions, with catch blocks handling specific exception types and finally blocks containing cleanup code.
The document discusses XML namespaces and XML schemas. It provides examples of using namespaces to differentiate between similarly named elements, such as <highschool:subject> and <medicine:subject>. It also compares defining an XML document using a DTD versus using an XML schema, and provides a sample schema for defining book information. Key differences between "ref" and "type" attributes in schemas are explained using an employee example.
This document provides an overview of Spring MVC including:
- Spring MVC is a web framework built on the Servlet API that uses the MVC pattern. It features a DispatcherServlet that handles requests and delegates to controllers.
- The request processing workflow in Spring MVC involves the DispatcherServlet dispatching tasks to controllers, which interact with services and return a view name. The view is then rendered using a ViewResolver.
- Spring MVC applications use a WebApplicationContext containing web-related beans like controllers and mappings, which can override beans in the root context. Configuration can be done via XML or Java-based approaches. Important annotations map requests and bind parameters.
Introduction to JavaScript course. The course was updated in 2014-15.
Will allow you to understand what is JavaScript, what's it history and how you can use it.
The set of slides "Introduction to jQuery" is a follow up - which would allow the reader to have a basic understanding across JavaScript and jQuery.
Objects in JavaScript can be created using object literals, the new keyword, or Object.create(). Objects are collections of properties and methods that are mutable and manipulated by reference. Arrays are objects that represent ordered collections of values of any type and are created using array literals or the Array constructor. Common array methods include concat, join, pop, push, reverse, and sort. The Math object provides common mathematical functions like pow, round, ceil, floor, random, and trigonometric functions.
The document discusses the ASP.NET page lifecycle, which begins when a client requests a page from the server. It goes through initialization, loading, validation, event handling, and rendering steps. Key parts of the lifecycle include initializing controls and themes, loading view state and postback data, validating controls, firing server-side events, and rendering the output. Master pages and user controls follow the same lifecycle but are initialized differently and have their events called at different times in the process. The full lifecycle ensures the correct processing and output of the requested page.
This document discusses AJAX (Asynchronous JavaScript and XML). It defines AJAX as a group of interrelated web development techniques used on the client-side to create interactive web applications. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server without reloading the entire page. The document outlines the technologies that power AJAX like HTML, CSS, XML, JavaScript, and XMLHttpRequest and how they work together to enable asynchronous updates on web pages.
This document provides an introduction to JavaScript and its uses for web programming. It explains that JavaScript is a client-side scripting language that allows web pages to become interactive. Some key points covered include:
- JavaScript can change HTML content, styles, validate data, and make calculations.
- Functions are blocks of code that perform tasks when invoked by events or called in code.
- Events like clicks or keyboard presses trigger JavaScript code.
- The DOM (Document Object Model) represents an HTML document that JavaScript can access and modify.
- Forms and user input can be accessed and processed using the DOM.
- Programming flow can be controlled with conditional and loop statements.
-
AngularJS is a JavaScript framework for building dynamic web applications. It augments HTML with custom attributes and directives to bind data and behaviors to the DOM. Key features include two-way data binding, reusable components, dependency injection, routing, and templating. AngularJS uses an MVC or MVVM pattern, with scopes providing the view model. The framework enhances HTML, encourages test-driven development, and makes single page apps possible.
This document provides an overview of Java applets, including:
- Applets are small Java programs that can be transported over the network and embedded in HTML pages.
- The main types of Java programs are standalone programs and web-based programs like applets.
- Applets differ from applications in that they have a predefined lifecycle and are embedded in web pages rather than running independently.
- The Applet class is the superclass for all applets and defines methods corresponding to the applet lifecycle stages like init(), start(), paint(), stop(), and destroy().
- Common methods for applets include drawString() for output, setBackground()/getBackground() for colors, and showStatus() to display in
The document discusses client-side scripting and scripts. It notes that scripts automate tasks that could otherwise be done manually. Scripts can be used in software applications, web pages, operating system shells, and more. Scripting languages make writing scripts easy and support interfaces to operating system facilities. Examples of scripting languages include JavaScript, Python, and Perl. The document then contrasts interpreters with compilers and compares how scripts and software code are developed and executed.
This document is a presentation about JavaScript that covers what JavaScript is, where it came from, and what it can do. It introduces JavaScript as a scripting language that is easy to use and learn and runs in web browsers. The presentation explains that JavaScript is unrelated to Java but borrows some naming conventions. It provides overviews of JavaScript basics like variables, operators, and functions, as well as more advanced topics like objects, events, and DOM manipulation.
This document provides an introduction and overview of ASP.NET and Web Forms. It discusses the background of ASP and how ASP.NET was developed to address challenges with ASP. The key features of ASP.NET, including Web Forms, Web Services, and the .NET Framework are described. The document then covers the ASP.NET programming model based on controls and events, and how postbacks maintain page state without requiring additional code. It also introduces the ASP.NET object model and server-side controls.
The document discusses JavaScript error and exception handling using try, catch, and finally blocks. It provides examples of using try and catch to handle exceptions, catch to retrieve error details, and finally to execute code regardless of exceptions. It also shows how to use window.onerror to handle uncaught exceptions and access error details.
This document provides an overview of conditional statements and loops in JavaScript. It discusses the if, else, else if, and switch conditional statements and their syntax and usage. It also covers the for, for/in, while, and do/while loops in JavaScript, explaining what each one is used for and including examples of their syntax. The goal of the lesson is for students to understand how to use conditional logic and loops to control program flow in JavaScript.
Debugging in JavaScript
It is common to have errors while writing codes and the errors can be due to syntax or logical. These errors create a lot of ambiguity in the logic and understanding of both users and programmers. There can also be errors in the code which can remain invisible to the programmer’s eye and can create havoc. To identify these errors we need Debuggers that can go through the entire code or program, identify the errors and also fix them.
-Debugger
The debugger keyword is used in the code to force stop the execution of the code at a breaking point and calls the debugging function. The debugger function is executed if any debugging is needed at all else no action is performed.
The document discusses JavaScript, including its history and differences from Java. It describes JavaScript's uses in modifying HTML documents dynamically and embedding it in HTML. The document outlines JavaScript's object-based nature, primitive data types, variables, operators, and functions. It provides examples of numeric, string, and boolean literals as well as type conversions.
The .NET Framework provides a common platform and language runtime for multiple programming languages. It includes the Common Language Specification (CLS), which defines interoperability standards, and the Common Language Runtime (CLR), which handles memory management, security, and code execution. The .NET Framework also includes a large class library called the Framework Class Library (FCL) that contains types and methods for building applications. Developers can use Visual Studio to create .NET applications using languages like C# and VB.NET, which compile to Microsoft Intermediate Language (MSIL) code that is executed within the CLR.
This document provides an overview of the Struts framework, which implements the Model-View-Controller design pattern for JavaServer Pages. It describes the core components of Struts, including action handlers, result handlers, and custom tags. It also explains how Struts uses interceptors to apply common functionality like validation. Finally, it provides a step-by-step example of creating a basic login application using Struts.
The document discusses exception handling in Java. It defines exceptions as abnormal conditions that arise during runtime and disrupt normal program flow. There are three types of exceptions: checked exceptions which must be declared, unchecked exceptions which do not need to be declared, and errors which are rare and cannot be recovered from. The try, catch, and finally blocks are used to handle exceptions, with catch blocks handling specific exception types and finally blocks containing cleanup code.
The document discusses XML namespaces and XML schemas. It provides examples of using namespaces to differentiate between similarly named elements, such as <highschool:subject> and <medicine:subject>. It also compares defining an XML document using a DTD versus using an XML schema, and provides a sample schema for defining book information. Key differences between "ref" and "type" attributes in schemas are explained using an employee example.
JDBC provides a standard interface for connecting to and working with databases in Java applications. There are four main types of JDBC drivers: Type 1 drivers use ODBC to connect to databases but are only compatible with Windows. Type 2 drivers use native database client libraries but require the libraries to be installed. Type 3 drivers use a middleware layer to support multiple database types without native libraries. Type 4 drivers connect directly to databases using a pure Java implementation, providing cross-platform compatibility without additional layers.
ActiveX is a framework for reusable software components that can be composed to provide application functionality. It was introduced by Microsoft in 1996 and is commonly used in Windows applications and allows components to be embedded in web pages. ActiveX controls can create distributed applications over the internet. They can provide more functionality than Java applets but only run on Internet Explorer and Windows. Malware has been spread using ActiveX controls installed from malicious websites.
The document discusses how to create and run ActiveX controls in Visual Basic. It provides steps to create a simple calculator ActiveX control and system clock ActiveX control. The key steps include starting Visual Basic, clicking on the ActiveX control, giving the project a name, adding coding for functionality, adding the component to the toolbox, dragging it onto a form, setting the project properties, and executing the ActiveX control.
Active Server Pages (ASP) was introduced in 1996 and bundled with Internet Information Server 3.0. ASP allows developers to create dynamic web pages by mixing standard HTML tags with server-side scripting code. Some key capabilities of ASP include generating dynamic web pages, processing HTML forms, creating database-driven pages, and tracking user sessions. The core ASP components include the Request, Response, Session, Server, and Error objects which provide functionality for handling requests, sending responses, storing session data, accessing server properties, and displaying error information.
This is the most important concept in advance java. Why java is so much popular than other? answer is its implicit objects. It provides many implicit object in the library. So you don't need to declare object to use it. You just have to use whenever you need it.
This document provides an overview of Active Server Pages (ASP) programming. It discusses the differences between client-side and server-side script processing. Client-side processing occurs on the user's computer browser using JavaScript, while server-side processing occurs on the web server using ASP scripts like VBScript. Server-side processing allows data to be stored in databases and controls user access, while client-side processing is faster but cannot retain global data. The document also reviews ASP implementation using IIS servers, and the Request and Response objects used to access information passed between the client and server.
Active Server Pages (ASP) is a technology that allows web pages to contain server-side scripting. When a browser requests an ASP file, the ASP engine processes the file by executing any scripts and then returns HTML to the browser. ASP files can contain HTML tags, scripting languages like VBScript, and server-side objects. Scripts in ASP files run on the server and allow dynamic content generation. The Request object provides access to form data submitted by users, and the Session object stores information about users across multiple pages of a website. Cookies are also used to store user-specific data on the client side.
This document provides an overview of scripting languages. It defines a script as a program or sequence of instructions interpreted by another program rather than the processor. Scripting languages are programming languages that support scripts and can interpret and automate tasks. The document discusses server-side scripting, which connects to databases on the web server and can access the file system. It also covers client-side scripting, which executes in the browser, and compares the advantages of server-side and client-side scripting. Popular scripting languages for each are also listed.
JavaServer Pages (JSP) is a technology that allows developers to embed Java code in HTML pages to create dynamic web content. JSP pages combine HTML code with JSP actions and commands. At runtime, JSP pages are translated into Java servlets that generate the web page content dynamically. This provides better performance than CGI and allows embedding of dynamic elements directly into HTML pages.
This document discusses JSP and JSTL. It begins with an introduction to JSP, explaining that JSP is a server-side technology used to create dynamic web content by inserting Java code into HTML pages. It then covers some advantages of JSP over servlets, features of JSP like ease of coding and database connectivity, and how to run a JSP project in Eclipse. The document next discusses JSTL, the JavaServer Pages Standard Tag Library, which provides commonly used JSP tags. It classifies JSTL tags and provides examples. Finally, it discusses interfacing a Java servlet program with JDBC and MySQL to insert data into a database table.
The document provides an overview of JavaServer Pages (JSP) including:
- JSP allows embedding dynamic elements in HTML pages using special tags to insert Java code, which enables creation of dynamic and platform-independent web applications.
- JSP pages combine HTML, XML elements, and embedded actions/commands that are compiled into servlets, with the servlet engine executing the servlet and returning dynamic HTML to the browser.
- Setting up a JSP environment involves installing a Java SDK, setting PATH and JAVA_HOME variables, and installing a web server like Tomcat to test and run JSP pages.
The document provides an overview of JavaServer Pages (JSP) technology. It discusses how JSP pages allow mixing static HTML content with server-side Java code to create dynamic web pages. JSP pages are compiled into Java servlets, which generate the HTML responses. The document covers JSP syntax elements like scriptlets, expressions, and directives that allow embedding Java code in JSP pages. It also discusses JSP lifecycle phases like translation, compilation, execution and cleanup. Common JSP actions like include, forward, plugin and working with JavaBeans are also summarized.
JSP is a technology based on Java that produces dynamic web pages. JSP files contain HTML tags as well as special JSP tags where Java code is embedded. There are three main types of JSP elements - directives, scripting elements, and action elements. Directives provide information to the JSP engine, scripting elements contain Java code, and action elements perform tasks like accessing Java beans. Common implicit objects in JSP include application, page, session, and request objects. Java beans can be used with JSP through action tags like useBean, setProperty, and getProperty.
Java Server Pages (JSP) is a technology that allows developers to create dynamic web applications using Java code embedded in HTML pages. JSP pages are compiled into Java servlets, allowing dynamic content to be generated. JSP supports the use of scripting elements like expressions, scriptlets, and declarations directly in HTML pages to add dynamic functionality. Common elements like directives, actions, and standard tags provide functionality like including pages, passing parameters, and abstracting common patterns.
The document discusses Java Server Pages (JSP) technology which provides a simplified way to create dynamic web content. JSP pages are compiled into servlets, allowing developers to embed Java code directly into HTML pages to interact with databases and other applications. The document covers key aspects of JSP including its architecture, lifecycle, directives like include and taglib, and how it enables rapid development of web applications.
The document discusses JavaServer Pages (JSP) technology. It provides details about:
- JSP is a popular server-side scripting language that provides dynamic web content using scripting elements and XML tags.
- Key features of JSP include ease of deployment, support for multithreading, reusable components, and cross-platform support.
- JSP pages are preprocessed into Java servlet classes that can be compiled and executed by the web container.
- JSP supports scripting elements like Java code embedded directly in tags, directives to control page behavior, and actions to convert elements to servlet code.
This document provides an introduction and overview of JSP (JavaServer Pages) technology. Key points include:
- JSP pages allow for mixing HTML and Java code to create dynamic web applications more easily than servlets alone.
- JSP pages are translated into servlets by the web container before execution.
- JSP offers implicit objects, standard actions, tags and directives to simplify coding dynamic content.
- Exception handling and lifecycle management are similar to servlets in JSP.
- Java beans can be used to encapsulate reusable data and logic in JSP applications.
Introduction to the JSP technology for creating Java EE Web Applications, according to the MVC design pattern.
Materiale realizzato per il corso di Sistemi Informativi Aziendali del Politecnico di Torino - http://bit.ly/sistinfo
Java Server Pages (JSP) allow developers to create dynamic web content by mixing static HTML markup with Java code. JSP pages are translated into Java servlets, providing access to full Java functionality. Key elements of JSP include tags for scripting Java code directly in HTML pages, and directives that control page processing. JSP provides a standard way to create dynamic web applications and interfaces with databases using Java.
JSP was developed by Sun Microsystems to allow server-side development through HTML files containing Java source code tags. There are 5 main JSP tags: scriptlets for Java code blocks, expressions to output Java expressions in HTML, directives to set page-wide conditions, comments to ignore code, and declarations to define variables and methods. JSP files allow easy creation of dynamic web content through Java integration in an HTML-like format.
The document discusses Java servlets and Java Server Pages (JSP). It describes servlets as Java programs that run on a web or application server between the HTTP client and server. JSP is described as a dynamic web page that mixes HTML and Java code enclosed in special tags. The document outlines the servlet/JSP lifecycle of init, service, and destroy phases. It provides examples of JSP tags like scriptlets, declarations, comments, directives, and implicit objects to access request parameters and session attributes.
The key differences between variables declared in a JSP declaration part versus a scriptlet are:
- Variables declared in a declaration part are instance variables of the generated servlet class, while variables declared in a scriptlet are local to the _jspService() method.
- Declaration part variables have broader scope across the entire JSP and servlet, while scriptlet variables are only accessible within the scriptlet.
JSPExecutor is a tool that allows executing JSP files from the command line or own applications, bypassing the servlet container. It is useful for code generation but lacks full servlet functionality.
The key differences between variables declared in a JSP declaration part versus a scriptlet are:
- Variables declared in a declaration part are instance variables of the generated servlet class, while variables declared in a scriptlet are local to the _jspService() method.
- Declaration part variables have broader scope across the entire JSP and servlet, while scriptlet variables are only accessible within the scriptlet.
JSPExecutor is a tool that allows executing JSP files from the command line or own applications, bypassing the servlet container. It is useful for code generation but lacks full servlet functionality.
The document discusses Java Server Pages (JSP) technology. It explains that JSP allows embedding of Java code within HTML pages to create dynamic web content. The key components of a JSP page are discussed including JSP comments, directives, declarations, scripting elements, actions and implicit objects. The document also covers JSP processing lifecycle and how JSP pages are compiled into Java servlets.
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
Java Hibernate Introduction, Architecture and Example with step by step guidance to run the program especially for students and teachers.
Learn More @ http://java2all.com/technology/hibernate
Network programming in java - PPT with Easy Programs and examples of Java InetAddress Class and java socket programming example.
Learn more @ http://java2all.com/technology/network-programming
This document provides an overview of web application development and servlet technology. It discusses the history and evolution of web pages to dynamic web applications. It then defines web applications and the request-response model. Common Gateway Interface (CGI) is introduced as the first technique for dynamic content, along with its limitations which led to the creation of servlets. Key servlet concepts like the servlet interface, generic servlet, HTTP servlet, and servlet lifecycle methods are covered. The document also examines the HttpServletRequest and HttpServletResponse interfaces and their various methods. Finally, it discusses session tracking approaches including cookies and the session API.
The document describes the steps to develop a simple remote method invocation (RMI) application in Java. It includes:
1. Defining a remote interface with methods like addition, subtraction etc.
2. Implementing the interface in a class that defines the method bodies.
3. Creating a server class that binds the remote object to the registry.
4. Making a client class that looks up the remote object and calls methods.
5. Compiling the classes, running the registry, then server and client separately to test the application.
The document discusses Remote Method Invocation (RMI) in Java. RMI allows objects running in one Java virtual machine to invoke methods on objects running in another Java VM. It has four layers: application layer, proxy layer, remote reference layer, and transport layer. The RMI architecture contains an RMI server, RMI client, and RMI registry. The server creates remote objects and registers them with the registry. The client looks up remote objects by name in the registry and invokes methods on them.
Jdbc example program with access and MySqlkamal kotecha
The document provides examples of using JDBC to connect to and interact with Microsoft Access and MySQL databases. It includes steps to create databases and tables in Access and MySQL, as well as code samples demonstrating how to connect to the databases using JDBC, execute queries using Statement and PreparedStatement, and retrieve and display result sets. Key aspects like loading the appropriate JDBC driver and connection strings for different databases are also explained.
The document discusses several JDBC APIs used for connecting Java applications to databases. The Connection interface is used to create a connection to a database and execute SQL statements. The Statement interface executes static SQL queries and retrieves results. The PreparedStatement interface executes dynamic queries with IN parameters by using placeholder values set using methods like setInt() and setString(). Examples of using these interfaces will be provided in subsequent chapters.
The document discusses exception handling in Java. It defines exceptions as runtime errors that occur during program execution. It describes different types of exceptions like checked exceptions and unchecked exceptions. It explains how to use try, catch, throw, throws and finally keywords to handle exceptions. The try block contains code that might throw exceptions. The catch block catches and handles specific exceptions. The finally block contains cleanup code that always executes regardless of exceptions. The document provides examples of exception handling code in Java.
The document discusses three ways to handle errors in JSP:
1. Using Java exception handling mechanisms like try/catch blocks.
2. Specifying an error page using the errorPage attribute in the page directive.
3. Configuring error pages in the web deployment descriptor (web.xml) by mapping exceptions to error pages.
The document discusses String handling in Java. It describes how Strings are implemented as objects in Java rather than character arrays. It also summarizes various methods available in the String and StringBuffer classes for string concatenation, character extraction, comparison, modification, and value conversion. These methods allow extracting characters, comparing strings, modifying strings, and converting between string and other data types.
The document discusses Java wrapper classes. Wrapper classes wrap primitive data types like int, double, boolean in objects. This allows primitive types to be used like objects. The main wrapper classes are Byte, Short, Integer, Long, Character, Boolean, Double, Float. They provide methods to convert between primitive types and their wrapper objects. Constructors take primitive values or strings to create wrapper objects. Methods like parseInt() convert strings to primitive types.
The document discusses Java packages and classes. It describes common Java API packages like java.lang, java.util, java.io, java.awt, and java.net and what types of classes they contain. It also provides examples of using packages like Vector, Random, Date, and Calendar classes and their key methods. The Calendar class allows interpreting dates and times, defining constants used for components like MONTH, DATE, HOUR, etc.
Interfaces define methods that classes can implement. Classes implementing interfaces must define all interface methods. Interfaces can extend other interfaces, requiring implementing classes to define inherited methods as well. Interface variables are implicitly public, static, and final. A class can implement multiple interfaces and override methods with the same name across interfaces. Partial interface implementation requires the class to be abstract.
ppt of class and methods in java,recursion in java,nested class,java,command line argument,method overloading,call by value,call by reference,constructor overloading core java ppt
The document discusses control structures in Java, including selection (if/else statements), repetition (loops like while and for), and branching (break and continue). It provides examples of if/else, switch, while, do-while, for, and break/continue statements. The key structures allow sequencing, selecting between alternatives, and repeating actions in a program.
This document provides step-by-step instructions for creating a simple JavaServer Pages (JSP) web application using MyEclipse. It describes how to open MyEclipse, create a new web project, add JSP files to the project, deploy the project to a Tomcat server, and view the application in a web browser by entering the URL. The instructions include screenshots indicating where to click or enter information at each step.
High-performance liquid chromatography (HPLC) is a sophisticated analytical technique used to separate, identify, and quantify the components of a mixture. It involves passing a sample dissolved in a mobile phase through a column packed with a stationary phase under high pressure, allowing components to separate based on their interaction with the stationary phase.
Separation:
HPLC separates components based on their differing affinities for the stationary phase. The components that interact more strongly with the stationary phase will move more slowly through the column, while those that interact less strongly will move faster.
Identification:
The separated components are detected as they exit the column, and the time at which each component exits the column can be used to identify it.
Quantification:
The area of the peak on the chromatogram (the graph of detector response versus time) is proportional to the amount of each component in the sample.
Principle:
HPLC relies on a high-pressure pump to force the mobile phase through the column. The high pressure allows for faster separations and greater resolution compared to traditional liquid chromatography methods.
Mobile Phase:
The mobile phase is a solvent or a mixture of solvents that carries the sample through the column. The composition of the mobile phase can be adjusted to optimize the separation of different components.
Stationary Phase:
The stationary phase is a solid material packed inside the column that interacts with the sample components. The type of stationary phase is chosen based on the properties of the components being separated.
Applications of HPLC:
Analysis of pharmaceutical compounds: HPLC is widely used for the analysis of drugs and their metabolites.
Environmental monitoring: HPLC can be used to analyze pollutants in water and soil.
Food chemistry: HPLC is used to analyze the composition of food products.
Biochemistry: HPLC is used to analyze proteins, peptides, and nucleic acids.
Odoo Inventory Rules and Routes v17 - Odoo SlidesCeline George
Odoo's inventory management system is highly flexible and powerful, allowing businesses to efficiently manage their stock operations through the use of Rules and Routes.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 795 from Texas, New Mexico, Oklahoma, and Kansas. 95 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
Envenomation is the process by which venom is injected by the bite or sting of a venomous animal such as a snake, scorpion, spider, or insect. Arthropod bite is nothing but a sharp bite or sting by ants, fruit flies, bees, beetles, moths, or hornets. Though not a serious condition, arthropod bite can be extremely painful, with redness and mild to severe swelling around the site of the bite
How to manage Multiple Warehouses for multiple floors in odoo point of saleCeline George
The need for multiple warehouses and effective inventory management is crucial for companies aiming to optimize their operations, enhance customer satisfaction, and maintain a competitive edge.
*Metamorphosis* is a biological process where an animal undergoes a dramatic transformation from a juvenile or larval stage to a adult stage, often involving significant changes in form and structure. This process is commonly seen in insects, amphibians, and some other animals.
Vitamins Chapter-7, Biochemistry and clinical pathology, D.Pharm 2nd yearARUN KUMAR
Definition and classification with examples
Sources, chemical nature, functions, coenzyme form, recommended dietary requirements, deficiency diseases of fat- and water-soluble vitamins
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 771 from Texas, New Mexico, Oklahoma, and Kansas. 72 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly.
The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
Understanding P–N Junction Semiconductors: A Beginner’s GuideGS Virdi
Dive into the fundamentals of P–N junctions, the heart of every diode and semiconductor device. In this concise presentation, Dr. G.S. Virdi (Former Chief Scientist, CSIR-CEERI Pilani) covers:
What Is a P–N Junction? Learn how P-type and N-type materials join to create a diode.
Depletion Region & Biasing: See how forward and reverse bias shape the voltage–current behavior.
V–I Characteristics: Understand the curve that defines diode operation.
Real-World Uses: Discover common applications in rectifiers, signal clipping, and more.
Ideal for electronics students, hobbyists, and engineers seeking a clear, practical introduction to P–N junction semiconductors.
How to Subscribe Newsletter From Odoo 18 WebsiteCeline George
Newsletter is a powerful tool that effectively manage the email marketing . It allows us to send professional looking HTML formatted emails. Under the Mailing Lists in Email Marketing we can find all the Newsletter.
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetSritoma Majumder
Introduction
All the materials around us are made up of elements. These elements can be broadly divided into two major groups:
Metals
Non-Metals
Each group has its own unique physical and chemical properties. Let's understand them one by one.
Physical Properties
1. Appearance
Metals: Shiny (lustrous). Example: gold, silver, copper.
Non-metals: Dull appearance (except iodine, which is shiny).
2. Hardness
Metals: Generally hard. Example: iron.
Non-metals: Usually soft (except diamond, a form of carbon, which is very hard).
3. State
Metals: Mostly solids at room temperature (except mercury, which is a liquid).
Non-metals: Can be solids, liquids, or gases. Example: oxygen (gas), bromine (liquid), sulphur (solid).
4. Malleability
Metals: Can be hammered into thin sheets (malleable).
Non-metals: Not malleable. They break when hammered (brittle).
5. Ductility
Metals: Can be drawn into wires (ductile).
Non-metals: Not ductile.
6. Conductivity
Metals: Good conductors of heat and electricity.
Non-metals: Poor conductors (except graphite, which is a good conductor).
7. Sonorous Nature
Metals: Produce a ringing sound when struck.
Non-metals: Do not produce sound.
Chemical Properties
1. Reaction with Oxygen
Metals react with oxygen to form metal oxides.
These metal oxides are usually basic.
Non-metals react with oxygen to form non-metallic oxides.
These oxides are usually acidic.
2. Reaction with Water
Metals:
Some react vigorously (e.g., sodium).
Some react slowly (e.g., iron).
Some do not react at all (e.g., gold, silver).
Non-metals: Generally do not react with water.
3. Reaction with Acids
Metals react with acids to produce salt and hydrogen gas.
Non-metals: Do not react with acids.
4. Reaction with Bases
Some non-metals react with bases to form salts, but this is rare.
Metals generally do not react with bases directly (except amphoteric metals like aluminum and zinc).
Displacement Reaction
More reactive metals can displace less reactive metals from their salt solutions.
Uses of Metals
Iron: Making machines, tools, and buildings.
Aluminum: Used in aircraft, utensils.
Copper: Electrical wires.
Gold and Silver: Jewelry.
Zinc: Coating iron to prevent rusting (galvanization).
Uses of Non-Metals
Oxygen: Breathing.
Nitrogen: Fertilizers.
Chlorine: Water purification.
Carbon: Fuel (coal), steel-making (coke).
Iodine: Medicines.
Alloys
An alloy is a mixture of metals or a metal with a non-metal.
Alloys have improved properties like strength, resistance to rusting.
As of Mid to April Ending, I am building a new Reiki-Yoga Series. No worries, they are free workshops. So far, I have 3 presentations so its a gradual process. If interested visit: https://www.slideshare.net/YogaPrincess
https://ldmchapels.weebly.com
Blessings and Happy Spring. We are hitting Mid Season.
2. JSP Element
http://www.java2all.com
3. In previous example described in introduction
to JSP, We didn`t use any java statement or code in
the file. If the developer wants to put any java code
in that file then the developer can put it by the use
of jsp tags(elements).
There are mainly three group of jsp
tags(elements) available in java server page :
1 ) JSP Scripting elements
2 ) JSP Directive elements
3 ) JSP Standard Action elements
All three elements described in next three topic.
http://www.java2all.com
5. 1. JSP Scripting elements :
There are four types of tag in jsp scripting
elements.
a) JSP Declaration tag.
b) JSP scriptlet tag.
c) JSP Expression tag.
d) Comment tag.
Now we describe each tag in detail. http://www.java2all.com
6. a) JSP Declaration tag :
A JSP declaration lets you declare or define
variables and methods (fields) that use into the jsp
page.
Declaration tag Start with <%! And End with
%>
The Code placed inside this tag must end with a
semicolon (;).
Syntax: <%! Java Code; %>
http://www.java2all.com
7. <%! private int i = 10; %>
<%! private int squre(int i)
{
i=i*i;
return i;
}
%>
You can also put these codes in a single syntax
block of declaration like,
<%! private int i = 10;
private int squre(int i)
{
i=i*i;
return i;
}
%>
Note : The XML authors can use an alternative
syntax for JSP declaration tag:
http://www.java2all.com
8. <jsp:declaration>
Java code;
</jsp:declaration>
EX.
<jsp:declaration> private int i = 1; </jsp:declaration>
<jsp:declaration>
{
private int squre(int i)
i=i*i;
return i;
}
</jsp:declaration>
You can also put these codes in a single syntax block of
declaration like,
<jsp:declaration>
private int i = 1;
private int squre(int i)
{
i=i*i;
return i;
}
</jsp:declaration>
http://www.java2all.com
9. Remember that XML elements, unlike HTML
ones, are case sensitive. So be sure to use lowercase.
Declarations do not generate any output so the
developer uses declaration tag with JSP expression tag
or JSP scriptlet tag for generating an appropriate
output for display it in the appropriate browser.
http://www.java2all.com
10. b) JSP scriptlet tag :
A JSP scriptlet lets you declare or define any
java code that use into the jsp page.
scriptlet tag Start with <% and End with
%>
The Code placed inside this tag must end
with a semicolon (;).
Syntax: <% Java Code; %>
http://www.java2all.com
11. EX.
<%
int a = 10;
out.print("a ="+a);
%>
Note : The XML authors can use an alternative
syntax for JSP scriptlet tag.
<jsp:scriptlet>
Java code;
</jsp:scriptlet>
http://www.java2all.com
12. c) JSP Expression tag :
A JSP expression is used to insert Java values directly
into the output.
JSP Expression tag is use for evaluating any expression
and directly displays the output in appropriate web browser.
Expression tag Start with <%= and End with %>
The Code placed inside this tag not end with a
semicolon (;).
Syntax: <%= Java Code %>
http://www.java2all.com
13. For example. the following shows the date/time
that the page was requested:
Current time: <%= new java.util.Date() %>
Note : The XML authors can use an alternative
syntax for JSP expressions:
<jsp:expression>
Java Expression
</jsp:expression>
http://www.java2all.com
14. d) Comment tag :
Although you can always include HTML
comments in JSP pages, users can view these if they
view the page's source. If you don't want users to be
able to see your comments, embed them within the <
%-- ... --%> tag.
<html>
<head>
<title>Comment demo</title>
</head>
<body>
<p>This is simple demo of test the comment </p>
<!-- This is a comment. Comments are not displayed in the browser but displayed in view source -->
<%-- This is a comment. Comments are not displayed in the browser as well as not displayed in view
source also --%>
</body>
</html>
http://www.java2all.com
15. Output :
This is simple demo of test the comment.
Now right click on the browser and select the
view source so we can get the code in Notepad like,
<html>
<head>
<title>Comment demo page</title>
</head>
<body>
<p>This is simple demo of test the comment. </p>
<!-- This is a comment. Comments are not displayed in the browser but displayed in view source -->
</body>
</html>
In the view sorce code, the comment put in <%--
comment --%> will not display but the comment put
in <!—comment will display.
http://www.java2all.com
16. Now using these JSP Scripting elements, we are developing some
simple examples so the use of these tags can easily understood.
<html>
<head>
<title>Scripting Demo page</title>
</head>
<body>
<%-- declaration tag --%>
<%! int i = 10; %>
<%-- scriptlet tag --%>
<% out.print("i = "+i); %>
<br>
<br>
<% out.print("for loop execution start..........."); %>
<br>
<%
for(int j=1;j<=10;j++)
{
out.print("j = "+j);
%>
<br>
<%
}
http://www.java2all.com
17. out.print("for loop execution complete...........");
%>
<br>
<br>
<%-- expression tag --%>
<%! int a = 10;
int b = 20;
%>
The addition of two variable : a + b = 10 + 20 = <%= a+b %>
<br>
<br>
Current time : <%= new java.util.Date() %>
</body>
</html
http://www.java2all.com
18. Output :
i = 10
for loop execution start...........
j=1
j=2
j=3
j=4
j=5
j=6
j=7
j=8
j=9
j = 10
for loop execution complete...........
The addition of two variable : a + b = 10 + 20 = 30
Current time : Sun Feb 12 14:00:35 IST 2012
http://www.java2all.com
20. 2. JSP Directive elements :
A JSP directive gives special information about
the page to JSP Engine.
Each JSP goes through two phases:
(1) The first phase is known as translation time,
during which the JSP engine turns the file into
a servlet. (The step following from 1 to 5 in JSP
Architecture)
http://www.java2all.com
21. • The second phase is known as request time,
during which the resulting servlet is run to
actually generate the page. (The step following
from 6 to 9 in JSP Architecture)
The JSP engine handles the directives at translation
time because the JSP engine will translate a
particular directive into a servlet only for the first
time so the developer can get more speed for the
process of loading a JSP file in a future.
Syntax:
<%@ directive-name [attribute=”value”
attribute=”value”………….] %> http://www.java2all.com
22. Note : The XML syntax for defining directives
is
<jsp:directive.directiveType [attribute=”value”
attribute=”value”………….] /> Three main types of
directives are:
a) page directive
b) include directive
c) taglib directive
http://www.java2all.com
23. a) page directive :
The page directive is used to specify attributes
for the JSP page as a whole.
The page directive does not produce any
visible output when the page is requested but
change the way the JSP Engine processes the
page.
e.g., you can make session data unavailable to
a page by setting a session to FALSE.
http://www.java2all.com
24. Syntax:
<@ page [attribute=”value”
attribute=”value”………….] %>
The table given below describes the possible
attributes for the page directive.
http://www.java2all.com
25. Syntax
Attribute Description (default value is Example
in bold)
This tells the server about
the language to be used <%@ page
language in the JSP file. Presently language="java" language="java"
the only valid value for %>
this attribute is java.
This attribute defines the import="packag <%@ page
Import list of packages, each e.class" import="java.util.
separated by comma . *, java.io.*"%>
Indicates the superclass <%@ page
extends="packa
Extends of servlet when jsp extends="com.Co
ge.class"
translated in servlet. nnect"%>
http://www.java2all.com
26. true indicates session
should be bound to the
existing session if one
exists, otherwise a new session="true| <%@ page
Session
session should be created false" session="true"%>
and bound to it and false
indicates that no sessions
will be used.
specifies the buffer size buffer="sizekb| <%@ page
Buffer
for out and default is 8kb. none" buffer="8kb"%>
True indicates
multithreading and false <%@ page
isThreadSafe="tr
isThreadSafe indicates that the servlet isThreadSafe="tr
ue|false"
should implement ue"%>
SingleThreadModel
http://www.java2all.com
27. true indicates that the
buffer should be flushed
when it is full and false
autoflush="tru <%@ page
autoFlush indicates indicates that
e|false" autoFlush="true"%>
an exception should be
thrown when the buffer
overflows.
<%@ page
This defines a string that info="This is a simple
info="message
Info can be retrieved via the jsp file created by
"
getServletInfo method. Java2all team on 22
Feb 2011"%>
<%@ page
pageEncodin This defines data type of pageEncoding=
pageEncoding="ISO-
g page encoding. "ISO-8859-1"
8859-1"%>
contentType This specifies the MIME contentType=" <%@ page
type of the output. MIME-Type" contentType="text/h
tml;
charset=ISO-8859-1"
http://www.java2all.com
28. <%@ page
This defines isELIgnored="
isELIgnored isELIgnored="false
ENUM data type. true|false "
"%>
This indicates
whether or not <%@ page
isErrorPage="true
isErrorPage the current page isErrorPage="false
|false"
can act as the "%>
error page.
Define a URL to
another JSP that
is invoked if an <%@ page
errorPage unchecked errorPage="url" errorPage="error.j
runtime sp"%>
exception is
thrown.
http://www.java2all.com
29. <%@ page language="java"
import="java.util.*,java.io.*"
extends="com.Connect"
autoFlush="true"
errorPage="error.jsp"
info="This is a simple jsp file created by Java2all team on 22 Feb 2011"
isELIgnored="false"
isErrorPage="false"
session="true"
buffer="8kb"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
isThreadSafe="true"
%>
NOTE :
The XML equivalent of
<%@ page import="java.util.*" %> is
<jsp:directive.page import="java.util.*" />
http://www.java2all.com
30. b) include directive :
It allows a JSP developer to include source code
(static resource) of a file inside jsp file at the
specified place at a translation time.
Typically include files are used for headers,
footers, tables and navigation that are common to
multiple pages.
The included page should not be another
dynamic page so the included file does not need to be
a complete and valid JSP or servlet.
http://www.java2all.com
31. Syntax:
<%@ include file="/folder_name/file_name"%>
If the included file and JSP file are available in
the same folder then the folder name is not required in
syntax.
<%@ include file="file_name"%>
Now we are describe the include directive by
one simple example so the use of include directive in
JSP file is easily understand.
http://www.java2all.com
32. Step-1 : Create two folder in webRoot
(i) HTMLFILE and (ii) JSPFILE.
Step-2 : Create a new HTML file(Included.html) in
HTMLFILE folder.
Step-3 : Replace the source code of a
file(Included.html) by the below code.
<html>
<head>
<title> Included.html </title>
</head>
<body>
<b>This is HTML page which is include in JSP file by using directive include tag in JSP file.</b> <br>
</body>
</html>
http://www.java2all.com
33. Step-4 : Create a jsp file(IncludeDemo.jsp) in
JSPFILE folder.
Step-5 : Now replace the source code of a
file(IncludeDemo.jsp) by the below code.
<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title> IncludeDemo.jsp </title>
</head>
<body>
This is a JSP page. <br>
<%@ include file="/HTMLFILE/“Included.html"%>
</body>
</html>
http://www.java2all.com
34. Step-6 : Now Redeploy the Project and start the
Server.
Step-7 : Enter the appropriate URL in web-
browser.
http://www.java2all.com
35. Output :
This is a JSP page.
This is HTML page which is include in jsp file
by using directive include tag in jsp file.
http://www.java2all.com
36. c) taglib directive :
The taglib directive makes custom actions
available in current page through the use of tag
library.
Syntax:
<%@ taglib uri="tag Library_path"
prefix="tag_prefix"%>
uri ====> The absolute path (URL) of a Tag Library
Descriptor.
prefix ====> A unique prefix used to identify custom
tags from library used later in the JSP page. http://www.java2all.com
37. EX.
<%@ taglib uri="/tlds/TableGenerator.tld"
prefix="tg"%>
And if TableGenerator.tld defines a tag named
table, then the JSP file can contain tag of following
type:
<tg:table>
……….
……….
</tg:table>
NOTE : We discuss taglib directory in detail in
further chapter. http://www.java2all.com
38. JSP Standard Action elements
http://www.java2all.com
39. JSP Standard Action elements:
Actions are high-level JSP elements that create,
modify or use other objects.
Unlike directives and scripting elements, JSP are
coded using strict XML syntax form.
By the use of JSP actions elements you can
dynamically insert a file, reuse JavaBeans
components, forward the user to another page, or
generate HTML for the Java plugin etc.
http://www.java2all.com
41. (1) <jsp:param>
The <jsp:param> action is used to provide other
tags with additional information in the form of name
value pairs.
This action is used in conjunction with
jsp:include, jsp:forward and jsp:plugin actions.
Syntax :
<jsp:param name=”parameter_name”
value=”parameter_value” />
http://www.java2all.com
42. OR
<jsp:param name=”parameter_name”
value=”parameter_value”>
</ jsp:param>
For Example,
<jsp:param name=”font_size” value=”20” />
OR
<jsp:param name=”font_size” value=”20”>
</jsp:param >
http://www.java2all.com
43. (2) <jsp:include>
This action allows a static or dynamic resource
to be including in the JSP at request time.
If page is buffered then the buffer is flushed
prior to the inclusion.
Syntax :
<jsp:include page= “file_name” flush = “true|false”
/>
http://www.java2all.com
44. OR
<jsp:include page= “file_name” flush = “true|false” >
<jsp:param name=”parameter_name”
value=”parameter_value” />
</jsp:include >
NOTE :
A <jsp:include> action may have one or more
<jsp:param> tags in its body, to provide additional
name-value pairs.
http://www.java2all.com
45. Included.jsp :-
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Included.jsp</title>
</head>
<body>
This is the message of Included.jsp file..............<br>
</body>
</html>
Include.jsp :-
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Include.jsp</title>
</head>
<body>
This is the message of Include.jsp file..............<br>
<jsp:include page="Included.jsp" />
</body>
</html>
http://www.java2all.com
46. Now run the Included.jsp in the appropriate
browser so you can get the below output in the
browser,
Output:
This is the message of Include.jsp file..............
This is the message of Included.jsp file..............
Example-2 :
Write a simple program which demonstrate the
use of <jsp:param> in <jsp:include> action element.
http://www.java2all.com
47. Employee.jsp :-
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Employee.jsp</title>
</head>
<body>
<b><i><% out.print("Name : "+request.getParameter("name1")); %></i></b> <br>
<% out.print("He is a "+request.getParameter("profile1")+" dept. in Noble Engineering College -
Junagadh."); %> <br>
<b><i><% out.print("Name : "+request.getParameter("name2"));%></i></b><br>
<% out.print("He is a "+request.getParameter("profile2")+" dept. in Noble Engineering College -
Junagadh."); %>
</body>
</html>
http://www.java2all.com
48. Information.jsp :-
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Information.jsp</title>
</head>
<body>
<jsp:include page="Employee.jsp">
<jsp:param value="Prof. Ashutosh A. Abhangi" name="name1"/>
<jsp:param value="H.O.D. of Info. Tech. " name="profile1"/>
<jsp:param value="Prof. Kamal N. Kotecha" name="name2"/>
<jsp:param value="H.O.D. of C.S.E. " name="profile2"/>
</jsp:include>
</body>
</html>
http://www.java2all.com
49. Now run the Information.jsp in the appropriate
browser so you can get the below output in the
browser,
Output:
Name : Prof. Ashutosh A. Abhangi
He is a H.O.D. of Info. Tech. dept. in Noble
Engineering College - Junagadh.
Name : Prof. Kamal N. Kotecha
He is a H.O.D. of C.S.E. dept. in Noble Engineering
College - Junagadh.
http://www.java2all.com
50. NOTE : Difference between Directive include
and Action include element.
Included
Include Syntax Done when Parsing
Content
<%@include
file=”file_na Compilation
Directive Static Container
me”%> time
<jsp:include Request Not parsed
Static or
Action page=”file_n Processing but included
dynamic
ame”%> time in container
http://www.java2all.com
51. (3) <jsp:forward>
With the forward action, the current page stops
processing the request and forwards the request to
another page.
Execution never returns to the calling (current)
page.
Syntax :
<jsp:forward page= “file_name” />
OR
<jsp: forward page= “file_name”>
<jsp:param name=”parameter_name”
value=”parameter_value” />
</jsp: forward> http://www.java2all.com
52. The meaning as well as use of the attributes and
the <jsp:param> element are same as for
<jsp:Include> action element.
Example-1 :
Write a simple program which demonstrate the
<jsp:forward> action element.
Current.jsp :
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Current.jsp</title>
</head>
<body>
This is a Current page
<jsp:forward page="Forward.jsp" />
</body>
</html>
http://www.java2all.com
53. Forward.jsp :
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Forward.jsp</title>
</head>
<body>
Welcome, Forward is working now and this is a Forwarded page...............<br/>
</body>
</html>
Now run the Current.jsp in the appropriate
browser so you can get the below output in the
browser,
Output:
Welcome, Forward is working now and this is a
Forwarded page...............
http://www.java2all.com
56. Retry.jsp :
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Retry.jsp</title>
</head>
<body>
Wrong User ID and Password, Please try again by click below link…………<br>
<b><i><a href="Login.jsp"> Login page </a></i></b>
</body>
</html>
Success.jsp :
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Success.jsp</title>
</head>
<body>
<h1>You are successfully login................. </h1>
</body>
</html>
http://www.java2all.com
57. Now run the Login.jsp in the appropriate
browser so you can get the below output,
http://www.java2all.com
58. Now put the,
User Name : aaaaaa
Password : jjjjjj
And click on Sign in button so you can get the
below output in browser,
Output :
Wrong User ID and Password, Please try again
by click below link……………………..
Login page
By clicking the Login page link, the Login.jsp
page is call and you can put the
http://www.java2all.com
59. User Name : Ashutosh
Password : java
And click on Sign in button so you can get the
below output in browser,
Output :
You are successfully login.................
http://www.java2all.com
60. (4) <jsp:fallback>
Syntax :
<jsp:fallback> text message for user </jsp:fallback>
A text message to display for the user if the
plug-in cannot be started.
If the plug-in starts but the applet or Bean does
not, the plug-in usually displays a popup window
explaining the error to the user.
Its use with <jsp:plugin> element. http://www.java2all.com
61. (5) <jsp:plugin>
By the use of <jsp:plugin> you can include an
applet and JavaBean in your JSP page. Syntax of
<jsp:plugin> is :
http://www.java2all.com
62. Syntax :
<jsp:plugin type="bean|applet“
code="className.class“
codebase="Path of className.class
after moving it in WebRoot“
[ name="name of bean or applet instance" ]
[ align="bottom|top|middle|left|right" ]
[ height="displayPixels" ]
[ width="displayPixels" ]
[ jreversion=" version of Java Runtime
environment " ]
................. >
http://www.java2all.com
64. Example-1 :
Write a simple application in which the applet is
used in JSP file by <jsp:plugin> action element.
• Create a Applet_Jsp.java file(applet) in default
package at src in your Web Project(JSP_EXAMPLE).
The source code of this java file(applet) are as
under,
http://www.java2all.com
65. Applet_Jsp.java :
import java.applet.Applet;
import java.awt.Button;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Applet_Jsp extends Applet implements ActionListener
{
public void init()
{
setBackground(Color.black);
Button r = new Button("RED");
add(r);
r.addActionListener(this);
Button g = new Button("GREEN");
add(g);
g.addActionListener(this);
Button b = new Button("BLUE");
add(b);
b.addActionListener(this);
}
http://www.java2all.com
66. public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("RED"))
setBackground(Color.red);
if(e.getActionCommand().equals("BLUE"))
setBackground(Color.blue);
if(e.getActionCommand().equals("GREEN"))
setBackground(Color.green);
}
}
(2) Now, Run this applet.
(3) Create one new folder, name is AppletClass in
WebRoot.
(3) Now,Copy the Applet_Jsp.class file(compile
file/Bytecode file) which is available at……………
workspace.metadata.me_tcatwebappsYour_Project_na
meWEB-INFclasses Applet_Jsp.class in AppletClass folder
in WebRoot. http://www.java2all.com
67. (4) Create a Applet_Use_In_Jsp.jsp file in JSPFILES
folder at your Web Project(JSP_EXAMPLE).
The source code of this jsp file are as under,
Applet_Use_In_Jsp.jsp :
<%@ page language="java" %>
<html>
<head>
<title>Applet_Use_In_Jsp.jsp</title>
</head>
<body>
<jsp:plugin type="applet" code="Applet_Jsp.class" codebase="
http://localhost:8080/JSP_EXAMPLE/AppletClass"
width="500" height="500">
<jsp:fallback>
<p>Unable to load Applet..............</p>
</jsp:fallback>
</jsp:plugin>
</body>
</html> http://www.java2all.com
68. • <jsp:useBean>
Forms are a very common method of
interactions in web sites.The standard way of
handling forms in JSP is to define a "bean".
For that you just need to define a class that has
a field corresponding to each field in the form.
The class contains the "setters" and “getter”
method of the form fields.
By this action element <jsp:useBean>, we use
java bean in a JSP page.
http://www.java2all.com
69. Syntax :
<jsp:useBean id="bean id" class="bean's class"
scope="page|request|session| application" />
Scope of <jsp:useBean> :
1. page: This is default value. It means that we can
use the Bean within the JSP page.
It indicates that the bean is only available on the
current page (stored in the PageContext of the
current page).
2. request: It means that we can use the Bean from
any JSP page processing the same request.
http://www.java2all.com
70. A value of request indicates that the bean is only
available for the current client request (stored in
the ServletRequest object).
3. session: It means that we use the Bean from
any Jsp page in the same session as the JSP page
that created the Bean.
A value of session indicates that the object is
available to all pages during the life of the current
HttpSession.
4. application: It means that we use the Bean from
any page in the same application as the Jsp page
that created the Bean. http://www.java2all.com
71. A value of application indicates that it is
available to all pages that share the same
ServletContext.
(7) <jsp:setProperty>
This action sets the value of a bean’s property.
Syntax :
<jsp:setProperty name="bean's id"
property="property Name”value="property value"/
>
http://www.java2all.com
72. (8) <jsp:getProperty>
This element retrieves the value of a bean
property, converts it to a string, and inserts it into the
output.
Syntax :
<jsp:getProperty name="bean's id"
property="property name"/>
Example : Write a simple program which
demonstrate the <jsp:useBean>,<jsp:getProperty>
and <jsp:setProperty> action elements.
http://www.java2all.com
73. Student_Data.java :
package bean;
public class Student_Data
{
private String name = null;
private String email = null;
private int age = 0;
public String getName()
{
return name;
}
public String getEmail()
{
return email;
}
public int getAge()
{
return age;
}
http://www.java2all.com
74. public void setName(String name)
{
this.name = name;
}
public void setEmail(String email)
{
this.email = email;
}
public void setAge(int age)
{
this.age = age;
}
}
http://www.java2all.com
76. Now run the BeanData.jsp in the appropriate
browser so you can get the below output in the
browser,
Output :
STUDENT DATA :
Name : Rahul
Email-ID : [email protected]
Age : 20
http://www.java2all.com