Today at home to try to build the same company as the development environment (Struts1+maven+resin), the results encountered a lot of problems, recorded, if you encounter similar problems, can be consulted;
My project: Http://files.cnblogs.com/files/focusahaha/struts1.rar
Maven
MAVEN is worth noting that only the Conf folder of the setting.xml file, in fact, without any settings can be used. But you can also modify this file, manually set the location of the local MAVEN library, using the image (if using the company's own self-built MAVEN library), use the agent (if you use a proxy to the Internet, also set the next).
In addition, if you use Eclipse integration with Maven, you first need to download the MAVEN installation package (for example:apache-maven-3.2.5-bin.zip) and then download the offline plugin eclipse-maven3-plugin.7z, unzip it and place it in Eclipse's corresponding location. Specifically, refer to the website: http://jingyan.baidu.com/article/60ccbceb01de4d64cbb19756.html, the explanation is very detailed.
Finally, you need to set up Maven in Eclipse, first you need to specify which maven to use, because the Eclipse installation maven plugin will produce a built-in Maven, if modified in the Maven->installations option, will result in Eclipse using the MAVEN command and the command line using the MAVEN command results inconsistent, 2nd need to set the path of the setting.xml file used, it is best to copy the Setting.xml to . m2 folder, do not use the setting.xml in the Maven Conf folder, as this does not work, and if you want to update maven, you need to modify the Setting.xmlagain. Specific reference URL: http://www.cnblogs.com/dcba1112/archive/2011/05/01/2033805.html#3120676.
Finally, provide the URL of the next Maven central repository, as you are likely to find the location of the corresponding jar package: http://search.maven.org/#search
To build a MAVEN environment, learn maven
Refer to:
1.maven installation and Maven integration with Eclipse: http://jingyan.baidu.com/article/60ccbceb01de4d64cbb19756.html
2.maven configuration explanation (actually a excerpt from Maven in action): http://www.cnblogs.com/dcba1112/archive/2011/05/01/2033805.html#3120676
3.maven Jar Pack Location search: http://search.maven.org/#search
Resin
Resin files that need to be modified have only one . conf file, different versions of Resin Conf folder contents, I use Resin-3.1.12.zip, because this version of the Conf folder has a. conf file example.
With Eclipse integration resin, you only need to modify a location <web-app></web-app>, and the modified <web-app> tag content is:
<web-app id= "/" root-directory= "D:\workspace\workspace_web\struts1\src\main\webapp"/> In fact, you want to specify the root directory of the corresponding Web application.
At the same time you need to make sure that you can find app-default.xml, you need to change his position to absolute path, modified by: <resin:import path= "d:/app/resin-3.1.12/conf/ App-default.xml "/>
The complete conf file is as follows
<!---Alternative to resin.conf, minimal configuration for starting server. --unix> Java-jar lib/resin.conf-server-root/var/www-conf conf/minimal.conf--Server root is/var/www, doc Uments is In/var/www/docs. -<Resinxmlns= "Http://caucho.com/ns/resin"Xmlns:resin= "Http://caucho.com/ns/resin/core"> <Logname="" Level= "Info"Path= "stdout:"/> <ClusterID=""> <ServerID=""> <httpPort= "8080"/> </Server> <Resin:importPath= "D:/app/resin-3.1.12/conf/app-default.xml"/> <HostID=""root-directory="."> <Web-appID="/"root-directory= "D:\workspace\workspace_web\struts1\src\main\webapp"/> </Host> </Cluster></Resin>
View Code
In addition, if you want to use resin for debugging in Eclispe, you can create a new Java application in the Debug configuration
1. The project must choose your Maven project, main class is Com.caucho.server.resin.Resin;
2.program arguments write -conf "D:\app\resin-3.1.12\conf\minimal.conf" point to your modified. conf file;
VM Arguments fill -djava.util.logging.manager=com.caucho.log.logmanagerimpl
3.classpath Select Add external jars add all the jars under resin lib and the Tools.jar under the JDK Lib; user entries Be sure to add your Maven Project ;
Mainly on these, can refer to http://blog.csdn.net/sz_bdqn/article/details/7488221, I began to refer to this do, dead and alive can not run, had to keep trying.
Struts1
Struts1 actually nothing good to say, find an example to do, do not understand the place to think about the next on the line.
I've got two questions.
1. Caused by:java.lang.NullPointerException
At Org.apache.struts.config.FormBeanConfig.createActionForm (formbeanconfig.java:289)
I realized the Actionform class can not find, online said is the Form-bean label type is wrong, resulting in not found, mine is not. I did not add the project in the debug configuration-"classpath-" user entries, causing the class to be found. In addition, I found that if you do not compile the MAVEN project to run the MAVEN program directly, this problem will also occur.
2. My duplicate action does not go in, there is a blank page. I am obviously inheriting the Org.apache.struts.action.Action class Ah, configuration is no problem.
And then I found out that my method of copying was
Public Actionforward Execute (actionmapping mapping, actionform form,servletrequest request, Servletresponse response) throws Exception
should be replicated.
Public Actionforward Execute (actionmapping mapping, actionform form,httpservletrequest request, HttpServletResponse response) throws Exception
Struts1 technology can be consulted (technical point is full, but the code is only part): http://www.ibm.com/developerworks/cn/java/l-struts1-1/
Examples of struts getting started can be consulted: http://blog.csdn.net/lanpiao_87/article/details/7451784
The Struts 1 Java project based on Maven