### Access Struts Example Application via Browser
Source: https://weblegacy.github.io/struts1/userGuide/installation-wls5
This snippet provides the URL to access the configured Struts example application through a web browser after starting the WebLogic server.
```http
http://localhost:7001/strutsexample
```
--------------------------------
### Configure WebSphere for Struts 1 Example App
Source: https://weblegacy.github.io/struts1/userGuide/installation-was352-x
Steps to install and configure the Struts 1 example application on WebSphere Application Server 3.5, including WAR conversion, file copying, and setting the default error page.
```text
1. Start up the adminserver.
2. Start up Admin Console.
3. Use the Convert War file task to convert the struts-example.war from the struts-b1 distrib as-is.
4. Convert to the default_server, default servlet engine and standard install directory (c:\websphere\appserver\hosts\default_server).
5. Create a WEB-INF directory in the servlets dir and copy struts-config.xml, database.xml AND web.xml into it (Keep WEB-INF with all the TLD's under web - both WEB-INF directories must be present).
6. Copy jaxp 1.0.1's (NOT 1.1.1's) jaxp.jar and parser.jar to the servlets directory of the strut-example webapp.
7. In the servlets directory, open struts.jar with WinZip. Extract the three DTD's (struts-config_1_0.dtd, web-app_2_2.dtd and web-app_2_3.dtd) into the servlets directory making sure you use folder names (so the files extract to servlets/org/apache/struts/resources).
8. Click on struts-example in the Admin Console under Default Server/Default Servlet Engine and click the advanced tab on the right hand side of the screen.
9. Down where it says Default Error Page, enter /ErrorReporter and then click Apply.
10. Start the Default Server via the Admin Console. You should see a whole bunch of ActionServlet messages in the default_host_stdout.log file with no exceptions.
11. Via a browser accessed the app using http://localhost/struts-example/index.jsp.
12. If it returns "Application not Available" then go back to the Admin Console, right-click on struts-example and select Restart WebApp.
13. Once it reports success, go back to the URL above and try again - it should work flawlessly.
```
--------------------------------
### Struts Example Application Deployment on JRun
Source: https://weblegacy.github.io/struts1/userGuide/installation-jr30
This section details the process of deploying the Struts Example Application WAR file using the JRun Management Console. It outlines the necessary information to fill in the Web Application Information form, including the Servlet War File path, Application Name, and URL.
```JRun Deployment
Servlet War File or Directory: Enter the full path where struts-example.war is found or click on Browse to select the path.
JRun Server Name: $APP_SERVER_NAME
Application Name: Struts Example
Application Hosts: All Hosts
Application URL: /struts-example
Application Deploy Directory: will default to $APP_SERVER_NAME/Struts Example (or the name as specified for Application Name).
```
--------------------------------
### Struts Documentation: Installation and Guide Updates
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0_1
Includes installation notes for Jetty, more details on file upload requirements in the Tag Developers Guide, and references to background material in the Introduction. Clarifies i18n support scope and web.xml settings.
```Java
// Add installation notes for Jetty.
// In the Tag Developers Guide, add more detail regarding file upload requirements.
// In the Introduction, added references to basic background material.
// In Building View Components, clarify that additional i18n support may be provided by the browser, and is outside the scope of the framework.
// In Building Controller Components, document 'validating' init-param, add defaults for various parameters, clarify that some web.xml settings are not Struts-specific.
// Correct the example page in the User's Guide (Building View Components) to reflect current practice.
// Revised installation instructions for SilverStream and Resin.
```
--------------------------------
### Struts Example Application: Java Source Inclusion
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b2
The Java source code for the Struts Example Applications is now included within the corresponding WAR files in the `WEB-INF/src` subdirectory.
```Java
public class ExampleAction extends Action {
// ... action logic ...
}
```
--------------------------------
### Apache DirectoryIndex Directive
Source: https://weblegacy.github.io/struts1/userGuide/installation-tc
This directive configures Apache to recognize 'index.jsp' as a default page for web applications, ensuring that the Struts documentation and example applications can be accessed directly.
```apache
DirectoryIndex index.html index.jsp
```
--------------------------------
### Apache Configuration for Struts 1
Source: https://weblegacy.github.io/struts1/userGuide/installation-tc
This snippet shows the Apache configuration directives required to serve Struts 1 web applications (documentation and example) deployed in Tomcat. It includes Alias, Directory, and ApJServMount configurations.
```apache
Alias /struts-documentation "$TOMCAT_HOME/webapps/struts-documentation"
Options Indexes FollowSymLinks
ApJServMount /struts-documentation/servlet /struts-documentation
AllowOverride None
deny from all
Alias /struts-example "$TOMCAT_HOME/webapps/struts-example"
Options Indexes FollowSymLinks
ApJServMount /struts-example/servlet /struts-example
AllowOverride None
deny from all
```
--------------------------------
### Struts 1 Configuration Troubleshooting Guide
Source: https://weblegacy.github.io/struts1/userGuide/installation-was352-x
A guide to diagnose and fix common Struts 1 errors such as 'Cannot find ActionMappings' or 'Cannot find key org.apache.struts.MESSAGE', often related to XML configuration and DTD issues.
```text
If you are getting errors like "Cannot find ActionMappings, etc..." or "Cannot find key org.apache.struts.MESSAGE" then your application is most likely still bombing on the struts-config issue that Richard discovered. The above steps SHOULD correct that leaving nothing out. If you are getting 404 errors about //logon or something not found, then you are still having XML config troubles and it is not initializing the Action servlet properly. Follow the steps above in regards to DTD's and it should work.
```
--------------------------------
### Start Weblogic with Updated Classpath
Source: https://weblegacy.github.io/struts1/userGuide/installation-wls5
This snippet demonstrates the command to start the WebLogic server with an updated classpath, including necessary JAR files and directories for deploying unpacked web applications.
```bash
c:\jdk1.3\bin\java -ms16m -mx64m
-classpath c:\weblogic\lib\weblogic510sp8boot.jar;
```
--------------------------------
### Struts 1 Action Class Example
Source: https://weblegacy.github.io/struts1/userGuide/introduction
Provides a basic example of a Struts Action class in Java, demonstrating how to process a request, interact with ActionForm beans, and forward control to another resource.
```Java
package com.example;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LoginAction extends Action {
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
LoginForm loginForm = (LoginForm) form;
String username = loginForm.getUsername();
String password = loginForm.getPassword();
// Simulate authentication logic
if ("admin".equals(username) && "password".equals(password)) {
// Store user info in session (example)
request.getSession().setAttribute("currentUser", username);
// Forward to success page
return mapping.findForward("success");
} else {
// Add error message (example)
saveErrors(request, loginForm.validate(mapping, request));
// Forward back to login page
return mapping.findForward("failure");
}
}
}
```
--------------------------------
### Struts 1 ActionServlet Configuration Example
Source: https://weblegacy.github.io/struts1/userGuide/index
Illustrates the configuration of the ActionServlet in the web application deployment descriptor (web.xml). This includes mapping the servlet to a URL pattern and setting initialization parameters.
```XML
actionorg.apache.struts.action.ActionServletconfig/WEB-INF/struts-config.xml1action*.do
```
--------------------------------
### Deploy struts-example.war on SilverStream
Source: https://weblegacy.github.io/struts1/userGuide/installation-sas
This XML configuration file defines the deployment options for the 'struts-example.war' application on the SilverStream Application Server. It specifies the WAR file name, enables the application, and sets the URL context.
```xml
struts-example.wartruestruts-example
```
--------------------------------
### Configure Weblogic for Struts Example Application
Source: https://weblegacy.github.io/struts1/userGuide/installation-wls5
This snippet shows how to add an entry to the weblogic.properties file to make the struts-example web application available. It specifies the path to the WAR file.
```properties
weblogic.httpd.webApp.strutsexample=
c:/jakarta-struts/webapps/struts-example.war
```
--------------------------------
### Struts 1.1 Known Issue: Example Webapp Startup
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
This addresses a known issue where the '_struts-blank_' sample webapp fails to run due to problems accessing message resources. The issue is tracked in Bugzilla.
```Java
// Known Issue: The _struts-blank_ sample webapp fails to run due to problems accessing message resources. ( #10955 )
```
--------------------------------
### Configure Weblogic for Unpacked Struts Example Application
Source: https://weblegacy.github.io/struts1/userGuide/installation-wls5
This snippet shows the modification to weblogic.properties for deploying the Struts example application in an extracted (unpacked) format, specifying the directory path.
```properties
weblogic.httpd.webApp.strutsexample=
c:/jakarta-struts/webapps/struts-example/
```
--------------------------------
### HTML Select with HTML Options Example
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
Demonstrates the usage of the '' tag in conjunction with '' based on a collection stored in the page context. This is a test case for the Exercise Taglib.
```JSP
<%-- Added test case for using based on a collection saved in the page context. --%>
```
--------------------------------
### Struts 1 ActionMapping Example
Source: https://weblegacy.github.io/struts1/userGuide/index
Demonstrates how to define an ActionMapping in a Struts 1 application, specifying the path, type, and forward actions. This is crucial for controlling application flow.
```XML
```
--------------------------------
### Deploy struts-documentation.war on SilverStream
Source: https://weblegacy.github.io/struts1/userGuide/installation-sas
This XML configuration file specifies the deployment settings for the 'struts-documentation.war' application on the SilverStream Application Server. It includes the WAR file name, enables the application, and defines its URL context.
```xml
struts-documentation.wartruestruts-documentation
```
--------------------------------
### Apache httpd.conf Include Directive
Source: https://weblegacy.github.io/struts1/userGuide/installation-tc
This directive in the Apache httpd.conf file includes the Tomcat-generated Apache configuration, ensuring that Apache is aware of the Tomcat applications.
```apache
Include /usr/local/apache/conf/tomcat-apache.conf
```
--------------------------------
### Struts 1 Tiles Definition Example
Source: https://weblegacy.github.io/struts1/userGuide/index
Provides an example of a Tiles definition, used for composing reusable page layouts in Struts 1 applications. It specifies the template and insert attributes.
```XML
```
--------------------------------
### Struts 1.1 Added Packages
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
This lists the new packages introduced in Struts 1.1, providing an overview of the expanded functionality and organization within the framework.
```Java
// Packages added in Struts 1.1
// config
// taglib.nested
// taglib.nested.bean
// taglib.nested.html
// taglib.nested.logic
// validator
```
--------------------------------
### Struts Example Application: LinkSubscriptionTag Optimization
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b2
Excessive filter() calls in the `LinkSubscriptionTag` have been eliminated to improve performance.
```Java
public int doEndTag() throws JspException {
// Optimized logic without redundant filters
return EVAL_PAGE;
}
```
--------------------------------
### Configure Extension Mapping with rules.properties
Source: https://weblegacy.github.io/struts1/userGuide/installation-ip
This configuration snippet shows how to map all URLs ending with '.do' to the 'action' servlet using the rules.properties file, similar to web.xml configurations.
```properties
@.*[.]do$=action
```
--------------------------------
### SilverCmd DeployWAR Commands for Struts 1
Source: https://weblegacy.github.io/struts1/userGuide/installation-sas
These commands are used to deploy Struts 1 web applications ('struts-example.war' and 'struts-documentation.war') onto the SilverStream Application Server. They require specifying the server host, database name, WAR file name, and the corresponding deployment plan file.
```bash
SilverCmd DeployWar localhost Silvermaster struts-example.war -f struts-example-depl-plan.xml
```
```bash
SilverCmd DeployWar localhost Silvermaster struts-documentation.war -f struts-documentation-depl-plan.xml
```
--------------------------------
### Apache Handler for Struts .do URIs
Source: https://weblegacy.github.io/struts1/userGuide/installation-tc
This configuration adds a handler to Apache to recognize '.do' URIs, which are typically used by the Struts controller servlet. This is necessary for Struts applications to function correctly.
```apache
AddHandler jserv-servlet .do
```
--------------------------------
### Struts 1 FormBean Configuration Example
Source: https://weblegacy.github.io/struts1/userGuide/index
Shows how to define an ActionForm bean in the Struts configuration file, including its name, type, and scope. This enables automatic data binding and validation.
```XML
```
--------------------------------
### Struts 1 RequestUtils: Configuration Property Support
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
The RequestUtils class now supports `forwardPattern`, `pagePattern`, and `inputForward` properties from ControllerConfig, enhancing flexibility in request routing and configuration.
```Java
RequestUtils: Added support for forwardPattern, pagePattern, and inputForward properties on ControllerConfig.
```
--------------------------------
### Struts 1 Example Application - Tag Libraries
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b1
The Struts Example Application has been updated to use the new, separated custom tag libraries and the latest features of the tags.
```HTML
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
:
```
--------------------------------
### Struts 1 XML Parser Prerequisite Update
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b1
Indicates that Struts 1 now requires an XML parser conforming to JAXP/1.1 APIs, with specific parser examples provided.
```Java
JAXP/1.1
```
--------------------------------
### Struts 1 Action Mapping Configuration
Source: https://weblegacy.github.io/struts1/userGuide/introduction
Demonstrates the structure of an ActionMapping within the Struts configuration file, specifying the request path, the Action subclass to handle the request, and other relevant properties.
```XML
```
--------------------------------
### Struts Example Application: Deprecated BeanUtils Filter Replacement
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b2
Calls to the deprecated `BeanUtils.filter()` method have been replaced with calls to `ResponseUtils.filter()` for better maintainability and adherence to current practices.
```Java
// Old code:
// String filteredText = BeanUtils.filter(text);
// New code:
String filteredText = ResponseUtils.filter(text);
```
--------------------------------
### Struts Contrib - Scaffold Example
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-rc1
The 'contrib' directory includes extensions like Scaffold, which is an extension of the Commons Scaffold toolkit for building web applications.
```Java
// Example usage of Scaffold (conceptual)
// Assuming Scaffold provides base classes for CRUD operations
public class UserAction extends ScaffoldAction {
// ... specific logic for User management ...
}
```
--------------------------------
### Add ValidWhen and Validation Resource Examples
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_2_7
This entry notes the addition of example pages for ValidWhen and validation resources (both server-side and JavaScript) to the struts-examples webapp. This provides practical guidance on using these features.
```text
A validwhen examples page and validation resource/bundles example pages (Server Side and JavaScript) have been added to the struts-examples webapp.
```
--------------------------------
### Configure Webapp Directory in apserver.txt
Source: https://weblegacy.github.io/struts1/userGuide/installation-ubs72
This snippet shows the relevant section in the 'apserver.txt' file for configuring the web application server. It highlights the 'file_path' variable, which specifies the directory where WAR files should be placed.
```plaintext
[SaServletEngine.class]
session_affinity=1
type=1
program=/SaServletEngine.class
file_path=f:\\webapps
host=localhost:20000
```
--------------------------------
### Struts Configuration DTD Update
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
The Struts Configuration DTD has been updated from 1.0 to 1.1. Existing configuration files are compatible with both versions.
```XML
```
--------------------------------
### Struts 1 File Upload Package
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b1
Information about the new package 'org.apache.struts.upload' for handling file uploads. This includes basic actions and an example application demonstrating the new features.
```Java
package org.apache.struts.upload;
// ... implementation details for file upload actions
```
--------------------------------
### Manually Copy ApplicationResources.properties
Source: https://weblegacy.github.io/struts1/userGuide/installation-wls5
This snippet illustrates the directory path where the ApplicationResources.properties file needs to be manually copied for the struts-example application to resolve runtime errors related to custom tags.
```path
c:\jakarta-struts\webapps\WEB-INF\_tmp_war_strutsexample
```
--------------------------------
### JRun JSP Compilation Error Example
Source: https://weblegacy.github.io/struts1/userGuide/installation-jr30
This snippet illustrates a typical compilation error encountered when running the Struts Example Application on JRun 3.0 SP2A due to JSP specification non-compliance. The error message indicates a failure to match a method for setting the locale.
```Java/JSP Error
/struts-example/index.jsp:
javax.servlet.ServletException: Compilation error
occurred:
allaire.jrun.scripting.DefaultCFE:
Errors reported by compiler:
c:/JRun/servers/default/Struts
Example/WEB-INF/jsp/jrun__index2ejspa.java:41:1:41:27:
Error: No match was found for method
"setLocale(java.lang.String)".
```
--------------------------------
### Struts Template Example: Exception Handling
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b2
When `` or `` throws an exception, any pre-existing 'real' exception is no longer overwritten, ensuring proper error propagation.
```JSP
```
--------------------------------
### Patch JSP Files for Struts on JRun
Source: https://weblegacy.github.io/struts1/userGuide/installation-jr30
This section outlines the necessary modifications to JSP files within the Struts Example Application to ensure compatibility with JRun. Changes involve updating HTML tag attributes to use scriptlet expressions.
```html
>
```
```html
>
```
```html
filter=<%= true %>
```
--------------------------------
### Struts - Internationalization with Message Resources
Source: https://weblegacy.github.io/struts1/userGuide/introduction
Explains how Struts supports internationalization by retrieving field labels and messages from message resources. Adding files to the resource bundle allows for messages in different languages.
```Java
ResourceBundle messages = ResourceBundle.getBundle("com.example.messages", request.getLocale());
String label = messages.getString("user.name.label");
```
--------------------------------
### Struts 1 ControllerConfig: Forward and Input Patterns
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
ControllerConfig now includes `forwardPattern` and `inputPattern` properties to assist in managing page directories within application modules, enhancing modular application support.
```Java
ControllerConfig: Added forwardPattern and inputPattern to help manage page directories in application modules.
```
--------------------------------
### Struts 1 Logic Tag Library Additions
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b1
Introduces the new and tags in the struts-logic tag library, providing functionality similar to and but with different handling for empty strings.
```Java
```
--------------------------------
### Struts 1 Validator Rule Example
Source: https://weblegacy.github.io/struts1/userGuide/index
Demonstrates a custom validation rule definition within the Struts Validator framework. This allows for defining specific validation logic for form fields.
```XML
```
--------------------------------
### Configure Struts Extension Mapping on JRun
Source: https://weblegacy.github.io/struts1/userGuide/installation-jr30
This snippet details how to configure the extension mapping for the action servlet in JRun. It involves setting the virtual path/extension to '*.do' and mapping it to the 'action' servlet.
```text
Virtual Path/Extension: *.do
Servlet Invoked: action
```
--------------------------------
### Struts ContextHelper for Presentation Layers
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b1
Adds ContextHelper to expose framework elements to alternate presentation layers, facilitating integration with different view technologies.
```Java
package org.apache.struts.action;
import javax.servlet.http.HttpServletRequest;
public class ContextHelper {
/**
* Exposes framework elements to alternate presentation layers.
* @param request The current HttpServletRequest.
* @return An object containing framework elements.
*/
public static Object getFrameworkElements(HttpServletRequest request) {
// Implementation to expose framework elements
return null; // Placeholder
}
}
```
--------------------------------
### Struts Util Package Additions
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
The Util package includes updates to LocalStrings for correct parameter handling, a new LabelValueBean for use with html:options, improvements to MessageResources for escaping quotes, and a computeParameters method for transaction tokens.
```Java
// New class for name/value pairs
import org.apache.struts.util.LabelValueBean;
```
```Java
// Update to MessageResources for escaping single quotes
// import org.apache.struts.util.MessageResources;
```
```Java
// Update to LocalStrings for parameter handling
// import org.apache.struts.util.LocalStrings;
```
```Java
// Method to compute parameters, allowing transaction token
// import org.apache.struts.util.computeParameters;
```
--------------------------------
### Struts Configuration: Exchange 'name' for 'attribute'
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
Updates the Struts configuration file in the MailReader example application by exchanging 'name' properties for 'attribute' properties in Edit mappings. This aligns with framework conventions.
```XML
```
--------------------------------
### Struts Exercise Taglib: HTML Select with HTML Options Test Case
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0_1
Adds a test case for the tag when used with and a collection stored in the page context. This demonstrates proper usage and integration.
```Java
// Added test case for using based on a collection saved in the page context.
```
--------------------------------
### Struts 1 JSP Tag Library Declaration
Source: https://weblegacy.github.io/struts1/userGuide/installation
This snippet shows how to declare the Struts tag libraries at the top of a JSP page for using Struts custom tags. It includes declarations for bean, html, and logic tag libraries.
```JSP
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
```
--------------------------------
### Struts Taglib - Populating JSP Fields
Source: https://weblegacy.github.io/struts1/userGuide/introduction
Illustrates how the Struts Taglib simplifies JSP development by automatically populating form fields from a JavaBean. JSPs only need to know field names and the submission target.
```JSP
```
--------------------------------
### Struts 1.0 Removed Classes and Replacements
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
This section lists classes and packages removed in Struts 1.1, along with their replacements, primarily from the Apache Commons libraries. This helps users understand migration paths and updated dependencies.
```Java
// Removed: org.apache.struts.utils.BeanUtils , org.apache.struts.utils.ConvertUtils , and org.apache.struts.utils.PropertyUtils
// Replaced by: org.apache.commons.beanutils
// Removed: org.apache.struts.util.ArrayStack , org.apache.struts.util.FastArrayList , org.apache.struts.util.FastHashMap , org.apache.struts.util.FastTreeMap
// Replaced by: org.apache.commons.collections
// Removed: org.apache.struts.digester.*
// Replaced by: org.apache.commons.digester
// Removed: The struts-config.dtd
// Replaced by: struts-config_1_1.dtd
// Removed: The omnibus "struts" taglib and its associated TLD
// Replaced by: separate bean, logic, and html taglibs.
// Removed: The "form" taglib and its associated TLD
// Replaced by: (renamed as) the html taglib.
```
--------------------------------
### Troubleshoot Struts 1 XML DTD Issues in WebSphere
Source: https://weblegacy.github.io/struts1/userGuide/installation-was352-x
Instructions to resolve issues where XML files referencing PUBLIC DTDs cause errors during DTD registration or ActionMapping lookup in Struts 1 applications deployed on WebSphere.
```text
1. Stop Default Server
2. Go to servlets\WEB-INF\ and edit web.xml and struts_config.xml.
3. In the DOCTYPE declaration, change the word PUBLIC to SYSTEM and completely remove the line that reads "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" from web.xml and remove "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN" from struts-config.xml.
4. Save these changes and go back to step 10 above.
```
--------------------------------
### Struts 1 Bean Tag Library Enhancements
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b1
Details new attributes and corrections for the struts-bean tag library, including support for formatting, dynamic message sources, and scripting variable types.
```Java
```
--------------------------------
### Struts Template Tag: Optional Flush Attribute
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b2
The `` tag now supports an optional 'flush' attribute. When set to 'true', it commits the response before including content, which helps in working around issues with servlet containers.
```JSP
```
--------------------------------
### Struts 1 ActionForm Bean Example
Source: https://weblegacy.github.io/struts1/userGuide/building_model
Demonstrates the basic structure of an ActionForm bean in Struts 1, which extends the ActionForm class. These beans are used to transfer data between the model and view layers and are automatically managed by the Struts controller servlet.
```Java
public class MyFormBean extends org.apache.struts.ActionForm {
// Properties, getters, and setters for form fields
private String username;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}
```
--------------------------------
### JDBC 2.0 Optional Package API
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0
The 'jdbc2_0-stdext.jar' file contains the JDBC 2.0 Optional Package API classes (package 'javax.sql'). Include this file in your application's '/WEB-INF/lib' directory if it's not already accessible by your servlet container.
```text
jdbc2_0-stdext.jar - The JDBC 2.0 Optional Package API classes (package javax.sql). You will need to include this file in the /WEB-INF/lib directory of your application, if it is not already made visible to web applications by your servlet container.
```
--------------------------------
### Grant Java Security Permission for Struts 1 Mapped Properties
Source: https://weblegacy.github.io/struts1/userGuide/installation
This code snippet grants the necessary Java security permission ('accessDeclaredMembers') required for Struts 1 applications that utilize form beans with mapped properties when running under a security manager. This permission allows the application to access declared members, preventing potential security exceptions.
```plaintext
permission java.lang.RuntimePermission "accessDeclaredMembers";
```
--------------------------------
### Logic Taglib: Introduce and
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
The Struts logic tag library now includes `` and `` tags. These tags function similarly to `` and `` but provide distinct behavior when dealing with empty strings.
```Java
org.apache.struts.taglib.logic
```
--------------------------------
### Shale Mailreader Example Servlet Version
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_2_7
Ensures the Shale mailreader example correctly defines the servlet version as 2.4. This is important for compatibility and proper functioning of the example application.
```Java
// Example of web.xml configuration for Shale mailreader
// (Actual code not provided in the source text)
```
--------------------------------
### Struts Example Application: Database Data Removal
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0_1
Removes references to saving database data from the 'tour' document in the Struts Example Application, as this functionality has been deprecated.
```Java
// Remove references to saving database data from "tour" document, since this functionality was removed.
```
--------------------------------
### Struts 1 ActionServlet: Configuration Parameter Changes
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b2
ActionServlet has updated its configuration parameters, deprecating several older ones in favor of components within the new config package, promoting a more component-based configuration approach.
```Java
ActionServlet: Added "config/$foo" parameter and deprecated several others in favor of components in the new config package.
```
--------------------------------
### JDBC 2.0 Optional Package API
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b2
The 'jdbc2_0-stdext.jar' file contains the JDBC 2.0 Optional Package API classes (package 'javax.sql'). Include this file in your application's '/WEB-INF/lib' directory if it's not already accessible by your servlet container.
```text
jdbc2_0-stdext.jar - The JDBC 2.0 Optional Package API classes (package javax.sql ). You will need to include this file in the /WEB-INF/lib directory of your application, if it is not already made visible to web applications by your servlet container.
```
--------------------------------
### Struts 1 Example Application - Form Beans
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_0-b1
The Struts Example Application now utilizes request scope for form beans, which is recommended for single-page forms. Action classes are designed to work with both request and session scoped beans.
```Java
// Action class example
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
// Form bean is accessed via request scope
MyFormBean myForm = (MyFormBean) request.getAttribute("myFormBean");
// ...
}
```
--------------------------------
### HTML Taglib: Introduce for populating options
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-rc1
A new tag, ``, has been introduced in the `org.apache.struts.taglib.html` package. This tag provides a more streamlined approach to populating HTML select options from a Java collection.
```Java
package org.apache.struts.taglib.html;
// ... other imports
public class OptionsCollectionTag extends HtmlTagSupport {
// ... attributes for collection, property, label, etc.
// ... method to iterate over the collection and generate option tags
}
```
--------------------------------
### JSP Input Tag for Username
Source: https://weblegacy.github.io/struts1/userGuide/building_view
Example of a standard HTML input tag within a JSP page for a username field, including retrieving the value from a JavaBean.
```JSP
```
--------------------------------
### Struts html:MessagesTag Addition
Source: https://weblegacy.github.io/struts1/userGuide/release-notes-1_1-b1
Introduces the `` tag for displaying messages within the Struts HTML tag library.
```JSP