The document provides instructions for creating a simple "Hello World" application using Struts in Eclipse. It describes creating the necessary files - a form bean class (HelloWorldForm), an action class (HelloWorldAction), configuration files (struts-config.xml and web.xml), and JSP pages (index.jsp and helloWorld.jsp). The application demonstrates a basic MVC workflow in Struts - the action handles the request, sets a message on the form, and forwards to a JSP to display the message.
This document provides a summary of React including:
- React components are composed of props, states, and lifecycle hooks.
- Data fetching is done using libraries like Axios in component lifecycle methods like componentDidMount.
- Shared state can be managed using libraries like Redux by connecting components to the global state store.
- Other React patterns covered include children components, higher-order components, render props, and performance techniques like shouldComponentUpdate.
- Routing is typically done with React Router, though server-side rendering requires additional configuration for asynchronous data fetching.
ReactJS is a JavaScript library for building user interfaces. It uses a virtual DOM and only updates parts of the real DOM that changed. React uses a component-based architecture where data flows unidirectionally via props and state. Lifecycle methods allow components to handle state changes. Components are built with JSX syntax and can be nested to build up an application from reusable pieces.
Mvc interview questions – deep dive jinal desaijinaldesailive
Can you describe ASP.NET MVC Request Life Cycle? 1. Receive request, look up Route object in RouteTable collection and create RouteData object. 2. Create RequestContext instance. 3. Create MvcHandler and pass RequestContext to handler. 4. Identify IControllerFactory from RequestContext. 5. Create instance of class that implements ControllerBase. 6. Call MyController.Execute method. 7. The ControllerActionInvoker determines which action to invoke on the controller and executes the action on the controller, which results in calling the model and returning a view.
This document provides an overview of the Wicket framework. It demonstrates how to build web applications using Wicket's component-based model. Key aspects covered include:
1. Setting up a basic Wicket application structure with pages, components, and models.
2. Using Wicket behaviors to add interactivity like AJAX functionality.
3. Separating logic, markup, and properties with inheritance and detachable models.
4. Testing Wicket applications with the WicketTester and mocking dependencies.
Trustparency web doc spring 2.5 & hibernatetrustparency
This document summarizes an example of using Spring 2.5 and Hibernate for a web application. It describes the login and user registration workflows. For login, the request is mapped to a controller which returns a view. For registration, a controller validates user data, which is submitted to a form and stored in the database. Tiles and JSP are used to generate dynamic HTML responses.
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenSony Suci
Model View Controller (MVC) adalah metode pemrograman C# yang dikembangkan oleh Microsoft untuk menjawab seluruh programmer dunia tentang pengembangan bahasa program secara mudah dalam penggunaannya seperti bahasa java yang menjadi populer belakangan ini.
Quick introduction into react and flux followed by a comparison of redux and alt flux frameworks and a simple hello world application implemented in each of them. Last two slides present a microservices approach to client side applications as one of approaches how to make transitions between frameworks easier.
This document provides a summary of React including:
- React components are composed of props, states, and lifecycle hooks.
- Data fetching is done using libraries like Axios in component lifecycle methods like componentDidMount.
- Shared state can be managed using libraries like Redux by connecting components to the global state store.
- Other React patterns covered include children components, higher-order components, render props, and performance techniques like shouldComponentUpdate.
- Routing is typically done with React Router, though server-side rendering requires additional configuration for asynchronous data fetching.
ReactJS is a JavaScript library for building user interfaces. It uses a virtual DOM and only updates parts of the real DOM that changed. React uses a component-based architecture where data flows unidirectionally via props and state. Lifecycle methods allow components to handle state changes. Components are built with JSX syntax and can be nested to build up an application from reusable pieces.
Mvc interview questions – deep dive jinal desaijinaldesailive
Can you describe ASP.NET MVC Request Life Cycle? 1. Receive request, look up Route object in RouteTable collection and create RouteData object. 2. Create RequestContext instance. 3. Create MvcHandler and pass RequestContext to handler. 4. Identify IControllerFactory from RequestContext. 5. Create instance of class that implements ControllerBase. 6. Call MyController.Execute method. 7. The ControllerActionInvoker determines which action to invoke on the controller and executes the action on the controller, which results in calling the model and returning a view.
This document provides an overview of the Wicket framework. It demonstrates how to build web applications using Wicket's component-based model. Key aspects covered include:
1. Setting up a basic Wicket application structure with pages, components, and models.
2. Using Wicket behaviors to add interactivity like AJAX functionality.
3. Separating logic, markup, and properties with inheritance and detachable models.
4. Testing Wicket applications with the WicketTester and mocking dependencies.
Trustparency web doc spring 2.5 & hibernatetrustparency
This document summarizes an example of using Spring 2.5 and Hibernate for a web application. It describes the login and user registration workflows. For login, the request is mapped to a controller which returns a view. For registration, a controller validates user data, which is submitted to a form and stored in the database. Tiles and JSP are used to generate dynamic HTML responses.
Tutorial mvc (pelajari ini jika ingin tahu mvc) kerenSony Suci
Model View Controller (MVC) adalah metode pemrograman C# yang dikembangkan oleh Microsoft untuk menjawab seluruh programmer dunia tentang pengembangan bahasa program secara mudah dalam penggunaannya seperti bahasa java yang menjadi populer belakangan ini.
Quick introduction into react and flux followed by a comparison of redux and alt flux frameworks and a simple hello world application implemented in each of them. Last two slides present a microservices approach to client side applications as one of approaches how to make transitions between frameworks easier.
More Enhancements to Grails:
Topics covered:
Grails Plugins
Resources
Restful API
Integration Tests
What’s new in grails 2.0
What’s new in grails 2.1
What’s new in grails 2.2
How to upgrade plugins
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
The document provides an introduction to the Spring MVC framework. It describes key concepts such as MVC architecture, dependency injection, configuration of the DispatcherServlet, mapping requests to controllers, and defining views. It also discusses configuring ORM/JPA with Hibernate, sending emails, security, exceptions handling, and accessing REST services with RestTemplate. The document aims to give developers an overview of building web applications with Spring MVC.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
The objective of this tutorial is to demonstrate the implementation of Mule caching strategy with REDIS cache using Spring Data Redis module. Mule caching strategy is associated with Mule Cache scope and it is used to define the actions a cache scope takes when a message enters its subflow. In this tutorial, we will be using a simple use case to show the steps require to cache the query results of an Oracle database table into Redis cache using Spring Data Redis module.
This document contains code for inserting and retrieving a photo from a database table using JDBC.
The PhotoInsert code connects to an Oracle database, prepares an INSERT statement to add a record with an integer, string, float, and binary photo file. It inserts the photo by getting an input stream from the file and setting it as a parameter.
The PhotoRetrieve code similarly connects to the database, executes a SELECT query to get a result set, and retrieves the photo from the result set by getting an input stream and writing it to an output file stream.
Drupal8Day: Demystifying Drupal 8 Ajax Callback commandsMichael Miles
This session outlines and explains Drupal 8 AJAX callback commands and how to use them. AJAX callback commands are the sets of PHP and JavaScript functions that control all AJAX functionality on a Drupal site. You will be surprised about how simple and straight forward they are. Mastering these commands will allow your AJAX calls to do so much more then just return rendered HTML. Allowing you to provide the visitors of your Drupal 8 site a more dynamic, richer experience.
Step By Step Guide For Buidling Simple Struts AppSyed Shahul
This document provides steps to build a simple Struts application, including creating forms, actions, configuration files, and JSP pages. The key steps are:
1. Set up the project directory structure and files like web.xml.
2. Define forms, actions, and mappings in struts-config.xml.
3. Create ActionForm classes to handle form fields and validation.
4. Write Action classes to process requests and select views.
5. Develop JSP pages to display forms and output using Struts tags.
6. Build, deploy and test the complete application.
The document provides an overview of Spring MVC, comparing it to Struts, and detailing controllers, form handling, validation, configuration, and view technologies. Spring MVC controllers return ModelAndView objects and support dependency injection, making them easier to test than Struts actions. Both frameworks allow mapping requests to methods and configuring views, but Spring uses POJOs while Struts requires backing forms.
Vibrant Technologies is headquarted in Mumbai,India.We are the best Advanced java training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best Advanced Java classes in Mumbai according to our students and corporators
This document provides an overview of JSP/Servlet architecture. It describes how a web request is handled from the browser to the web server and JSP/Servlet container. It then discusses key components like servlets, JSPs, the request and response objects. It provides examples of basic servlet and JSP code to output text and access request parameters. It also covers servlet configuration, mappings, and the use of forwards and redirects.
The document discusses ASP.NET MVC framework concepts including:
- MVC architecture divides applications into models, views, and controllers. Models manage state, views display UI, and controllers handle user input and choose views.
- Advantages of MVC include clean separation of concerns, testable UI, reuse of views/models, and organized code.
- The Razor view engine renders HTML from dynamic server-side code using a specially designed parser.
- ASP.NET MVC classes are in the System.Web.Mvc namespace which contains controllers, views, and other core classes.
How to use Session.merge()In hibernate; both merge() and update() methods updates an entity and can also affect the state of an object i.e. from detached to persistent. In this article, we will explore the use of merge() method. method to merge an entity in Hibernate Application.
The document provides an overview of the Struts framework, which is an open source MVC framework for developing web applications in Java. It describes the key components of Struts including the ActionServlet, Actions, ActionForms, the struts-config.xml file, and JSP views. The Struts framework uses the MVC pattern to separate the user interface from business logic and support the building of reusable components.
Paging Library provides an efficient way to load and display large datasets from a remote data source or database. It uses pagination to only load small chunks of data at a time into memory. The key components are PagedList, DataSource and DataSource.Factory. DataSource loads pages of data and can be invalidated to trigger reloading. DataSource.Factory creates DataSources. LivePagedListBuilder connects a DataSource.Factory to a PagedList, which can be observed to update the UI. This allows efficiently loading and listening for changes to large datasets.
This document discusses authorization in ASP.NET. Authorization determines if an authenticated user has access to a resource. There are two main types of authorization - file authorization which performs ACL checks, and URL authorization which maps users and roles to parts of the URI namespace using allow and deny rules. The document provides examples of configuring authorization using these rules to grant or restrict access for specific users or roles.
- .NET remoting allows objects to be placed remotely across a network where they can communicate with local objects.
- Remote objects are activated in different ways as client-activated objects which have a finite lease time or server-activated objects which can accept single or multiple calls.
- The document provides details on remote objects, channels for message passing, and activation methods and gives examples of creating a remotable class.
The document outlines the syllabus for a course on distributed application development technology. The 6 units cover topics such as introduction to .NET framework and web services, exchanging and transforming data with XML, programming with C#, server-side ASP.NET development, database access using ADO.NET, and advanced .NET concepts including remoting and security. Each unit provides an overview of the key concepts and technologies to be taught, such as XML, XSLT, C#, ASP.NET web forms, and ADO.NET for database connectivity. References for additional reading are also included.
More Enhancements to Grails:
Topics covered:
Grails Plugins
Resources
Restful API
Integration Tests
What’s new in grails 2.0
What’s new in grails 2.1
What’s new in grails 2.2
How to upgrade plugins
Java Spring MVC Framework with AngularJS by Google and HTML5Tuna Tore
The document provides an introduction to the Spring MVC framework. It describes key concepts such as MVC architecture, dependency injection, configuration of the DispatcherServlet, mapping requests to controllers, and defining views. It also discusses configuring ORM/JPA with Hibernate, sending emails, security, exceptions handling, and accessing REST services with RestTemplate. The document aims to give developers an overview of building web applications with Spring MVC.
This document discusses architecture components for building modern Android applications. It covers common app architecture problems and principles like separation of concerns. It introduces key Architecture Components like Activities, Fragments, Services, ContentProviders, ViewModels and LiveData. It also discusses architectural patterns like MVC, MVP, MVVM and recommendations like clean architecture. The document emphasizes principles like modularity, separation of concerns, and testability. It provides an overview of alternatives like Room, Paging Library, and recommendations for legacy apps.
The objective of this tutorial is to demonstrate the implementation of Mule caching strategy with REDIS cache using Spring Data Redis module. Mule caching strategy is associated with Mule Cache scope and it is used to define the actions a cache scope takes when a message enters its subflow. In this tutorial, we will be using a simple use case to show the steps require to cache the query results of an Oracle database table into Redis cache using Spring Data Redis module.
This document contains code for inserting and retrieving a photo from a database table using JDBC.
The PhotoInsert code connects to an Oracle database, prepares an INSERT statement to add a record with an integer, string, float, and binary photo file. It inserts the photo by getting an input stream from the file and setting it as a parameter.
The PhotoRetrieve code similarly connects to the database, executes a SELECT query to get a result set, and retrieves the photo from the result set by getting an input stream and writing it to an output file stream.
Drupal8Day: Demystifying Drupal 8 Ajax Callback commandsMichael Miles
This session outlines and explains Drupal 8 AJAX callback commands and how to use them. AJAX callback commands are the sets of PHP and JavaScript functions that control all AJAX functionality on a Drupal site. You will be surprised about how simple and straight forward they are. Mastering these commands will allow your AJAX calls to do so much more then just return rendered HTML. Allowing you to provide the visitors of your Drupal 8 site a more dynamic, richer experience.
Step By Step Guide For Buidling Simple Struts AppSyed Shahul
This document provides steps to build a simple Struts application, including creating forms, actions, configuration files, and JSP pages. The key steps are:
1. Set up the project directory structure and files like web.xml.
2. Define forms, actions, and mappings in struts-config.xml.
3. Create ActionForm classes to handle form fields and validation.
4. Write Action classes to process requests and select views.
5. Develop JSP pages to display forms and output using Struts tags.
6. Build, deploy and test the complete application.
The document provides an overview of Spring MVC, comparing it to Struts, and detailing controllers, form handling, validation, configuration, and view technologies. Spring MVC controllers return ModelAndView objects and support dependency injection, making them easier to test than Struts actions. Both frameworks allow mapping requests to methods and configuring views, but Spring uses POJOs while Struts requires backing forms.
Vibrant Technologies is headquarted in Mumbai,India.We are the best Advanced java training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best Advanced Java classes in Mumbai according to our students and corporators
This document provides an overview of JSP/Servlet architecture. It describes how a web request is handled from the browser to the web server and JSP/Servlet container. It then discusses key components like servlets, JSPs, the request and response objects. It provides examples of basic servlet and JSP code to output text and access request parameters. It also covers servlet configuration, mappings, and the use of forwards and redirects.
The document discusses ASP.NET MVC framework concepts including:
- MVC architecture divides applications into models, views, and controllers. Models manage state, views display UI, and controllers handle user input and choose views.
- Advantages of MVC include clean separation of concerns, testable UI, reuse of views/models, and organized code.
- The Razor view engine renders HTML from dynamic server-side code using a specially designed parser.
- ASP.NET MVC classes are in the System.Web.Mvc namespace which contains controllers, views, and other core classes.
How to use Session.merge()In hibernate; both merge() and update() methods updates an entity and can also affect the state of an object i.e. from detached to persistent. In this article, we will explore the use of merge() method. method to merge an entity in Hibernate Application.
The document provides an overview of the Struts framework, which is an open source MVC framework for developing web applications in Java. It describes the key components of Struts including the ActionServlet, Actions, ActionForms, the struts-config.xml file, and JSP views. The Struts framework uses the MVC pattern to separate the user interface from business logic and support the building of reusable components.
Paging Library provides an efficient way to load and display large datasets from a remote data source or database. It uses pagination to only load small chunks of data at a time into memory. The key components are PagedList, DataSource and DataSource.Factory. DataSource loads pages of data and can be invalidated to trigger reloading. DataSource.Factory creates DataSources. LivePagedListBuilder connects a DataSource.Factory to a PagedList, which can be observed to update the UI. This allows efficiently loading and listening for changes to large datasets.
This document discusses authorization in ASP.NET. Authorization determines if an authenticated user has access to a resource. There are two main types of authorization - file authorization which performs ACL checks, and URL authorization which maps users and roles to parts of the URI namespace using allow and deny rules. The document provides examples of configuring authorization using these rules to grant or restrict access for specific users or roles.
- .NET remoting allows objects to be placed remotely across a network where they can communicate with local objects.
- Remote objects are activated in different ways as client-activated objects which have a finite lease time or server-activated objects which can accept single or multiple calls.
- The document provides details on remote objects, channels for message passing, and activation methods and gives examples of creating a remotable class.
The document outlines the syllabus for a course on distributed application development technology. The 6 units cover topics such as introduction to .NET framework and web services, exchanging and transforming data with XML, programming with C#, server-side ASP.NET development, database access using ADO.NET, and advanced .NET concepts including remoting and security. Each unit provides an overview of the key concepts and technologies to be taught, such as XML, XSLT, C#, ASP.NET web forms, and ADO.NET for database connectivity. References for additional reading are also included.
This document provides an overview of WML (Wireless Markup Language):
1) WML is an XML language used to specify content and user interfaces for mobile devices like PDAs and phones.
2) A WML document contains multiple "cards" that make up a "deck". Cards are like pages and decks are like websites.
3) Developing WAP applications requires a WAP-enabled web server, WAP gateway simulator, and WAP phone simulator. Configuring servers for WML and related file types is also described.
This document summarizes 17 popular Moodle modules and plugins for enhancing online courses. They include tools for web conferencing (BigBlueButton), tracking attendance, sharing content between courses (Sharing Cart), monitoring student progress (ProgressBar), allowing students to upload documents (StudentFolder), estimating time spent on a course (CourseDedication), creating custom reports (ConfigurableReports), managing task lists (Checklist), improving course navigation (CollapsedTopics and GridFormat), setting learning objectives (LessonObjectives), offline paper quizzes (OfflineQuiz), accessibility options, audio/video question types (PoodLLRecording), gamification (Level Up!), creating questions (QuestionCreationActivity), and analytics on course activity (Heat
Este documento describe las lesiones traumáticas maxilofaciales, que afectan los huesos y tejidos blandos del tercio superior, medio e inferior de la cara. La mayoría son causadas por accidentes de tránsito, y son más comunes en hombres entre 20-45 años. Se detallan las fracturas del maxilar superior, incluyendo las fracturas de Le Fort I, II y III. El diagnóstico incluye anamnesis, inspección y palpación, y el tratamiento busca asegurar la respiración, controlar hemorragias
The document provides a step-by-step guide for building a simple Struts application. It outlines 8 steps: 1) Create a development directory structure, 2) Write the web.xml file, 3) Write the struts-config.xml file, 4) Write ActionForm classes, 5) Write Action classes, 6) Create a resource properties file, 7) Write JSP pages, and 8) Build, deploy and test the application. The document describes what needs to be done at each step to set up the basic structure and configuration for a simple Struts application.
Struts2.x is a MVC framework that implements the MVC pattern using Java technologies. It divides an application into model, view, and controller components. The model are Java classes that represent the application's data and business logic. Views are JSP pages that represent the user interface. The controller is a servlet filter that routes requests to actions and returns the appropriate view. Struts provides tags and libraries that make building MVC web apps with features like validation easier compared to plain JSP/Servlet programming.
Struts is a framework that aims to solve issues with repetitive code in JSP applications. It is based on the MVC pattern and moves code into XML configuration files. The key components are the ActionServlet, which controls navigation; ActionForms, which collect form data; ActionMappings, which help determine where requests are sent; and Action classes, which contain business logic and return ActionForwards to determine the next steps.
Struts An Open-source Architecture for Web Applicationselliando dias
The document provides an overview of Struts, an open-source MVC framework for building web applications in Java, discussing how to install and configure Struts, its core concepts like the MVC pattern, and how to develop applications using Struts including creating forms, actions, and tag libraries.
The document discusses Struts framework and internationalization (I18N) applications. Some key points:
1. Struts is a MVC framework that simplifies development of web applications. It provides components like ActionServlet and tag libraries.
2. I18N applications display output based on the user's locale/language. This is achieved using properties files with language-specific translations and the ResourceBundle class.
3. In Struts, properties files are configured in struts-config.xml and accessed in JSPs using the <message> tag. Keys not found will result in errors unless null=false is specified.
This document provides an introduction to Jakarta Struts 1.3, an open source MVC framework for building Java web applications. It discusses the limitations of using the traditional MVC pattern for web applications due to HTTP's stateless nature. Struts implements an MVC2 pattern to address this, using the controller to manage state. The core Struts components like ActionForms, Actions, and ActionMappings are explained. It also covers setting up the Struts controller through configuration files, defining forms and actions, and creating views with JSP and custom tag libraries.
This ppt tells about struts in java. All the methods and brief knowledge of struts. For more info about struts and free projects on it please visit : http://s4al.com/category/study-java/
1. The document discusses servlets, which are Java classes that extend HttpServlet to generate dynamic web content. It covers creating a basic servlet class, mapping it in the deployment descriptor, packaging it into a WAR file, and analyzing requests and sending responses.
2. It then provides examples of using the request object to retrieve headers, parameters, and cookies, and using the response object to add headers, write content, and send cookies.
3. The final sections discuss using servlets to build a basic web form application that separates the controller and view layers. It also covers using HTTP sessions to share data across requests.
Java servlets are small programs that run on a web server and dynamically generate web page content. They extend the functionality of web servers and allow for more complex interactions than CGI programs. Servlets support multithreading and sharing of resources, making them faster than CGI programs which require creating a new process for each request. Common ways to handle form data submitted to servlets include using the getParameter() method to retrieve parameter values by name. Sessions can be tracked across requests using cookies, which are small pieces of data stored in the user's browser by the web server. There are two main architectures for developing JSP applications - page-centric and servlet-centric, with servlet-centric following the MVC pattern and separating business
Servlet 3.0 is an update to the Java Servlet specification that includes several new features such as annotations for declaring servlets, filters, and listeners; web fragments for modular deployment configurations; dynamic registration of servlets and filters; programmatic login; asynchronous processing; and multipart file upload support. It aims to simplify configuration, improve extensibility and enable new programming patterns for servlet-based applications.
The document discusses how to create a logger interceptor in Spring to log information before, after, and around request handling. It shows how to create an interceptor class that extends HandlerInterceptorAdapter and overrides its callback methods. It also demonstrates how to associate the interceptor with handler mappings to enable interceptor functionality. When executed, log messages from the interceptor will be displayed in the console. The document further explains how to configure the interceptor for use with annotated Spring controllers using DefaultAnnotationHandlerMapping instead of a regular handler mapping.
The Spring MVC framework uses the model-view-controller (MVC) architecture. It features a DispatcherServlet that handles requests and responses and relies on controllers to process user input and build the model data before passing it to the view for rendering. Configuration involves mapping the DispatcherServlet to URLs in web.xml and defining controllers with annotations and handler methods. Spring Security integrates with Spring MVC to add authentication and authorization for specific URLs specified in the spring-security.xml configuration file.
This document describes the development of a REST web service for car renting using Spring. The service defines three core functions: retrieving a list of available cars, renting a car, and returning a rented car. It provides these functions through a REST interface and uses JSON to serialize data between the Java backend and clients. The document outlines setting up the Spring backend to implement this interface and convert between Java objects and JSON, and includes details on developing a Java client to test the service and potential next steps to build a web client.
The document provides an agenda for a Struts 2 workshop over two days. Day 1 will cover understanding Struts 2 architecture and features, environment setup, and configuration. Attendees will learn about MVC design patterns, request lifecycle, interceptors, and results. They will also have a practical lab on Struts 2 applications and an introduction to Hibernate. Day 2 will involve further practical labs.
The document provides answers to 12 interview questions about the Struts framework. It defines key concepts like MVC, frameworks, Struts framework, ActionServlet, Action classes, ActionForms, validation, and RequestProcessor. The questions and answers cover the responsibilities and roles of these core Struts components and how they implement the MVC architecture.
JavaServer Faces (JSF) is a web application framework that uses the model-view-controller (MVC) paradigm. It provides reusable UI components and manages the flow of web applications. MyFaces is an open source implementation of JSF that provides additional pre-built components. The document discusses the JSF architecture, how it works, example code components like input fields and validators, and advantages like reusable components and built-in validation.
Java Server Faces (JSF) is a Java web development framework that provides reusable UI components and a component-based MVC architecture. Key aspects of JSF include:
- Clean separation of behavior and presentation using a component-based MVC model.
- Standard UI components and events tied to server-side code.
- Typical JSF applications include JavaBeans for state/behavior, event-driven development, and JSP view pages that reference a component tree.
The example JSF calculator application demonstrates:
1) Configuring the Faces servlet and managed beans.
2) Developing a model class and controller to mediate between the view and model.
3) Creating
Backbone.js is a lightweight JavaScript framework that provides structure to client-side code through an MVC pattern. It connects a single-page application to a backend via RESTful JSON and allows fetching and saving data without full page refreshes. Backbone provides models to represent data, views to handle the UI, and collections to manage groups of models. Events allow views to update dynamically when models change. It aims to increase code organization and reuse while keeping the framework lightweight.
Ajax allows for asynchronous retrieval of data from a server in the background without reloading the page. It uses a combination of technologies like XMLHttpRequest, JavaScript, and DOM to make asynchronous calls to a server and update portions of a page without reloading. The document then provides an example of how an Ajax interaction works, from making an asynchronous request to a server to processing the response and updating the HTML DOM.
Ajax allows for asynchronous retrieval of data from a server in the background without reloading the page. It uses a combination of technologies like XMLHttpRequest, JavaScript, and DOM to make asynchronous calls to a server and update portions of a page without reloading. The document then provides an example of how an Ajax interaction works, from making an asynchronous request to a server to processing the response and updating the HTML DOM.
This document outlines various Microsoft certification programs including MCSA, MCSD, MCSE, and MTA. It provides information on certification tracks for SQL Server 2012, Windows Server 2012, Windows 8, Windows Store app development using C# and HTML5, web applications, application lifecycle management, and IT infrastructure fundamentals. It promotes the MTA certification as an entry-level option for fundamentals training in IT infrastructure, database, software development, and application lifecycle management.
Visual Studio 2008 improves developer productivity, collaboration across the lifecycle, and employs the latest technologies. It allows for better team collaboration with real-time visibility and integrated quality tools. Visual Studio 2008 also aims to decrease complexity and deliver a predictable, visible, and controlled development process through features like full lifecycle management and real-time project reporting.
This document is the preface to a book about internetworking technologies from an engineering perspective. It was written by Rahul Banerjee and discusses the motivation for creating an online book and reference to help students learn about this topic. The preface provides background on the intended audience, topics to be covered in the book, and acknowledgements. It aims to provide a comprehensive introductory resource for networking concepts, architectures, applications and development projects.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
How to Make a Field Mandatory in Odoo 17Celine George
In Odoo, making a field required can be done through both Python code and XML views. When you set the required attribute to True in Python code, it makes the field required across all views where it's used. Conversely, when you set the required attribute in XML views, it makes the field required only in the context of that particular view.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
1. Struts Tutorial
MVC Architecture
Struts MVC Architecture
The model contains the business logic and interact with the persistance storage to
store, retrive and manipulate data.
The view is responsible for dispalying the results back to the user. In Struts the
view layer is implemented using JSP.
The controller handles all the request from the user and selects the appropriate
view to return. In Sruts the controller's job is done by the ActionServlet.
The following events happen when the Client browser issues an HTTP request.
The ActionServlet receives the request.
The struts-config.xml file contains the details regarding
the Actions, ActionForms,ActionMappings and ActionForwards.
During the startup the ActionServelet reads the struts-config.xml file and creates a
database of configuration objects. Later while processing the request
the ActionServletmakes decision by refering to this object.
When the ActionServlet receives the request it does the following tasks.
Bundles all the request values into a JavaBean class which extends
Struts ActionForm class.
Decides which action class to invoke to process the request.
Validate the data entered by the user.
The action class process the request with the help of the model component. The
model interacts with the database and process the request.
After completing the request processing the Action class returns
an ActionForward to the controller.
Based on the ActionForward the controller will invoke the appropriate view.
The HTTP response is rendered back to the user by the view component.
Hello World Example in Eclipse
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 1 of 19
2. Struts Tutorial
In this tutorial you will learn how to create a Struts hello world application
in eclipse. First create a new project, go to File->New and select
DynamicWebProject.
Enter the project name and click the Finish button.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 2 of 19
3. Add the following jar files to the WEB-INFlib directory.
Right click the src folder and select New->Package.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 3 of 19
4. Enter the package name as com.vaannila.form and click Finish.
Now right click the newly created package and select New->Class.
Enter the class name as HelloWorldForm and the superclass name
asorg.apache.struts.action.ActionForm and click Finish.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 4 of 19
5. In the HelloWorldForm class add the following code.
01.package com.vaannila.form;
02.
03.import org.apache.struts.action.ActionForm;
04.
05.public class HelloWorldForm extends ActionForm {
06.
07.private static final long serialVersionUID = -473562596852452021L;
08.
09.private String message;
10.
11.public String getMessage() {
12.return message;
13.}
14.
15.public void setMessage(String message) {
16.this.message = message;
17.}
18.}
In the same way create a new package com.vaannila.action and create
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 5 of 19
6. a HelloWorldActionclass extending org.apache.struts.action.Action. Add the
following code to the action class and save it.
01.package com.vaannila.action;
02.
03.import javax.servlet.http.HttpServletRequest;
04.import javax.servlet.http.HttpServletResponse;
05.
06.import org.apache.struts.action.Action;
07.import org.apache.struts.action.ActionForm;
08.import org.apache.struts.action.ActionForward;
09.import org.apache.struts.action.ActionMapping;
10.
11.import com.vaannila.form.HelloWorldForm;
12.
13.public class HelloWorldAction extends Action {
14.
15.@Override
16.public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throwsException
{
17.HelloWorldForm hwForm = (HelloWorldForm) form;
18.hwForm.setMessage("Hello World");
19.return mapping.findForward("success");
20.}
21.}
Here we typecast the ActionForm to HelloWorldForm and set the message
value.
Add the following entries in the struts-config.xml file.
01.<?xml version="1.0" encoding="ISO-8859-1" ?>
02.
03.<!DOCTYPE struts-config PUBLIC
04."-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
05."http://struts.apache.org/dtds/struts-config_1_3.dtd">
06.
07.<struts-config>
08.
09.<form-beans>
10.<form-
bean name="helloWorldForm"type="com.vaannila.form.HelloWorldForm"/>
11.</form-beans>
12.
13.<global-forwards>
14.<forward name="helloWorld" path="/helloWorld.do"/>
15.</global-forwards>
16.
17.<action-mappings>
18.<action path="/helloWorld"type="com.vaannila.action.HelloWorldAction"n
ame="helloWorldForm">
19.<forward name="success" path="/helloWorld.jsp" />
20.</action>
21.</action-mappings>
22.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 6 of 19
7. 23.</struts-config>
Now configure the deployment descriptor. Add the following configuration
information in theweb.xml file.
01.<?xml version="1.0" encoding="UTF-8"?>
02.<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:web="http://jav
a.sun.com/xml/ns/javaee/web-
app_2_5.xsd"xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-
app_2_5.xsd" id="WebApp_ID"version="2.5">
03.<display-name>StrutsExample1</display-name>
04.
05.<servlet>
06.<servlet-name>action</servlet-name>
07.<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
08.<init-param>
09.<param-name>config</param-name>
10.<param-value>/WEB-INF/struts-config.xml</param-value>
11.</init-param>
12.<load-on-startup>2</load-on-startup>
13.</servlet>
14.
15.<servlet-mapping>
16.<servlet-name>action</servlet-name>
17.<url-pattern>*.do</url-pattern>
18.</servlet-mapping>
19.
20.<welcome-file-list>
21.<welcome-file>index.jsp</welcome-file>
22.</welcome-file-list>
23.</web-app>
When we run the application the index.jsp page will be executed first. In
the index.jsp page we redirect the request to the helloWorld.do URI, which
inturn invokes the HelloWorldAction.
1.<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
2.<logic:redirect forward="helloWorld"/>
In the action class we return the ActionForward "success" which is mapped
to thehelloWorld.jsp page. In the helloWorld.jsp page we display the "Hello
World" message.
01.<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
02.<html>
03.<head>
04.<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-
1">
05.<title>Hello World</title>
06.</head>
07.<body>
08.<bean:write name="helloWorldForm" property="message"/>
09.</body>
10.</html>
After creating all the files the directory structure of the application looks
like this.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 7 of 19
8. On executing the application the "Hello World" message gets displayed to the
user.
Hello World Application
Lets say a quick hello to struts. Struts follows MVC 2 pattern. The following
files are needed to create a hello world application.
index.jsp
helloWorld.jsp
web.xml
struts-config.xml
HelloWorldAction.java
HelloWorldActionForm.java
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 8 of 19
9. web.xml
web.xml is used to configure the servlet container properties of the hello
world appliation.
1.<welcome-file-list>
2.<welcome-file>index.jsp</welcome-file>
3.</welcome-file-list>
The gateway for our hello world application is index.jsp file. The index.jsp file
should be mentioned in web.xml as shown above.
index.jsp
In the hello world example the index.jsp page simply forwards the request to
the hello world action.
1.<jsp:forward page="HelloWorld.do"/>
struts-config.xml
struts-config.xml file is used to configure the struts framework for the hello
world application. This file contains the details regarding the form bean and
the action mapping.
01.<struts-config>
02.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 9 of 19
10. 03.<form-beans>
04.<form-bean name="HelloWorldActionForm"
05.type="com.vaannila.HelloWorldActionForm"/>
06.</form-beans>
07.
08.<action-mappings>
09.<action input="/index.jsp" name="HelloWorldActionForm"path="/HelloWo
rld" scope="session"type="com.vaannila.HelloWorldAction">
10.<forward name="success" path="/helloWorld.jsp" />
11.</action>
12.</action-mappings>
13.
14.</struts-config>
HelloWorldActionForm.java
HelloWorldActionForm extends org.apache.struts.action.ActionForm.
HelloWorldActionForm class has one String variable message and the
corresponding getter and setter methods.
01.public class HelloWorldActionForm extends
02.org.apache.struts.action.ActionForm {
03.
04.private String message;
05.
06.public HelloWorldActionForm() {
07.super();
08.}
09.
10.public String getMessage() {
11.return message;
12.}
13.
14.public void setMessage(String message) {
15.this.message = message;
16.}
17.
18.}
HelloWorldAction.java
HelloWorldAction class extends org.apache.struts.action.Action. The action
class contains an execute method which contains the business logic of the
application. To access the HelloWorldActionForm variables in the Action we
need to type caste the form object to HelloWorldActionForm. Then we can
access the variables using the getter and setter methods. The execute
method returns a value of type ActionForward, based on its value the
corresponding view will be called. This configuration is done in struts-
config.xml file.
01.public class HelloWorldAction extends org.apache.struts.action.Action {
02.
03.private final static String SUCCESS = "success";
04.
05.public ActionForward execute(ActionMapping mapping,ActionForm form,
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 10 of 19
11. 06.HttpServletRequest request,HttpServletResponse
response)throws Exception {
07.
08.HelloWorldActionForm helloWorldForm = (HelloWorldActionForm) form;
09.helloWorldForm.setMessage("Hello World!");
10.return mapping.findForward(SUCCESS);
11.
12.}
13.}
1.<action-mappings>
2.<action input="/index.jsp" name="HelloWorldActionForm"path="/HelloWorl
d"
3.scope="session" type="com.vaannila.HelloWorldAction">
4.<forward name="success" path="/helloWorld.jsp" />
5.</action>
6.</action-mappings>
The name "success" is mapped to the view helloWorld.jsp. So when the
execute method in the action returns "success" the request will be forwarded
to the helloWold.jsp page.
helloWorld.jsp
In helloWorld.jsp we get the value of the form variable message and display
it. We use struts bean tag to do this. The name attribute of the bean tag hold
the value of the action form and the property attribute holds the value of the
variable to be displayed.
01.<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
02.<html>
03.<head>
04.<title>Hello World</title>
05.</head>
06.<body>
07.<h1>
08.<bean:write name="HelloWorldActionForm" property="message" />
09.</h1>
10.</body>
11.</html>
Extract the downloaded files into the webapps folder of the Tomcat server.
Start the Tomcat server. Type the following url in the browser
"http://localhost:8080/Example1/index.jsp". There you go, you have your
first struts program up and running.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 11 of 19
12. Login Application Using Action Form
Login Application Using Action Form
In this example we will see how to create a login application using
ActionForm. The following files are required for the login application.
login.jsp
success.jsp
failure.jsp
web.xml
struts-config.xml
LoginAction.java
LoginForm.java
ApplicationResource.properties
web.xml
The first page that will be called in the login application is the login.jsp page.
This configuration should be done in web.xml as shown below.
1.<welcome-file-list>
2.<welcome-file>login.jsp</welcome-file>
3.</welcome-file-list>
login.jsp
We use Struts HTML Tags to create login page. The form has one text field to
get the user name and one password field to get the password. The form also
has one submit button, which when clicked calls the login
action. <html:errors /> tag is used to display the error messages to the user.
01.<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
02.<html>
03.<head>
04.<title>Login Page</title>
05.</head>
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 12 of 19
13. 06.<body>
07.<div style="color:red">
08.<html:errors />
09.</div>
10.<html:form action="/Login" >
11.User Name :<html:text name="LoginForm" property="userName" />
12.Password :<html:password name="LoginForm" property="password" />
13.<html:submit value="Login" />
14.</html:form>
15.</body>
16.</html>
The user enters the user name and password and clicks the login button. The
login action is invoked.
struts-config.xml
The validate method in the LoginForm class is called when the Form is
submitted. If any errors are found then the control is returned back to the
input page where the errors are displayed to the user. The input page is
configured in the action tag of strut-config file. <html:errors /> tag is used to
display the errors in the jsp page.
01.<struts-config>
02.<form-beans>
03.<form-bean name="LoginForm" type="com.vaannila.LoginForm"/>
04.</form-beans>
05.
06.<action-mappings>
07.<action input="/login.jsp" name="LoginForm" path="/Login"scope="sessio
n" type="com.vaannila.LoginAction">
08.<forward name="success" path="/success.jsp" />
09.<forward name="failure" path="/failure.jsp" />
10.</action>
11.</action-mappings>
12.</struts-config>
Here the action is "/Login" , the input page is "login.jsp" and the
corresponding action class is LoginAction.java. Now the validate method in
the LoginForm class will be invoked.
LoginForm.java
Inside the validate method, we check whether the user name and password is
entered. If not the corresponding error message is displayed to the user. The
error messages are configured in the ApplicationResource.properties file.
01.public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
02.ActionErrors errors = new ActionErrors();
03.if (userName == null || userName.length() < 1) {
04.errors.add("userName", newActionMessage("error.userName.required"));
05.}
06.if (password == null || password.length() < 1) {
07.errors.add("password", newActionMessage("error.password.required"));
08.}
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 13 of 19
14. 09.return errors;
10.}
ApplicationResource.properties
The ApplicationResource.properties file contains the error messages. The key
"error.userName.required" is used in the validate function to add a new error.
Since the error messages are configured in a seperate properties file they can
be changed anytime without making any changes to the java files or the jsp
pages.
1.error.userName.required = User Name is required.
2.error.password.required = Password is required.
If either user name or password is not entered then the corresponding error
message will be added to the ActionErrors. If any errors are found then the
control is returned back to the input jsp page, where the error messages are
displayed using the <html:errors /> tag. The validate method is used to
perform the client-side validations. Once when the input data is valid the
execute method in the LoginAction class is called.
LoginAction.java
The execute method contains the business logic of the application. Here first
we typecast the ActionForm object to LoginForm, so that we can access the
form variables using the getter and setter methods. If the user name and
password is same then we forward the user to the success page else we
forward to the failure page.
01.public class LoginAction extends org.apache.struts.action.Action {
02.
03.private final static String SUCCESS = "success";
04.private final static String FAILURE = "failure";
05.
06.public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throwsException
{
07.LoginForm loginForm = (LoginForm) form;
08.if (loginForm.getUserName().equals(loginForm.getPassword())) {
09.return mapping.findForward(SUCCESS);
10.} else {
11.return mapping.findForward(FAILURE);
12.}
13.}
14.}
Lets enter the user names and password as "Eswar". Since the user name and
password is same the execute method will return an ActionForward
"success". The corresponding result associated with the name "success" will
be shown to the user. This configuration is done in struts-config.xml file.
1.<action-mappings>
2.<action input="/login.jsp" name="LoginForm" path="/Login"scope="session"
type="com.vaannila.LoginAction">
3.<forward name="success" path="/success.jsp" />
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 14 of 19
15. 4.<forward name="failure" path="/failure.jsp" />
5.</action>
6.</action-mappings>
So according to the configuration in struts-config.xml the user will be
forwarded to success.jsp page.
If the user name and password did not match the user will be forwarded to
the failure page. Lets try entering "Joe" as the user name and "Eswar" as the
password, the following page will be displayed to the user.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 15 of 19
16. DispatchAction Class
DispatchAction Class
DispatchAction provides a mechanism for grouping a set of related functions
into a single action, thus eliminating the need to create seperate actions for
each functions. In this example we will see how to group a set of user related
actions like add user, update user and delete user into a single action called
UserAction.
The class UserAction extends org.apache.struts.actions.DispatchAction. This
class does not provide an implementation of the execute() method as the
normal Action class does. The DispatchAction uses the execute method to
manage delegating the request to the individual methods based on the
incoming request parameter. For example if the incoming parameter is
"method=add", then the add method will be invoked. These methods should
have similar signature as the execute method.
01.public class UserAction extends DispatchAction {
02.
03.private final static String SUCCESS = "success";
04.
05.public ActionForward add(ActionMapping mapping, ActionForm form,
06.HttpServletRequest request, HttpServletResponse response)
07.throws Exception {
08.UserForm userForm = (UserForm) form;
09.userForm.setMessage("Inside add user method.");
10.return mapping.findForward(SUCCESS);
11.}
12.
13.public ActionForward update(ActionMapping mapping, ActionForm form,
14.HttpServletRequest request, HttpServletResponse response)
15.throws Exception {
16.UserForm userForm = (UserForm) form;
17.userForm.setMessage("Inside update user method.");
18.return mapping.findForward(SUCCESS);
19.}
20.
21.public ActionForward delete(ActionMapping mapping, ActionForm form,
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 16 of 19
17. 22.HttpServletRequest request, HttpServletResponse response)
23.throws Exception {
24.UserForm userForm = (UserForm) form;
25.userForm.setMessage("Inside delete user method.");
26.return mapping.findForward(SUCCESS);
27.}
28.}
If you notice the signature of the add, update and delete methods are similar
to the execute method except the name. The next step is to create an action
mapping for this action handler. The request parameter name is specified
using the parameter attribute. Here the request parameter name is method.
1.<action-mappings>
2.<action input="/index.jsp" parameter="method" name="UserForm"path="/U
serAction" scope="session" type="com.vaannila.UserAction">
3.<forward name="success" path="/index.jsp" />
4.</action>
5.</action-mappings>
Now lets see how to invoke a DispatchAction from jsp. We have a simple form
with three buttons to add, update and delete a user. When each button is
clicked a different method in UserAction class is invoked.
01.<html>
02.<head>
03.<script type="text/javascript">
04.function submitForm()
05.{
06.document.forms[0].action = "UserAction.do?method=add"
07.document.forms[0].submit();
08.}
09.</script>
10.</head>
11.<body>
12.<html:form action="UserAction" >
13.<table>
14.<tr>
15.<td>
16.<bean:write name="UserForm" property="message" />
17.</td>
18.</tr>
19.<tr>
20.<td>
21.<html:submit value="Add" onclick="submitForm()" />
22.</td>
23.</tr>
24.<tr>
25.<td>
26.<html:submit property="method" value="update" />
27.</td>
28.</tr>
29.<tr>
30.<td>
31.<html:submit property="method" >delete</html:submit>
32.</td>
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 17 of 19
18. 33.</tr>
34.</table>
35.</html:form>
36.</body>
37.</html>
Now consider the update and the delete button. The request parameter name
specified in the action handler is "method". So this should be specified as the
property name for the submit button. The name of the method to be invoked
and the value of the button should be the same. So when the button is
clicked the corresponding method in the UserAction will be called. The
delete button shows an alternate way to specify the value of the button.
Here the main constraint is the method name and the button name should be
same. So we can't have an update button like this "Update". Inorder to avoid
this you can call a javascript function on click of the button. Specify the
action and submit the form from javascript. In this way we can have a
different button name and method name. On click of the Add button the
action value is set to "UserAction.do?method=add" and the form is submitted
from javascript.
On executing the sample example the following page is displayed to the user.
After clicking the add button the following page is displayed.
http://www.vaannila.com/struts/struts-tutorial/struts-tutorial.html Page 18 of 19