Struts-config 1.3 Dtd

0 views
Skip to first unread message

Toney Talbot

unread,
Jul 31, 2024, 4:36:50 AM7/31/24
to perracemi

we can not change this file name, if we change this name Framework could not identified the configuration file... and one more thing per single Struts2 application there should only single struts.xml file.

struts-config 1.3 dtd


Download 🗸 https://fratygfsense.blogspot.com/?a=2zUvaA



Basically, struts.xml is configuration file for struts2 which includes mapping of both jsp and action file. Strus-config.xml is the file for struts1.x which included mapping of actions files. In struts2 filter is considered as a front end controller which define into the struts.xml and for struts1.x, Action Servlet is considered as a front-end controller and its mapped into the struts-config.xml.

Originally posted by liang gu:
Hi, Matthew:
The new solution you just gave is really and exactly what I needed. Thanks so much. And by the way, do you have a solution to the other post of mine?
------------------------------------------
I have two pages built by struts. The first page is the "add record" page. After click on "submit" button on this page, the request sent to the server, server then process "add record", then forward to a servlet to display the second page(if process is successful): the list of all records(including the one just added).
The problem I have now is that: if I refresh the second page(listing of all records), it will add another new record and then show the list of all records. Basically, when the page refreshed, the struts redo everything for the whole action(specifed in struts-config.xml), but all I want is only to refresh the list of all records. The following is part of my struts-config.xml I used:



I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.

Can you please post all the information we request in the [URL= +file-viewtopic-t-393.html]Posting Guidelines[/URL] thread at the top of this forum? That will give us some context so that we can determine if this is an installation issue, a configuration problem, or a bug. Thanks.

Created Web Project, synchronized with VSS to get code. This is a small and new Struts 1.2 web app. Choose then to enable Struts on the project. Changed radio button to Struts 1.2. It flags this error despite not making sense since the Struts webapp works in Tomcat and is a valid DOCTYPE and a valid root strust-config element exists.

Allistair I just loaded up your struts-config file in my setup and it worked fine. Are you behind a web proxy or other proxy that might cause the XML editor to fail from loading the DTD to validate the file against?

Rhoon,
As a temporary workaround, if you add struts caps to the project and let it create a new empty struts-config file, and then copy-paste the contents of your other one into it, does that work for you?

1) Shut down MyEclipse
2) Go to \.metadata and erase the .log file
3) Now fire up MyEclipse, go through the motions again of checking out your project and attempting to add Struts Caps to it, did it blow up?
4) if it blew up, go open the new .log file and paste the contents of it here for me.
5) Now go create a new struts-config.xml file (File > new) and put the contents from your post above in it:

Now, considering that Eclipse and MyEclipse are not certified on JDK 1.5, I would suggest you download JDK 1.4.2_08 and run MyEclipse with that (-vm argument, point it at the java executable). Then re-try the steps above. Additionally I would suggest you upgrade to 1.5.0_03, there were some notable bugs in _01 and _02 that were fixed in _03.

The Struts framework depends on one or more configuration files to be able to load andcreate the necessary application-specific components at startup. Theconfiguration files allow the behavior of the framework components tobe specified declaratively, rather than having the information andbehavior hardcoded. This gives developers the flexibility to providetheir own extensions, which the framework can discover dynamically.

The configuration file is based on the XML format and can bevalidated against the Struts DTDstruts-config_1_1.dtd. Although there are somesimilarities between the 1.0 and 1.1 versions of the framework withrespect to the configuration file, there are at least as manydifferences. Fortunately, the designers of the framework have madebackward compatibility a goal of the Struts 1.1 release; therefore,your 1.0 applications should continue to work properly with the newversion.

The org.apache.struts.configpackage was added to Struts 1.1. The framework uses JavaBeans atruntime to hold the configuration information it reads from theStruts configuration files. Figure 4-4 shows theessential classes from the config package.

Each class in the config package holds informationfrom a specific section of the configuration file. After theconfiguration file has been validated and parsed, the Strutsframework uses instances of these beans to represent in-memoryversions of the information that has been declared in theconfiguration file. These classes act as runtime containers of theconfiguration information and are used by the framework components asneeded.

