Java Reference
In-Depth Information
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!-- ===================================== Form Bean Definitions -->
<form-beans>
<form-bean name="generateReportForm"
type="net.ensode.jasperbook.struts.GenerateReportForm">
</form-bean>
</form-beans>
<!-- ================================ Action Mapping Definitions -->
<action-mappings>
<action path="/generate_report"
type="net.ensode.jasperbook.struts.GenerateReportAction"
name="generateReportForm"
scope="request"
input="generate_report.jsp">
</action>
</action-mappings>
</struts-config>
The
<form-bean>
tag defines the
GenerateReportForm
class as a form bean and
assigns the
generateReportForm
logical name to it.
The
<action>
tag maps the
GenerateReportAction
action class to the
/generate_
report
path. It also specifies that the
GenerateReportForm
form bean will be
associated with this action. Finally, it links the
generate_report.jsp
JSP file via the
input
attribute.
Like all server-side Java web applications, Struts applications must contain a
web.
xml
file in the
WEB-INF
directory inside the application's
war
file.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
"-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>Struts JasperReports Application</display-name>