Struts Tutorials - Jakarta Struts Tutorial
This complete reference of Jakarta Struts shows you how to develop Struts applications using ant and deploy on the JBoss Application Server. Ant script is provided with the example code. Many advance topics like Tiles, Struts Validation Framework, Java Script validations are covered in this tutorial.
Using multiple Struts configuration files
This tutorial shows Java Web developers how to set up Apache Struts to use multiple configuration files. You'll learn about the purpose and structure of the various Struts configuration files and the rationale for working with smaller files. You'll follow steps to split a large, complex struts-config.xml file for an existing Struts application into multiple configuration files that are organized by function. You'll also learn about some other types of cleanup you can do to improve your Struts configurations.
Prerequisites: This tutorial is written for Java Web developers who have at least some basic experience with Apache Struts and the Apache Tomcat servlet engine. You should know how to start and stop Tomcat, install Struts, and deploy a Struts application.
Using the Struts Validator
Follow along as Web development expert Brett McLaughlin guides you through the process of installing and configuring the Struts Validator component. The Validator, originally developed separately from and on top of Struts, is now an integral component of any professional Struts application programming.With the Validator, you can validate input in your Struts ActionForms. In this tutorial, you will learn to perform this validation declaratively, without touching your existing Java code.
Build Web sites with BPEL business processes
This tutorial explains how to create a Web site that uses business processes to perform daily business operations. With this example, you build a Web site that takes pizza orders. If the customer has a good credit history, the order is placed, and the time needed for pickup or delivery is calculated and shown on the confirmation page. If the customer has bad credit, an order cannot be placed and the customer is informed.
Struts-based portal applications: Model and develop them with WebSphere Studio
Struts is a very popular framework that adds a flexible control layer to building Web based applications using common standard technologies like servlets, JavaBeans components, resource bundles, and custom tag libraries. This tutorial provides a hands-on approach to developing Struts based portal applications using WebSphere Studio v5.1.2 and the Portal Toolkit v22.214.171.124.
Adding Spice to Struts - Part 2
This time, we started looking at how Struts initializes the form bean configurations. In this context, the starting point is the Struts ActionServlet class. Interestingly enough, this ActionServlet gave us a vital clue to what happens and what we need to do to find a complete set and get access to our new form bean configuration mechanism. Here is what we found out:
1. The entry point to the all Struts related configuration is the init() method in the ActionServlet class.
2. The Struts framework supports module based configuration. That means we can have multiple Struts configuration files for each module in a multi modular application. This means that all the form bean configurations are part of a ModuleConfig object.
3. After the initialization mechanism parses all the module configuration and the initialization is over, the Struts calls the freeze() method on the ModuleConfig object.
4. This means that once the control has returned from the initialization process i.e the ActionServlet, it is not possible to modify the module configuration. Thus, once a Form bean is configured, we will not be able to set any new Form property to it.
5. This may come as confusing. Last month what we did is that we added more key-values to the internal Map of the DynaFormBean. But adding more key-values to the internal Map of the DynaForm bean does not tell the Struts that each of those added properties do actually exist as FormPropertyConfig object.
Unless, each property of DynaForm is registered as a FormPropertyConfig object, the Struts form tags will NOT be able to recognize those properties.
A Brief Introduction to Struts ? Expression Language
Struts is a robust and powerful framework which promised scalability, separation of concerns and reusability. The tag libraries introduced in Struts made JSP pages more readable and maintainable. However in the past my opinion was that this neatness of the JSP page came at a price. A confusing tag library structure and a learning curve that could deter a lot of people. I would agree that once a person is comfortable with the tags, writing JSP pages is simple but why would you want to make a developer go through a learning process.
Struts Validation (Client and Server Side)
In this tutorial we will show you how to use the Struts Validation Framework. This framework is very powerful but at the same time can be very complex. Even implementing a simple validation, for example, checking if a value was entered, can be a tedious task. However, we are not going to get into any complex theory behind Struts validation. There are plenty of books that do that. But, we will show you how to add simple validation to your application and hopefully you will be able to take it from there.
Our first step will be to create the validation itself. Once we have it ready, we can choose if we want to use client or server side validation. To switch from one approach to another requires very minor changes. In this tutorial we will show both ways.
To proceed, we will first add the ValidatorPlugIn to struts-config.xml file. Then, open an editor for the struts-config.xml file and switch to the Tree view. Now, right-click plug-ins and select Create Special Plug-in/Validators. This will add two XML validation files to your project. If you look at the source, you should see the plug-in that we just added at the bottom. This tells the Struts runtime where to look for your validation definitions.
Trying Struts Internationalization (i18n)
Struts Framework has built-in support for Internationalization. In other words, you don't need to worry about writing pages in different languages. All you have to do is to create a resource file for each language that you want. The resource file will contain titles, messages, and other text in the language of your user.
Let's suppose that users in Italy will be accessing your site along with users in the United States. You, of course, want to greet the Italian users in Italian. To do this, you will be creating two resource files, one for an English greeting and one for an Italian greeting. The two resource files will be:
Hello readers. Yes this is an article on Struts. However, the purpose of this article is not to teach Struts. There are many great tutorials posted on this site and others, which have been very helpful for all others and me. In this article, I will address a few issues in development with Struts and some tricks hidden deep inside the Struts framework. This is an attempt to consolidate a few of the common problems faced in form based web application development using Struts. I will address issues with designing Action classes, multi-page form validations, handling cancel button and a few other design issues with Struts Action classes. Ok, let?s get started.
StrutsTestCase: The Tool for Struts Unit testing
This article is about unit testing a part of your Struts application, specifically how you test the Action class.
The Action class is the glue between the Struts ActionServlet and your business logic (the "Model"). Before testing your Action classes you'll normally have finished unit testing your business logic, and since these classes are normal Java classes which should have no connections to the servlet environment, you might have been using JUnit for the task. JUnit is also from the open source area, and it's just as popular as Struts. If you need to brush up your knowledge on JUnit I can recommend this tutorial on JUnit.
StrutsTestCase: The Tool for Struts Unit Testing - Part 2
StrutsTestCase (STC) is a framework for testing Struts Action classes. It uses JUnit and in my first article about StrutsTestCase (STC) we looked at how STC could use a "mock object approach", where the servlet and Struts environments are simulated. STC also offers another testing possibility based on the Cactus framework, where the test is carried out in a real web server environment.
The main topic of the current article will be about The Cactus option, but first I'd like to touch upon a couple of important features pertaining to the mock object option.
Using CASTOR for DB Access from STRUTS
In this article we will look at CASTOR JDO, a data access or Object to relational (?OR?) mapping framework and how it improves the data access code. Our goals should be:
1. Improve the data access code written in the last article using JDBC
2. Discuss how to use CASTOR with the STRUTS application.
3. Demo use of a mapping tool to generate the mapping file for CASTOR.
4. Finally quickly refer to some of the potential limitations of CASTOR as discussed on some other website and discuss possible solutions
Struts meets Swing (1)
akarta Struts is a framework that facilitates building servlet applications based upon the Model-View-Controller (MVC) design paradigm. Most Struts applications use a browser as the client, but the framework is actually open enough to allow other client types. In this first article of two, I'll take the browser application from my JavaBoutique article "Coding your second Jakarta Struts Application", and prepare it for adding a Swing client to it--with only a few changes to the code in the original browser application. In the second article we'll see how the coding of the Swing application is done.
So this article is about connecting a Swing client to an existing servlet application. If you're planning a new Java application that has to service both a web browser and a Swing client you should consider other architectural alternatives too, for example EJB's, or web services, since they may offer simpler interfaces or additional advantages--all depending on your application's needs. It's outside the scope of this article to compare architectures. But if you're interested in the topic you may find some good opinions at Sun's.
Coding your second Jakarta Struts Application
Did the title of the article make you curious? If this is the second application then what was the first one? The answer is, the first application was presented in my previous article about Jakarta Struts, "Stepping through Jakarta Struts". Here I showed you:
1. how to download and install Struts
2. the directory structure of a Struts application
3. how to create the first pieces of a new application
4. the contents and purpose of the configuration files
5. how to build a simple Struts HTML page using taglibs
6. how to code an ActionForm class
7. how to code an Action class
8. and finally how to test your application
In this article I'll show you how to take one more step up the Struts ladder. This time we'll build a classic list-detail application with the well-known CRUD-actions: Create, Read, Update, and Delete.
Stepping through Jakarta Struts
Struts is comprised of a controller servlet, beans and other Java classes, configuration files, and tag libraries. This means that when you have downloaded Struts (and I'll come back to how this is done) you have available:
1.A controller for your application (the Struts servlet acts as a common controller for the whole application)
2. A collection of Java beans and other helper classes that you use in the "Model" part of your application
3.A collection of tag libraries used in your jsp-pages
Struts has been designed to give you modularity and loose couplings in your application. If you're building a simple, small application you might find it complicated to have to create and handle so many files. You might even be tempted to put all your code in a single jsp-file. My advice to you is: don't do it! I'm sure you can build a single-page application faster using only one jsp-page, but if we're talking about more complex applications, the extra effort put in by using a modular framework will soon be rewarded.
How Do I use Jakarta Struts with Oracle9i
This document is specifically for version 9.0.2. Later versions of JDeveloper have built-in Struts integration.
This TechNote describes in detail how to configure and use Jakarta Struts with Oracle9i JDeveloper Production version 902. It describes how to download, install and run Struts examples applications inside of JDeveloper. It explains how to deploy a Struts application and it also provides a product sneak preview of the upcoming integrated Struts features in our next maintenance release of Oracle9i JDeveloper .
The next maintenance release of Oracle9i JDeveloper will contain several new powerful features to further enable Struts development.
1. Embedded Struts Framework - The Struts framework will be installed into JDeveloper by default. No longer need to download and install manually.
2. Pre-Loaded Struts Tag Libraries - The Struts Tag Libraries will be pre-loaded onto the Component Palette.
3. Struts Configuration Wizard - A simple to use wizard to enable editing of the struts-config.xml file.
4. Struts Application Wizard - Turns your existing project into a Struts enabled project.
5. Struts Action Class Wizard - Generates Java starter code for a Struts Action class.
7. BC4J JSP Struts Application Wizard - Generates a fully functional Business Component for Java JSP application.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.