Theorg.apache.struts.config.ApplicationConfig class deserves a special introduction, asit plays a very important role in the framework. As Figure 4-4 indicates, it is central to the entireconfig package and holds onto the configurationinformation that describes an entire Struts application. If multipleapplication modules are being used, there is oneApplicationConfig object for each module. TheApplicationConfig class will surface throughoutthe remainder of our discussion of the framework.

The data-sources elementallows you to set up a rudimentary data source that you can use fromwithin the Struts framework. A data source acts as afactory[7] for database connections andprovides a single point of control. Many data source implementationsuse a connection-pooling mechanism to improve performance andscalability.

Many vendors provide their own implementations of data sourceobjects. The Java language provides the javax.sql.DataSourceinterface, which all implementations must implement. Most applicationservers and some web containers provide built-in data sourcecomponents. All of the major database vendors also provide datasource implementations.

Throughout the discussion of the Struts configuration elements in therest of this chapter, you will notice a child element calledset-property in many of the major elements of theconfiguration file. The set-property elementspecifies the name and value of an additional JavaBeans configurationproperty whose setter method will be called on the object thatrepresents the surrounding element. This element is especially usefulfor passing additional property information to an extendedimplementation class. The set-property element isoptional, and you will use it only if you need to pass additionalproperties to a configuration class.

The set-property element defines three attributes,including the id attribute, which is seldom used.The property attribute is the name of theJavaBeans property whose setter method will be called. Thevalue attribute is a string representing the valuethat will be passed to the setter method after proper conversion.This section provides an example of using theset-property element. The same format isreplicated wherever the set-property element isdeclared.

The implementation class of the configuration bean that will hold thedata source information. If specified, it must be a descendant oforg.apache.struts.config.DataSourceConfig, whichis the default class when no value is specified. This attribute isoptional.

You can specify multiple data sources within the configuration file,assign each one a unique key, and access a particular data source inthe framework by its key. This gives you the ability to accessmultiple databases if necessary.There are several other popular datasource implementations you can use. Table 4-4lists a few of the more popular alternative implementations.

The form-beans elementallows you to configure multiple ActionFormclasses that are used by the views. Within theform-beans section, you can configure zero or moreform-bean child elements. Eachform-bean element also has several child elements.

If the class identified by the type attribute isan instance oforg.apache.struts.action.DynaActionForm or asubclass, this value should be set to true.Otherwise, this value is false. This has beendeprecated and the framework will now determine this automatically.

The fully qualified name of a Java class that extends the StrutsActionForm class. If this value is specified asorg.apache.struts.action.DynaActionForm, Strutswill dynamically generate an instance of theDynaActionForm. This attribute is required.

Be careful when configuring the value for the typeattribute. It must be the fully qualified name of theActionForm implementation class. If you misspellthe name, it can be very hard to debug this problem.

As mentioned in Chapter 3, aform bean isa JavaBeans class that extends theorg.apache.struts.action.ActionForm class. Thefollowing code shows how the form-beans elementcan be configured in the Struts configuration file:

One of the form-bean elements in this code uses afeature new in Struts 1.1, called dynamic actionforms . Dynamic action forms were discussedbriefly in Chapter 3 and will be discussed indetail in Chapter 7.

You can pass one or more dynamic properties to an instance of theorg.apache.struts.action.DynaActionForm class using theform-property element. It is supported only whenthe type attribute of the surroundingform-bean element isorg.apache.struts.action.DynaActionForm, or adescendant class.

A string representation of the initial value for this property. Ifnot specified, primitives will be initialized to zero, and objects totheir zero-argument instantiation of that object class. Thisattribute is not required.

The exception element describes a mapping betweena Java exception that may occur during processing of a request and aninstance of org.apache.struts.action.ExceptionHandler that is responsible for dealingwith the thrown exception. The declaration of theexception element illustrates that it also hasseveral child elements:

93ddb68554
Reply all
Reply to author
Forward
0 new messages