Title: First Love Struts
Keywords: JSP Struts MVC Apache Tomcat
Author: jrq
content:
Struts is a male woman, is a female is a male, what is the flower grass, what is the stuff?
Try to do a Hello Struts in recent days, record some problems encountered, right and memo.
If you have a little help on your beginner, you will be good, talk about it. [: D]
BTW: "First Love Struts" Means "First Spring Struts" (cough ~~ pen errors mist wrong ~~ [: d])
These words are only suitable for the first lovers. If you are a love or married, you have not read it.
First, Win2K JDK1.4 Apache Tomcat 4.1.27 Jakarta-Struts-1.1 Environment
This example has a new Struts project application's storage path to: Tomcat_Home / WebApps / Root / StrutsWeb.
(Tomcat_home is the installation path of Apache Tomcat 4.1.27 on the server, depending on the specific situation, StrutsWeb is a save path for a struts project application)
1. Access the JSP page:
http://127.0.0.1:8080/strutsweb/index.jsp, appears similar to the following error tips:
"Org.apache.jasper.jasperexception: file" /web-inf/struts-bean.tld "not found"
"Org.apache.jasper.jasperexception: file" /web-inf/struts-html.tld "not found"
Solution:
*1*.
First check the configuration of the Struts application, the * .tld file in /jakarta-struts-1.1/lib/, see if the / strutsWeb / Web-INF / in the * .tld file is complete.
If not, you need from /jakarta-struts-1.1/lib/, all * .tld files COPY to / STRUTSWEB / Web-INF /.
Then restart Apache Tomcat to see how the effect.
* .tld is the label library descriptor file that describes a custom label in multiple Struts tag libraries.
*2*.
If you confirm that the label file configuration of the Struts project is correct, then in general, it is necessary to separate this web application of the Struts project in Tomcat's service application,
That is to modify the tomat_home / conf / server.xml file, find the following lines in server.xml:
->
Then add this sentence below:
Save Server.xml and then restart Apache Tomcat so you can access this web application. You can access this:
Http://127.0.0.1:8080/mystruts/
or
Http://127.0.0.1:8080/mystruts/index.jsp.
Note: The specific meaning of "Tomcat_home" is as mentioned earlier, it is based on the situation of this unit.
2. Access the JSP page:
Http://127.0.0.1:8080/mystruts/index.jsp, the following error prompt:
"Org.apache.jasper.jaspeexception: Cannot Find ActionMAppings OR ActionFORMBeans Collection
Solution:
*1*
The * .jar file in /jakarta-struts-1.1/lib/ (Struts1.1 has 10 * .jar files), see if the / strutsWeb / web-inf / lib / in * .jar file is complete.
If there is only one struts.jar in / StrutsWeb / Web-INF / LIB /, then other * .jar files are also copy to / strutsWeb / Web-INF / LIB /.
Then restart the Apache Tomcat to access.
Struts.jar is an important file that contains all Java classes in Struts.
*2*
If the above step has not been done, please check or modify the Struts-Config.xml configuration file in / strutsWeb / Web-INF / STRUTSWEB / Web-INF.
See if the Struts configuration is wrong, whether the configuration of action-mappings is wrong.
Be sure to pay attention to distinguish the case.
Please check it again.
Then please check it again.
Don't be irritated, you must treat it like you to treat your lover, or you will be dead!
Be sure to check.
The C is very important in this MVC, the process control is all, must be careful. [: D]
Also, remember to restart Apache Tomcat after completion.
* 3 *
I saw someone on the Internet said that "I tried thousands of times, changed thousands of times, I didn't know why."
If you are just like Struts, it is also trying thousands of times, changed thousands of times.
The error of "Cannot Find Actionmappings or Actionform Beans Collection" is still still the sound,
So please don't be discouraged,
Believe me, the joy of victory, you can experience it!
Because there is a blow! ! ! ! !
Please follow the following:
Open tomat_home / conf / server.xml file, find that line of joining the web app mentioned above:
Then modify it:
(I spent N more time to find N more posts and asked N people to get it, it can be seen that Struts's first love is hard !! [:(])
Then restart Apache Tomcat so that there is no problem in accessing the JSP page. [: D]
* 4 *
I found some configuration instructions for Struts applications online, and some configuration information only mentioned Struts.jar file COPY to / Web-INF / LIB /
And did not say that all the * .jar files of Sturts need to be copy.
Top mentioned that struts.jar contains all Java classes in Struts. Therefore, I have this try.
(Of course, if there is no Struts.jar, then there is no head. [:(])
I only put the struts.jar file copy to / StrutsWeb / Web-INF / LIB /, then start Apache Tomcat (of course, web.xml and struts-config.xml have been configured).
One trial, it is really unhappy.
When visiting the JSP page, see the prompt error:
"Org.apache.jasper.jaspeexception: Cannot Find ActionMAppings OR ActionFORMBeans Collection
shocked.
It also tossed for a long time, discovered that the privileged = "true" mentioned above can play a role in this case.
That is, modify the server.xml file, plus the parameter privileged = "true" in the description of
This allows you to access the JSP page and run correctly, no error prompts. [^ ^ ^]
So you can draw such a stuff:
If there is only one struts.jar in / strutsWeb / web-inf / lib / there is no other * .jar file, then modify the description of the relative web application in the server.xml file, add privileged = " True "parameter allows the application of the Struts project to run normally and the access is correct.
Second, Win2K JDK1.4 Apache Tomcat 5.0.13 Jakarta-Struts-1.1 Environment
As the Tomcat5 as a JSP container, the above problem will often encounter in Struts, and the solution is also roughly the same, privileged = "true" is equally valid for Tomcat5. [: D]
The following is mainly to talk about different places.
Usually, there is no careful study of Apache Tomcat, this time I found a few, simply recorded. *1*
Compared with Apache Tomcat4, Apache Tomcat5 adds a Catalina directory and subdirectory in its Conf folder, which is: Tomcat_Home / conf / Catalina / localhost /, all * .xml files in the localhost folder.
Each * .xml file corresponds to the name of a Tomcat web application.
In the localhost folder, Apache Tomcat5 automatically generates two files, named, the admin.xml, and manager.xml files.
When Apache Tomcat5 is started, you can access this:
http://127.0.0.1:8080/admin/
http://127.0.0.1:8080/Manager/
Among them, visit
Http://127.0.0.1:8080/admin/, after authentication of the username and password, you can enter the Tomcat Web Server Administration Tool.
*2*
Add a web application project to Tomcat4, add a
->
Then add this sentence below:
After saving server.xml, restart Apache Tomcat4, you can pass
Http://127.0.0.1:8080/mystruts/ to access this web application.
The same can be done in Tomcat5.
Similarly, add a
It is important to point out that when a
If this
For example, the above is written in Server.xml
When Tomcat5 is started, it will generate a file that "mystruts.xml" in / catalina / localhost / down. The same is the same as written in Server.xml:
Context>
So, we can say this: If you want to add a web application service in Apache Tomcat5, you can edit a XML file directly in Tomcat_Home / Conf / Catalina / LocalHost / Path, and write on this XML file.
* 3 *
In addition, it is necessary to say that there are multiple start-up methods after Apache Tomcat.
** You can start Tomcat services in Tomcat_Home / Bin / clicks on Startup.bat.
** You can run Tomcat services in "Start Tomcat" in the "Start" -> Program "->" Apache Tomcat "menu.
However, Tomcat4 and Tomcat5's service operation form is different.
Tomcat4 is running from "Startup.bat" or from "start tomcat", there will be a black screen of the command prompt window (class DOS window), which is used to indicate the operation of the Tomcat service and some log information.
After tomcat5 clicks on "Startup.bat", Tomcat is clicked in the running command prompt window, and after the "start tomcat" click to run, the service window will not appear, and only one with green on the bottom right of the screen. Triangular pallet icon ([: D] At first glance, this icon and the icon of the MS SQLServer service manager are almost exactly the same.).
* 4 *
Use Apache Tomcat5 to do service, especially need to point out, if you add a
When starting the Tomcat service by "startup.bat", the following information is displayed on the command prompt window (but will not affect the use of Struts)
------------------------------
Warning: Error Storing Config File
Java.io.filenotFoundException: ../../conf/catalina/localhost/mystruts.xml (system find
Less than the specified path. )
------------------------------
And / Catalina / LocalHost / down the XML file will not be updated.
Click "Start Tomcat" to run the Tomcat5 service if there is this situation (this can look at Tomcat log files).
* 5 *
Let's pay attention to the parameters in the
In the path tomcat_home / conf / Catalina / LocalHost / Under, find the Apache Tomcat5 automatically generated with two files, namedMIN.XML, and Manager.xml files.
Open the XML file, you can find the following:
------------------------------
Context>
Debug = "0" privileged = "true"> Context> ------------------------------ Oh, do you understand? Apache Tomcat5 automatically generated XML files, there is a parameter in the description of [complete] BY JRQ October 19, 2004, in the stone city