The document provides information about handling events in JavaServer Faces (JSF), including comparing action controllers to event listeners, implementing different types of event listeners like action listeners and value change listeners, and using JavaScript to submit forms. It also summarizes the typical flow of control in JSF applications from form submission to result display, and provides an example of how to create a JSF application that uses both action listeners and action controllers.
1. The document outlines the basic request workflow in Zend Framework, starting from a user's browser request and ending with the response sent back to the browser.
2. It shows how the request flows through index.php, bootstrap.php, the front controller, router, controller, and action helper broker before a response is generated and returned.
3. Key parts of the workflow include initializing plugins and helpers, finding a matching route, running pre- and post-dispatch methods, calling the controller action, and finally sending the response.
Devoxx 2009 Conference session Jbpm4 In ActionJoram Barrez
Tom Baeyens and Joram Barrez are experts on jBPM and authored the book "jBPM 4 in Action". jBPM is a powerful open source BPM and rules management platform that is great for implementing business processes and is highly embeddable in Java applications. The document highlights several new features of jBPM 4 including improved tooling, API simplification, and support for multiple languages. It provides examples of using jBPM to model common business processes and demonstrates its flexibility and performance.
This document provides an early preview of MUp, a framework for creating mashups of web contents based on a functional logic programming language called MU. It summarizes key features of MUp including simplifying data aggregation and transformation through native support for JSON manipulation, graph operations, and XPath/JSONPath queries. The document outlines the MU language and provides examples of procedural, functional, and logic programming in MU. It also describes MUp's architecture and tools for developing mashups through a web console. A synthetic validation scenario is presented to demonstrate combining restaurant and hotel data from multiple web services into a single output.
This document provides an overview and introduction to JavaServer Faces (JSF), a Java EE technology for building component-based user interfaces for web applications. It summarizes the JSF development process, standard tags, expression language, and faces-config.xml configuration file. The document also includes examples of using JSF tags for common tasks like displaying a text field and button.
Android Bootstrap provides tools and frameworks to simplify Android development. It includes libraries for dependency management (Maven), UI components (ActionBarSherlock, ViewPager), network requests (HTTP support), and more. Setting up the tools takes 3-5 days for experienced developers and 1-3 weeks for beginners. The code is hosted on GitHub and the app architecture uses Maven with modules for the parent and app. It implements features like account management and JSON parsing to reduce boilerplate code.
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your applicationjavablend
The document discusses implementing SOA and BPM in applications. It covers business requirements, common acronyms, using open source frameworks, and provides an example implementation. The presentation agenda includes SOA and BPM architectures, an ontology example, BPMN and BPEL standards, and a JBoss-based reference architecture with jBPM, JBoss ESB, and rules components.
The document compares AppDelegate and NSNotificationCenter in iOS development. AppDelegate serves as the root controller of an application and handles events like startup and shutdown. Delegates allow objects to manipulate each other through callbacks. Notifications allow asynchronous messaging between any objects through NSNotificationCenter by posting and observing notifications. The document provides examples and pros and cons of each approach.
Java beans allow the creation of reusable software components. A bean is a reusable component that can have its properties, events, and methods manipulated visually. Beans enable components to be developed once and reused across applications. Key features of beans include properties, events, introspection for analysis of capabilities, and customization to allow configuration of appearance and behavior. Beans also support persistence to save and restore the component's customized state.
1. The document outlines the basic request workflow in Zend Framework, starting from a user's browser request and ending with the response sent back to the browser.
2. It shows how the request flows through index.php, bootstrap.php, the front controller, router, controller, and action helper broker before a response is generated and returned.
3. Key parts of the workflow include initializing plugins and helpers, finding a matching route, running pre- and post-dispatch methods, calling the controller action, and finally sending the response.
Devoxx 2009 Conference session Jbpm4 In ActionJoram Barrez
Tom Baeyens and Joram Barrez are experts on jBPM and authored the book "jBPM 4 in Action". jBPM is a powerful open source BPM and rules management platform that is great for implementing business processes and is highly embeddable in Java applications. The document highlights several new features of jBPM 4 including improved tooling, API simplification, and support for multiple languages. It provides examples of using jBPM to model common business processes and demonstrates its flexibility and performance.
This document provides an early preview of MUp, a framework for creating mashups of web contents based on a functional logic programming language called MU. It summarizes key features of MUp including simplifying data aggregation and transformation through native support for JSON manipulation, graph operations, and XPath/JSONPath queries. The document outlines the MU language and provides examples of procedural, functional, and logic programming in MU. It also describes MUp's architecture and tools for developing mashups through a web console. A synthetic validation scenario is presented to demonstrate combining restaurant and hotel data from multiple web services into a single output.
This document provides an overview and introduction to JavaServer Faces (JSF), a Java EE technology for building component-based user interfaces for web applications. It summarizes the JSF development process, standard tags, expression language, and faces-config.xml configuration file. The document also includes examples of using JSF tags for common tasks like displaying a text field and button.
Android Bootstrap provides tools and frameworks to simplify Android development. It includes libraries for dependency management (Maven), UI components (ActionBarSherlock, ViewPager), network requests (HTTP support), and more. Setting up the tools takes 3-5 days for experienced developers and 1-3 weeks for beginners. The code is hosted on GitHub and the app architecture uses Maven with modules for the parent and app. It implements features like account management and JSON parsing to reduce boilerplate code.
[Pilarczyk] Adrenaline programing implementing - SOA and BPM in your applicationjavablend
The document discusses implementing SOA and BPM in applications. It covers business requirements, common acronyms, using open source frameworks, and provides an example implementation. The presentation agenda includes SOA and BPM architectures, an ontology example, BPMN and BPEL standards, and a JBoss-based reference architecture with jBPM, JBoss ESB, and rules components.
The document compares AppDelegate and NSNotificationCenter in iOS development. AppDelegate serves as the root controller of an application and handles events like startup and shutdown. Delegates allow objects to manipulate each other through callbacks. Notifications allow asynchronous messaging between any objects through NSNotificationCenter by posting and observing notifications. The document provides examples and pros and cons of each approach.
Java beans allow the creation of reusable software components. A bean is a reusable component that can have its properties, events, and methods manipulated visually. Beans enable components to be developed once and reused across applications. Key features of beans include properties, events, introspection for analysis of capabilities, and customization to allow configuration of appearance and behavior. Beans also support persistence to save and restore the component's customized state.
This document provides an overview of using Hibernate, an open source Java object-relational mapping tool. It discusses typical problems with JDBC code, how Hibernate addresses these issues, and provides sample code for mapping Java objects to database tables and performing queries and transactions with Hibernate. The document also outlines steps for a basic Hibernate tutorial, including database design, mapping classes, configuration, and data access objects.
The document summarizes the AWT event handling in Java. It describes how components generate events, listeners register with sources to receive events, and event objects are passed to listener methods. It provides examples of event classes, listener interfaces, and how to implement basic event handling in an applet using components, containers, and responding to user interactions.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive function. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
This document discusses different strategies for handling mouse and keyboard events in Java programs. It describes registering listener objects to handle events from GUI components and defines the standard AWT listener types. The strategies covered include using separate listener classes, implementing listener interfaces, and defining named and anonymous inner classes. Examples are provided to illustrate drawing on mouse clicks and key presses.
This document discusses Java I/O streams. It defines streams as representing input sources or output destinations that can represent files, devices, programs, sockets or memory arrays. Streams support different data types like bytes, primitive types, characters or objects. The document outlines the stream class hierarchy with abstract classes like InputStream, OutputStream, Reader and Writer. It describes node streams that interact with specific locations and filter streams that process or alter data. Examples of byte streams like FileInputStream and character streams like FileReader are provided.
SQL queries allow users to select, filter, and summarize data stored in database tables. The basic form of an SQL query is SELECT attributes FROM tables WHERE condition. More complex queries can join multiple tables, use subqueries, and perform aggregations. Null values in SQL represent unknown or missing data and are treated differently than normal values in comparisons and logic.
JavaBeans are reusable software components that can be visually composed using builder tools. They have properties that can be edited visually, support events to communicate between components, and allow introspection to discover their features. JavaBeans use serialization and XML for persistence so their state can be saved and restored. They provide a portable, platform-independent way to create reusable application components.
This document provides an overview of the Abstract Windowing Toolkit (AWT) and Swing GUI frameworks in Java. It discusses the similarities and differences between AWT and Swing, the fundamental AWT components like frames and panels, graphics drawing, additional AWT components, common layout managers, and how to set up top-level containers and examples using Swing components like JFrames and JOptionPanes. The key topics covered include the fundamentals of building graphical user interfaces in Java.
This document provides an introduction and overview of programming web applications using servlets. It discusses key concepts like servlets, the servlet API, HTTP requests and responses, servlet contexts, and provides examples of basic servlets that handle requests and responses. The examples demonstrate how to retrieve request parameters, set response headers and content, and maintain shared state across requests using the servlet context.
This document provides an overview of JavaServer Faces (JSF) and JavaServer Pages (JSP). It discusses the key differences between the two technologies, including that JSF is newer and handles non-functional requirements like navigation and validation, while JSP is older and leaves these to be coded manually. The document also covers the architecture and phases of JSF, common tags used in JSF and JSP, and provides an example JSF application to demonstrate basic usage.
- Doris Chen presented on JavaServer Pages/Servlets and web application frameworks.
- She discussed the JSP/Servlet technology foundation and how frameworks like Struts, JavaServer Faces, and Sun ONE Application Framework build upon it.
- Struts is an open source MVC framework that uses Java servlets as controllers and JSPs as views. It utilizes configuration files and custom tags to coordinate requests between components.
1. The document provides an overview of the major Java 2 Enterprise Edition (J2EE) technologies including Java servlets, JavaServer Pages (JSP), Enterprise JavaBeans (EJB), Java Message Service (JMS), Java Database Connectivity (JDBC), and Java Naming and Directory Interface (JNDI).
2. It describes the basic anatomy and functionality of servlets, JSP, EJB components including session and entity beans, and JMS.
3. Examples of simple servlet, JSP, EJB, and JMS code are included to illustrate how each technology can be implemented.
This document provides an overview of using Jakarta Struts to process web requests with action objects. It discusses the basic struts flow of control and the six steps to using struts: 1) modifying the struts configuration file, 2) defining a form bean, 3) creating results beans, 4) defining an action class, 5) creating a form, and 6) displaying results in a JSP. It provides examples of a single result mapping and multiple result mappings to different JSP pages depending on conditions.
This document discusses integrating JavaServer Faces (JSF), Enterprise Java Beans (EJB), and the Java Persistence API (JPA) in a Java EE application. It provides a brief overview of each technology and how they can be used together, with JSF for the presentation tier, EJBs for the business tier hosted in the EJB container, and JPA entities for the persistence tier. The document focuses on using annotations to enable dependency injection between the tiers, allowing JSF managed beans to access EJB session beans and JPA entities.
The document provides an overview of J2EE (Java 2 Enterprise Edition) technologies including servlets, JSP, EJB, and how they are used to build web applications. It describes the major components of J2EE like servlets, JSP, EJB, their anatomy and usage. Sample code is also included to demonstrate servlets and JSP.
JSF 2.0 provides many new features and improvements over JSF 1.x including built-in Ajax support, easier component development through annotations and resource handling, additional scopes like ViewScope, and a Page Description Language (PDL) based on Facelets. It aims to address issues with JSF 1.x like performance, exception handling, and reduce unnecessary configuration through conventions over configuration.
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces Skills Matter
The document summarizes a presentation on exploring JSF 2.0 and PrimeFaces, highlighting new features in JSF 2.0 such as Facelets, AJAX support, resource handling, and navigations, and how PrimeFaces builds on JSF 2.0 with additional features like themes, mobile support, and an extensive component library.
Seam aims to provide a fully integrated development platform for building rich internet applications using Java EE. It acts as "glue" between different Java EE technologies, providing context management, dependency injection and other services to simplify development. Seam handles issues like managing the Java persistence context across multiple requests and transactions. It allows extending the transaction beyond a single database transaction as well. Seam provides testing capabilities that allow fully testing Java EE applications without requiring deployment to an application server.
This document discusses migrating from JSF 1.1 to JSF 2.0. It highlights new features in JSF 2.0 including Facelets templating, Ajax support, and improved validation. When upgrading, issues may include custom components mixing technologies and JSP/JSF lifecycle conflicts. The document recommends converting JSPs to Facelets to avoid these issues, reusing existing components where possible, and using backing beans to remove logic from the view. Proper use of backing beans, custom tags, and initialization methods can help with code organization.
This document provides an overview of XPages server processing and performance. It discusses how XPages run on the Java Virtual Machine (JVM) within the Domino server. It covers memory management options for persisting the component tree in memory or on disk. It also summarizes the JSF lifecycle phases and how event handling works. Performance tests demonstrate that using computed fields on page load rather than dynamically, using data contexts over theme variables, and partial refreshes can improve performance. Understanding these technical details helps optimize XPages applications.
This document provides an overview of using Hibernate, an open source Java object-relational mapping tool. It discusses typical problems with JDBC code, how Hibernate addresses these issues, and provides sample code for mapping Java objects to database tables and performing queries and transactions with Hibernate. The document also outlines steps for a basic Hibernate tutorial, including database design, mapping classes, configuration, and data access objects.
The document summarizes the AWT event handling in Java. It describes how components generate events, listeners register with sources to receive events, and event objects are passed to listener methods. It provides examples of event classes, listener interfaces, and how to implement basic event handling in an applet using components, containers, and responding to user interactions.
The document discusses the benefits of exercise for mental health. Regular physical activity can help reduce anxiety and depression and improve mood and cognitive function. Exercise causes chemical changes in the brain that may help protect against mental illness and improve symptoms.
This document discusses different strategies for handling mouse and keyboard events in Java programs. It describes registering listener objects to handle events from GUI components and defines the standard AWT listener types. The strategies covered include using separate listener classes, implementing listener interfaces, and defining named and anonymous inner classes. Examples are provided to illustrate drawing on mouse clicks and key presses.
This document discusses Java I/O streams. It defines streams as representing input sources or output destinations that can represent files, devices, programs, sockets or memory arrays. Streams support different data types like bytes, primitive types, characters or objects. The document outlines the stream class hierarchy with abstract classes like InputStream, OutputStream, Reader and Writer. It describes node streams that interact with specific locations and filter streams that process or alter data. Examples of byte streams like FileInputStream and character streams like FileReader are provided.
SQL queries allow users to select, filter, and summarize data stored in database tables. The basic form of an SQL query is SELECT attributes FROM tables WHERE condition. More complex queries can join multiple tables, use subqueries, and perform aggregations. Null values in SQL represent unknown or missing data and are treated differently than normal values in comparisons and logic.
JavaBeans are reusable software components that can be visually composed using builder tools. They have properties that can be edited visually, support events to communicate between components, and allow introspection to discover their features. JavaBeans use serialization and XML for persistence so their state can be saved and restored. They provide a portable, platform-independent way to create reusable application components.
This document provides an overview of the Abstract Windowing Toolkit (AWT) and Swing GUI frameworks in Java. It discusses the similarities and differences between AWT and Swing, the fundamental AWT components like frames and panels, graphics drawing, additional AWT components, common layout managers, and how to set up top-level containers and examples using Swing components like JFrames and JOptionPanes. The key topics covered include the fundamentals of building graphical user interfaces in Java.
This document provides an introduction and overview of programming web applications using servlets. It discusses key concepts like servlets, the servlet API, HTTP requests and responses, servlet contexts, and provides examples of basic servlets that handle requests and responses. The examples demonstrate how to retrieve request parameters, set response headers and content, and maintain shared state across requests using the servlet context.
This document provides an overview of JavaServer Faces (JSF) and JavaServer Pages (JSP). It discusses the key differences between the two technologies, including that JSF is newer and handles non-functional requirements like navigation and validation, while JSP is older and leaves these to be coded manually. The document also covers the architecture and phases of JSF, common tags used in JSF and JSP, and provides an example JSF application to demonstrate basic usage.
- Doris Chen presented on JavaServer Pages/Servlets and web application frameworks.
- She discussed the JSP/Servlet technology foundation and how frameworks like Struts, JavaServer Faces, and Sun ONE Application Framework build upon it.
- Struts is an open source MVC framework that uses Java servlets as controllers and JSPs as views. It utilizes configuration files and custom tags to coordinate requests between components.
1. The document provides an overview of the major Java 2 Enterprise Edition (J2EE) technologies including Java servlets, JavaServer Pages (JSP), Enterprise JavaBeans (EJB), Java Message Service (JMS), Java Database Connectivity (JDBC), and Java Naming and Directory Interface (JNDI).
2. It describes the basic anatomy and functionality of servlets, JSP, EJB components including session and entity beans, and JMS.
3. Examples of simple servlet, JSP, EJB, and JMS code are included to illustrate how each technology can be implemented.
This document provides an overview of using Jakarta Struts to process web requests with action objects. It discusses the basic struts flow of control and the six steps to using struts: 1) modifying the struts configuration file, 2) defining a form bean, 3) creating results beans, 4) defining an action class, 5) creating a form, and 6) displaying results in a JSP. It provides examples of a single result mapping and multiple result mappings to different JSP pages depending on conditions.
This document discusses integrating JavaServer Faces (JSF), Enterprise Java Beans (EJB), and the Java Persistence API (JPA) in a Java EE application. It provides a brief overview of each technology and how they can be used together, with JSF for the presentation tier, EJBs for the business tier hosted in the EJB container, and JPA entities for the persistence tier. The document focuses on using annotations to enable dependency injection between the tiers, allowing JSF managed beans to access EJB session beans and JPA entities.
The document provides an overview of J2EE (Java 2 Enterprise Edition) technologies including servlets, JSP, EJB, and how they are used to build web applications. It describes the major components of J2EE like servlets, JSP, EJB, their anatomy and usage. Sample code is also included to demonstrate servlets and JSP.
JSF 2.0 provides many new features and improvements over JSF 1.x including built-in Ajax support, easier component development through annotations and resource handling, additional scopes like ViewScope, and a Page Description Language (PDL) based on Facelets. It aims to address issues with JSF 1.x like performance, exception handling, and reduce unnecessary configuration through conventions over configuration.
In The Brain of Cagatay Civici: Exploring JavaServer Faces 2.0 and PrimeFaces Skills Matter
The document summarizes a presentation on exploring JSF 2.0 and PrimeFaces, highlighting new features in JSF 2.0 such as Facelets, AJAX support, resource handling, and navigations, and how PrimeFaces builds on JSF 2.0 with additional features like themes, mobile support, and an extensive component library.
Seam aims to provide a fully integrated development platform for building rich internet applications using Java EE. It acts as "glue" between different Java EE technologies, providing context management, dependency injection and other services to simplify development. Seam handles issues like managing the Java persistence context across multiple requests and transactions. It allows extending the transaction beyond a single database transaction as well. Seam provides testing capabilities that allow fully testing Java EE applications without requiring deployment to an application server.
This document discusses migrating from JSF 1.1 to JSF 2.0. It highlights new features in JSF 2.0 including Facelets templating, Ajax support, and improved validation. When upgrading, issues may include custom components mixing technologies and JSP/JSF lifecycle conflicts. The document recommends converting JSPs to Facelets to avoid these issues, reusing existing components where possible, and using backing beans to remove logic from the view. Proper use of backing beans, custom tags, and initialization methods can help with code organization.
This document provides an overview of XPages server processing and performance. It discusses how XPages run on the Java Virtual Machine (JVM) within the Domino server. It covers memory management options for persisting the component tree in memory or on disk. It also summarizes the JSF lifecycle phases and how event handling works. Performance tests demonstrate that using computed fields on page load rather than dynamically, using data contexts over theme variables, and partial refreshes can improve performance. Understanding these technical details helps optimize XPages applications.
JavaServer Faces 2.0 - JavaOne India 2011Arun Gupta
The document outlines the key features and enhancements of Java Server Faces 2.0, including improved ease of development through Facelets and composite components, integrated Ajax support, HTTP GET support, validation integration with Bean Validation, and runtime performance improvements through partial state saving and behaviors. It provides code samples to illustrate many of the new capabilities.
This document provides an introduction to Java Server Faces (JSF) and the Seam framework, including their architectures, configurations, features, pros, and cons. JSF is a Java specification for building component-based user interfaces for web applications, while Seam extends JSF by adding features like state management, Ajax support, and page flows. The document outlines the MVC architectures of both technologies and demonstrates features like validation, error handling, and data binding through examples. It concludes by discussing advantages of Seam and shortcomings of plain JSF.
Java Server Faces (JSF) is a Java web application framework that uses the model-view-controller (MVC) architectural pattern. JSF has a component-based user interface that separates UI components from business logic. It provides features like data binding, validation, internationalization and AJAX. JSF applications typically consist of JavaBeans components, JSP pages that represent views, and configuration files that define workflows between pages.
JSF provides advantages over traditional MVC frameworks like Struts, including custom GUI components, support for different display technologies, simpler configuration and bean definitions. However, JSF also has disadvantages like a steeper learning curve and less transparent operation compared to standard servlets and JSP. Between JSF and Struts, JSF offers more powerful custom components and easier configuration, but Struts has a larger existing user base and more online resources.
Web Applications of the future: Combining JEE6 & JavaFXPaul Bakker
This presentation shows the most important web related new futures in JEE 6, and how to combine JEE 6 and JavaFX to create interesting applications. Topics such as JAX-RS, JSF 2.0, EJB lite and JavaFX/JavaScript integration is discussed.
The document discusses using the ui:repeat tag inside composite components in JSF 2.0. It provides an example of a component that takes a list of names as an attribute and renders them using ui:repeat. The component file defines the interface and implementation, and the main file declares the namespace and uses the component, passing the list of names.
This document provides guidance on configuring JPA and Hibernate for use in a Spring application. It discusses adding dependencies, defining entities with annotations, configuring the EntityManagerFactory and TransactionManager beans, and setting up transaction management. The configuration involves setting up data sources, scanning entity packages, and additional Hibernate properties. JPA annotations like @Entity and @Id are used to map objects to database tables and columns.
This document provides an overview and tutorial for ASP.NET, including Classic ASP, ASP.NET, ASP.NET Razor, programming languages used in ASP.NET (VB.NET and C#), ASP.NET server technologies (Web Pages, MVC, and Web Forms), development tools, and file extensions. It then demonstrates ASP.NET Web Pages by walking through creating a website from scratch, adding navigation, and connecting a database. The tutorial covers creating folders, files, stylesheets, layout pages, and database tables. It demonstrates displaying and adding data to the database.
The document provides a tutorial on PHP programming. It discusses what PHP is, how to install PHP, basic PHP syntax like variables and data types, and how to use PHP with HTML. It also covers PHP programming concepts like strings, operators, conditional statements, arrays, and more. The tutorial aims to teach the fundamentals of PHP to help readers get started with learning PHP.
The document discusses Java exception handling. It begins with defining what exceptions are and what happens when exceptions occur. It then covers benefits of Java's exception handling framework such as separating error handling code from regular code, propagating errors up the call stack, and grouping exception types into hierarchies. The document also discusses how to catch exceptions using try-catch blocks and the finally keyword. It covers rules for throwing exceptions and shows Java's built-in exception class hierarchy.
The document discusses the concept of inheritance in object-oriented programming. It defines inheritance as a child class automatically inheriting variables and methods from its parent class. The key benefits of inheritance are reusability of code and properties. The document explains how to create a subclass using the extends keyword, the constructor calling chain, and use of the super keyword. It also covers overriding and hiding methods, hiding fields, type casting, and final classes and methods.
The document discusses Remote Method Invocation (RMI) in Java, including its architectural components like remote interfaces, stubs, and skeletons; how objects are serialized and classes dynamically loaded during remote calls; and how to configure the RMI codebase property to specify locations for downloading classes.
1. Inheritance in Java allows classes to extend other classes and interfaces to implement other interfaces. This allows code reuse and establishes type constraints.
2. Abstract classes can contain both abstract and non-abstract methods while interfaces contain only abstract methods. Interfaces establish contracts that implementing classes must follow.
3. When constructing objects with inheritance, superclass constructors are called before subclass constructors. Abstract classes and interfaces allow incomplete implementations to be extended.
This document discusses packages, classpaths, and how to organize Java source files and classes. It explains that packages group related classes and interfaces, provide access protection and namespace management. It describes how to declare a package, place classes in packages, import packages and classes from other packages. It also covers setting the classpath so the Java runtime can locate class files, and recommended directory structures that match the package hierarchy for source and class files.
Arrays allow storing multiple values of the same type in contiguous memory locations. An array is declared with the data type followed by square brackets and the array name. The array is instantiated using the new keyword and square brackets containing the size. Array elements are accessed using an index from 0 to length-1. The length field returns the array size. Multidimensional arrays are arrays of arrays, declared with multiple bracket pairs after the name.
This document provides a tutorial on summarizing the Spring Framework. It introduces the main packages in Spring Framework including the JDBC package for data access. The JDBC package has two main subpackages - com.interface21.jdbc.core which implements low-level persistence and com.interface21.jdbc.object which presents an object-oriented view. It provides code samples demonstrating how to perform queries, updates and retrieve results using these packages.
The document provides an overview of the Struts 1.1 framework. It introduces Struts and describes its core components - the controller, model, and view. It discusses how Struts implements the MVC pattern and follows the JSP Model 2 architecture. It highlights some of the key features of Struts 1.1, including internationalization support, tag libraries, and configuration. It also provides an example of building a sample application called Beer4All to demonstrate how to use Struts.
This document discusses Java threads and related concepts like thread states, priorities, synchronization, and inter-thread communication. It covers the two main ways to create threads in Java - by extending the Thread class or implementing the Runnable interface. Synchronization techniques like using synchronized methods and blocks are presented to prevent race conditions when multiple threads access shared resources. Finally, inter-thread communication methods like wait() and notify() from the Object class are introduced.
The document introduces the Model-View-Controller (MVC) design pattern and the Struts framework. It describes the key components of MVC - the Model, View, and Controller. It then explains how Struts implements each component and allows developers to build dynamic web applications using MVC. Struts handles common tasks like separating business logic from presentation, internationalization, and connecting user input to application processing. Developers can focus on application logic rather than framework details.
This document provides an overview of key concepts related to Java networking. It discusses IP addresses, protocols, ports, and the client-server paradigm as basic networking concepts. It then describes Java's networking package, including the ServerSocket and Socket classes for creating server and client sockets, and the MulticastSocket and DatagramPacket classes for multicast communication. Example code is provided to illustrate using the ServerSocket and Socket classes to create a simple echo server and client.
The document discusses Java AWT event handling. It describes how AWT components generate events that are passed to listener objects. It provides examples of common event classes like ActionEvent and MouseEvent, and the interfaces that listener objects must implement like ActionListener and MouseListener. It also gives a simple example of an applet that registers listeners on different components and handles events in the listener methods.
The document discusses abstract classes and interfaces in Java. It defines an abstract method as a method without an implementation body, and an abstract class as one that contains at least one abstract method. An interface defines a contract that concrete classes implement by providing method bodies. Interfaces allow for multiple inheritance and polymorphism. The document provides examples of defining an abstract class, interface, and implementing an interface in a concrete class.
Essentials of Automations: The Art of Triggers and Actions in FMESafe Software
In this second installment of our Essentials of Automations webinar series, we’ll explore the landscape of triggers and actions, guiding you through the nuances of authoring and adapting workspaces for seamless automations. Gain an understanding of the full spectrum of triggers and actions available in FME, empowering you to enhance your workspaces for efficient automation.
We’ll kick things off by showcasing the most commonly used event-based triggers, introducing you to various automation workflows like manual triggers, schedules, directory watchers, and more. Plus, see how these elements play out in real scenarios.
Whether you’re tweaking your current setup or building from the ground up, this session will arm you with the tools and insights needed to transform your FME usage into a powerhouse of productivity. Join us to discover effective strategies that simplify complex processes, enhancing your productivity and transforming your data management practices with FME. Let’s turn complexity into clarity and make your workspaces work wonders!
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
Building RAG with self-deployed Milvus vector database and Snowpark Container...Zilliz
This talk will give hands-on advice on building RAG applications with an open-source Milvus database deployed as a docker container. We will also introduce the integration of Milvus with Snowpark Container Services.
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!SOFTTECHHUB
As the digital landscape continually evolves, operating systems play a critical role in shaping user experiences and productivity. The launch of Nitrux Linux 3.5.0 marks a significant milestone, offering a robust alternative to traditional systems such as Windows 11. This article delves into the essence of Nitrux Linux 3.5.0, exploring its unique features, advantages, and how it stands as a compelling choice for both casual users and tech enthusiasts.
Maruthi Prithivirajan, Head of ASEAN & IN Solution Architecture, Neo4j
Get an inside look at the latest Neo4j innovations that enable relationship-driven intelligence at scale. Learn more about the newest cloud integrations and product enhancements that make Neo4j an essential choice for developers building apps with interconnected data and generative AI.
Full-RAG: A modern architecture for hyper-personalizationZilliz
Mike Del Balso, CEO & Co-Founder at Tecton, presents "Full RAG," a novel approach to AI recommendation systems, aiming to push beyond the limitations of traditional models through a deep integration of contextual insights and real-time data, leveraging the Retrieval-Augmented Generation architecture. This talk will outline Full RAG's potential to significantly enhance personalization, address engineering challenges such as data management and model training, and introduce data enrichment with reranking as a key solution. Attendees will gain crucial insights into the importance of hyperpersonalization in AI, the capabilities of Full RAG for advanced personalization, and strategies for managing complex data integrations for deploying cutting-edge AI solutions.
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
How to Get CNIC Information System with Paksim Ga.pptxdanishmna97
Pakdata Cf is a groundbreaking system designed to streamline and facilitate access to CNIC information. This innovative platform leverages advanced technology to provide users with efficient and secure access to their CNIC details.
Dr. Sean Tan, Head of Data Science, Changi Airport Group
Discover how Changi Airport Group (CAG) leverages graph technologies and generative AI to revolutionize their search capabilities. This session delves into the unique search needs of CAG’s diverse passengers and customers, showcasing how graph data structures enhance the accuracy and relevance of AI-generated search results, mitigating the risk of “hallucinations” and improving the overall customer journey.
In the rapidly evolving landscape of technologies, XML continues to play a vital role in structuring, storing, and transporting data across diverse systems. The recent advancements in artificial intelligence (AI) present new methodologies for enhancing XML development workflows, introducing efficiency, automation, and intelligent capabilities. This presentation will outline the scope and perspective of utilizing AI in XML development. The potential benefits and the possible pitfalls will be highlighted, providing a balanced view of the subject.
We will explore the capabilities of AI in understanding XML markup languages and autonomously creating structured XML content. Additionally, we will examine the capacity of AI to enrich plain text with appropriate XML markup. Practical examples and methodological guidelines will be provided to elucidate how AI can be effectively prompted to interpret and generate accurate XML markup.
Further emphasis will be placed on the role of AI in developing XSLT, or schemas such as XSD and Schematron. We will address the techniques and strategies adopted to create prompts for generating code, explaining code, or refactoring the code, and the results achieved.
The discussion will extend to how AI can be used to transform XML content. In particular, the focus will be on the use of AI XPath extension functions in XSLT, Schematron, Schematron Quick Fixes, or for XML content refactoring.
The presentation aims to deliver a comprehensive overview of AI usage in XML development, providing attendees with the necessary knowledge to make informed decisions. Whether you’re at the early stages of adopting AI or considering integrating it in advanced XML development, this presentation will cover all levels of expertise.
By highlighting the potential advantages and challenges of integrating AI with XML development tools and languages, the presentation seeks to inspire thoughtful conversation around the future of XML development. We’ll not only delve into the technical aspects of AI-powered XML development but also discuss practical implications and possible future directions.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
2. Topics in This Section
• Comparing action controllers to event
listeners
li
• Action listeners
• V l change listeners
Value h li t
• Using JavaScript to submit form
–B
Browser incompatibilities
i tibiliti
• Combining action listeners and action
controllers in the same GUI element
5
Motivation
• There are two varieties of user interface
events
– Events that start back-end processing
– Events that affect only the format of the user interface
• JSF categorizes code that handles these as
action controllers and event listeners
– Action controllers handle main form submission
• Fire after bean has been populated (see previous section)
• Fire after validation logic (see upcoming section)
• Return strings that directly affect page navigation
– Event listeners handle UI events
• Oft fire before bean has been populated
Often fi b f b h b l t d
• Often bypass validation logic
6
• Never directly affect page navigation
3. Event Handlers vs. Ajax
• Event handlers are one of the most
convenient features of JSF
i f f
– Especially compared to Struts or regular MVC
• However Ajax is often even better
However,
– Many situations where event handlers apply result in only
a small number of elements changing
g g
– In that case, Ajax yields a more interactive user
experience
• Alth
Although it fails i older b
h f il in ld browsers and if J
d JavaScript i
S i t is
disabled
– See later lecture on Ajax4jsf
7
JSF Flow of Control (Updated)
faces-config.xml
- beans declared in managed-bean section
- mapping of return conditions
Blah.jsp declared in navigation-rule section
(Runs bean getter methods)
Redisplay
form
Do Side
Effect Business
Logic
Button or other control
referred to event listener
results
submit form Instantiate Run Action return Choose forward result1.jsp
POST request Bl h f
t Blah.faces Bean Controller Method condition
diti JSP result2.jsp
Button referred to Store results of business
action controller logic in bean ...
Run Setter resultN.jsp
Methods (Use h:outputText
to display bean
properties)
i )
8
5. Using ActionListener in JSF
• Some buttons submit the form and start
backend
b k d processing
i
– Use <h:commandButton action="..." ...>
• Other buttons affect only the UI
– Use <h:commandButton actionListener="..." .../>
– You usually want this process to occur before beans are
populated and especially before validation occurs
• Since forms are often incomplete when the UI is adjusted
– U "i
Use "immediate" to designate that listener fires before
di t " t d i t th t li t fi b f
beans are populated or validation is performed
<h:commandButton actionListener="..."
immediate="true" .../>
11
Implementing ActionListener in the
Java Code
• Listener is usually in the form bean class
– But can b in separate class if you use FacesContext to
be i l C
get the request or session object and look up the form
bean explicitly
• Takes an ActionEvent as an argument
– Void return type (not String as in action controllers)
– ActionEvent is in javax.faces.event
javax faces event
– ActionEvent has a getComponent method that lets you
obtain the UIComponent reference
• F
From the UIComponent, you can get the component ID,
th UIC t t th t ID
renderer, and other low-level information
– Sample code
public void someMethod(ActionEvent event) {
doSomeSideEffects();
}
12
6. Example: Letting the User Disable
Certain UI Controls
• Every UI control has a “disabled” property
that is false by default
h i f l b d f l
• Use button with attached ActionListener to
disable or reenable certain controls
• Specific example
– Collect name and job title to display a sample resume
– Create comboboxes that let user select foreground and
background colors
<h:selectOneMenu value="..." disabled="..." ...>
<f:selectItems value="..."/>
</h:selectOneMenu>
• Value for f:selectItems should be a SelectItem array
– Have button that disables or reenables the comboboxes
13
Steps in Using JSF
1) Create a bean
A) Properties for form data
B) Action controller and event listener methods
C) Placeholders for results data
2) Create an input form
A) Input fields refer to bean properties
B) Button specifies action controller method that will return condition
C) Button or other GUI control specifies event listener method
3) Edit faces-config.xml
A) Declare the bean
B) S if navigation rules
Specify i ti l
4) Create results pages
– Output form data and results data with h:outputText
5) P
Prevent di
direct access to JSP pages
– Use a filter that redirects blah.jsp to blah.faces
14
7. Step 1: Create Bean
• (A) Properties for form data
p
package coreservlets;
g ;
import javax.faces.model.*;
import javax.faces.event.*;
public class ResumeBean implements Serializable {
...
private String fgColor = "BLACK";
private String bgColor = "WHITE";
private SelectItem[] availableColorNames =
{ new SelectItem("BLACK"),
SelectItem( BLACK ),
new SelectItem("WHITE"),
new SelectItem("SILVER"),
new SelectItem("RED"),
new SelectItem("GREEN"),
new S l tIt ("BLUE") }
SelectItem("BLUE") };
public String getFgColor() { return(fgColor); }
public void setFgColor(String fgColor) {
this.fgColor = fgColor;
} ...
15 public SelectItem[] getAvailableColors() {...}
Step 1: Create Bean
• (A) Properties for form data
...
private String name = "";
private String jobTitle = "";
...
public String getName() { return(name); }
public void setName(String name) {
this.name = name;
}
public St i
bli String getJobTitle() { return(jobTitle); }
tJ bTitl () t (j bTitl )
public void setJobTitle(String jobTitle) {
this.jobTitle = j
j jobTitle;
;
}
16
8. Step 1: Create Bean
• (B) Event listener and action controller methods
public boolean isColorSupported() {
return(isColorSupported);
}
public void toggleColorSupport(ActionEvent event) {
isColorSupported = !isColorSupported;
}
Action listener
public String showPreview() { Action controller
if (isColorSupported && fgColor.equals(bgColor)) {
return("same-color");
} else {
return("success");
ret rn("s ccess")
}
}
17
Step 2: Create Input Form
• New features
– Use h:selectOneMenu to create combobox
– Use f:selectItems to populate list
– Use h:commandButton
• With actionListener and immediate
– Designates event listener code to fire when button clicked
– Change the label (value) of the button depending on what
the button will do
• In this case, button is a toggle
• Example code
<h:commandButton
value="#{someBean.buttonLabel}"
l "#{ B b tt L b l}"
actionListener="#{someBean.doSideEffect}"
immediate="true"/>
18
9. Step 2: Create Input Form
• (A) Input fields
<h:form>
...
Foreground color:
<h:selectOneMenu value="#{resumeBean.fgColor}"
disabled="#{!resumeBean.colorSupported}">
di bl d "#{! B l S t d}">
<f:selectItems value="#{resumeBean.availableColors}"/>
</h:selectOneMenu>
<BR>
Background color:
<h:selectOneMenu value="#{resumeBean.bgColor}"
disabled="#{!resumeBean.colorSupported}">
<f:selectItems value="#{resumeBean.availableColors}"/>
#{ } /
</h:selectOneMenu><BR>
...
Name:
<h:inputText value="#{resumeBean name}"/><BR>
value= #{resumeBean.name} /><BR>
Job Title:
<h:inputText value="#{resumeBean.jobTitle}"/><P>
19
</h:form>
Step 2: Create Input Form
• (B) Action controller
– Even when you have event listeners, you almost always
have action controllers
• As before these invoke business logic and participate in
before,
navigation flow (via navigation-rule entries in config file)
• Setter methods and validation fire before action controller
<h:form>
...
<h:commandButton value="Show P
<h dB tt l "Sh Preview"
i "
action="#{resumeBean.showPreview}"/>
</h:form>
20
10. Step 2: Create Input Form
• (C) Event listener
– Event listeners perform side effects, and then form is
redisplayed
• They do not usually invoke normal business logic setter
logic,
methods are not usually fired, and they never participate in
navigation flow (navigation-rule entries do not apply)
• You usually use "immediate" to say that setter methods do
immediate
not fire
<h:form>
...
<h:commandButton
value="#{resumeBean.colorSupportLabel}"
actionListener="#{resumeBean.toggleColorSupport}"
immediate="true"/>
</h:form>
21
Steps 2-4: Initial Result
• File is tomcat_dir/webapps/jobs/customize.jsp
• URL i h
is http://localhost/jobs/customize.faces
//l lh /j b / i f
22
11. Step 2: Result of Clicking Button
(Independent of Action Controller)
23
Step 3: Edit faces-config.xml
• (A) Declaring bean
– Note session scope so changes persist
…
<faces-config>
g
<managed-bean>
<managed-bean-name>resumeBean</managed-bean-name>
<managed-bean-class>
coreservlets.ResumeBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
…
</faces-config>
24
12. Step 3: Edit faces-config.xml
• (B) Specifying navigation rules
…
<faces-config>
g
…
<navigation-rule>
<from-view-id>/customize.jsp</from-view-id>
<navigation-case>
< i ti >
<from-outcome>same-color</from-outcome>
<to-view-id>/WEB-INF/results/same-color.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/WEB-INF/results/show-preview.jsp</to-view-id>
</navigation case>
</navigation-case>
</navigation-rule>
</faces-config>
25
Step 4: Create Results Pages
• WEB-INF/results/same-color.jsp
– R lt pages apply to action controller, not event listener
Results l t ti t ll t t li t
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java sun com/jsf/html" prefix="h" %>
uri="http://java.sun.com/jsf/html"
<f:view>
<!DOCTYPE …>
<HTML>
…
You chose
"<h:outputText value="#{resumeBean.fgColor}"/>"
as both the foreground and background color.
g g
<P>
You don't deserve to get a job, but I suppose
we will let you <A HREF="customize.faces">try again</A>.
…
</HTML>
</f:view>
26
13. Step 4: Create Results Pages
• WEB-INF/results/show-preview.jsp
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
// / /
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<f:view>
<!DOCTYPE …>
<HTML>
…
<BODY TEXT="<h:outputText value="#{resumeBean.fgColor}"/>"
BGCOLOR="<h:outputText value="#{resumeBean.bgColor}"/>">
GCO O :output e t a ue #{ esu e ea .bgCo o } /
<H1 ALIGN="CENTER">
<h:outputText value="#{resumeBean.name}"/><BR>
<SMALL><h:outputText value="#{resumeBean.jobTitle}"/>
</SMALL></H1>
Experienced <h:outputText value="#{resumeBean.jobTitle}"/>
seeks challenging position doing something.
<H2>Employment History</H2>
Blah, blah, bl h bl h Yadda, yadda, yadda, yadda.
Bl h bl h blah, blah. Y dd dd dd dd
…
</HTML>
27 </f:view>
Step 4: Example Result for
Same Colors
28
14. Step 4: Example Result for
Different Colors
29
Step 5: Prevent Direct Access
to JSP Pages
• Use filter that captures url-pattern *.jsp
– No changes from previous examples
30
16. Implementing ValueChangeListener
in Java Code
• Listener is usually in the form bean class
– As discussed previously
• Takes a ValueChangeEvent as an argument
– Useful ValueChangeEvent methods
• getComponent (as mentioned for ActionEvent)
• getOldValue (previous value of GUI element)
• getNewValue (
tN V l (current value of GUI element)
t l f l t)
– Needed since bean has probably not been populated
– Value for checkbox is of type Boolean
– Value for radio button or textfield corresponds to request parameter
– Sample code
public void someMethod(ValueChangeEvent event) {
boolean flag =
g
((Boolean)event.getNewValue()).booleanValue();
takeActionBasedOn(flag);
33
}
Example: Changing the Colors
Listed for FG and BG Colors
• h:selectOneMenu uses f:selectItems to get
list f
li of combobox entries
b b i
• Use checkbox to invoke
ValueChangeListener
• Have listener toggle the definition of the
lists
– Color names
– RGB values
34
17. Steps in Using JSF
1) Create a bean
A) Properties for form data
B) Action controller and event listener methods
C) Placeholders for results data
2) Create an input form
A) Input fields refer to bean properties
B) Button specifies action controller method that will return condition
C) Button or other GUI control specifies event listener method
3) Edit faces-config.xml
A) Declare the bean
B) S if navigation rules
Specify i ti l
4) Create results pages
– Output form data and results data with h:outputText
5) P
Prevent di
direct access to JSP pages
– Use a filter that redirects blah.jsp to blah.faces
35
Step 1: Create Bean (ResumeBean)
• (A) Code for color choices
p
private SelectItem[] availableColorNames =
[]
{ new SelectItem("BLACK"),
new SelectItem("WHITE"),
new SelectItem("SILVER"),
new SelectItem("RED"),
new SelectItem("GREEN")
SelectItem("GREEN"),
new SelectItem("BLUE") };
private SelectItem[] availableColorValues =
{ new SelectItem("#000000"),
new SelectItem( #FFFFFF ),
SelectItem("#FFFFFF"),
new SelectItem("#C0C0C0"),
new SelectItem("#FF0000"),
new SelectItem("#00FF00"),
new SelectItem("#0000FF") };
private b l
i t boolean i U i C l N
isUsingColorNames = t
true;
public SelectItem[] getAvailableColors() {
if (isUsingColorNames) {
return(availableColorNames);
} else {
return(availableColorValues);
}
36 }
18. Step 1: Create Bean
• (B) Event listener
– When checkbox selected, change color choices to return
RGB values instead of color names
– Action controller, action listener, and other form data
controller listener
shown in previous example
public void changeColorMode(ValueChangeEvent event) {
boolean flag =
((Boolean)event.getNewValue()).booleanValue();
setUsingColorNames(!flag);
}
37
Step 2: Create Input Form
(and Specify Event Listener)
• New features
– Use h:selectBooleanCheckbox to create checkbox
– Use valueChangeListener to designate event listener code
– Use onclick to automatically submit form when checkbox
value changes
• You could use onchange on Firefox, but with onchange in
Internet Explorer, input focus also has to move
I t tE l i tf l h t
• Example code
<h:selectBooleanCheckbox
valueChangeListener="#{resumeBean.changeColorMode}"
onclick="submit()"
immediate="true"/> Client-side JavaScript code
38
19. Step 2: Initial Result
• File is tomcat_dir/webapps/jobs/customize.jsp
• URL i h
is http://localhost/jobs/customize.faces
//l lh /j b / i f
39
Steps 2: Result of Changing Checkbox
(Independent of Action Controller)
40
21. Motivation
• Usually, action listeners and action
controllers are attached to different buttons
ll h d diff b
• Sometimes, you are forced to use both
– Li
Listeners have access to low-level details of GUI object
h l l l d il f bj
• Renderer, client ID, etc.
• Especially relevant when we cover custom components
• Most common example:
server-side image maps
– h:commandButton with image instead of value results in
image map
– Actual incoming request parameter names are clientID x
clientID.x
and clientID.y
• Only listener can discover the client ID
43
Example: Choosing Background
Color from Image Map
• Display grayscale color bar to user
• Let them click on desired color for
background
• B ild corresponding RGB value
Build di l
– Read the clientID.x value
– Normalize to 0-256 based on image width
0 256
– Output as hex digits into #RRGGBB string
– Done in action listener
• Forward to JSP page
– Done in action controller
44
22. Steps in Using JSF
1) Create a bean
A) Properties for form data
B) Action controller and event listener methods
C) Placeholders for results data
2) Create an input form
A) Input fields refer to bean properties
B) Button specifies action controller method that will return condition
C) Button or other GUI control specifies event listener method
3) Edit faces-config.xml
A) Declare the bean
B) S if navigation rules
Specify i ti l
4) Create results pages
– Output form data and results data with h:outputText
5) P
Prevent di
direct access to JSP pages
– Use a filter that redirects blah.jsp to blah.faces
45
Step 1: Create Bean
• (A) Form data
package coreservlets;
...
public class ColorBean {
p
private String bgColor = "WHITE";
g g ;
public String getBgColor() { return(bgColor); }
public void setBgColor(String b C l ) {
bli id C l (S i bgColor)
this.bgColor = bgColor;
}
46
23. Step 1: Create Bean
• Listener looks up x value and creates color
public void selectGrayLevel(ActionEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
String clientId = event.getComponent().getClientId(context);
HttpServletRequest request =
(HttpServletRequest)context.getExternalContext().getRequest();
( l ) l () ()
String grayLevelString = request.getParameter(clientId + ".x");
int grayLevel = 220;
try {
grayLevel = Integer.parseInt(grayLevelString);
l ( l i )
} catch(NumberFormatException nfe) {}
// Image is 440 pixels, so scale.
grayLevel = (256 * grayLevel) / 440;
String rVal = I t
St i V l Integer.toString(grayLevel, 16)
t St i ( L l 16);
setBgColor("#" + rVal + rVal + rVal);
}
• Controller designates output page
public String showPreview() {
return("success");
47
}
Step 2: Create Input Form
• Specify both action and actionListener
– Listener runs first and has access to low-level internals
– Also use h:commandButton with image instead of value
• Results in server side image map
server-side
• Code
<h:form>
...
<h:commandButton
image="images/GrayBar.gif"
actionListener="#{colorBean.selectGrayLevel}"
#{ } /
action="#{colorBean.showPreview}"/>
</h:form>
48
24. Step 2: Result
• File is tomcat_dir/webapps/jobs/customize-bg.jsp
• URL i h
is http://localhost/jobs/customize-bg.faces
//l lh /j b / i b f
49
Step 3: Edit faces-config.xml
• Declaring bean
…
<faces-config>
...
<managed-bean>
<managed-bean-name>colorBean</managed-bean-name>
<managed-bean-class>
coreservlets.ColorBean
l l
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</ d b >
…
</faces-config>
50
26. Step 4: Example Result
53
Step 5: Prevent Direct Access
to JSP Pages
• Use filter that captures url-pattern *.jsp
– No changes from previous examples
54