Simple struts Application Development

Source: Internet
Author: User

Finally, I have finished this test. I hope it will be helpful for beginners who want to learn struts.
(Mystruts application) directory structure
Mystruts
|-WEB-INF
|-Lib
|-Struts. jar
|-Classes
|-ConnectionPool
|-GetDbConnection. class
|-Mystruts
|-User1Action. class
|-UserAction. class
|-UserActionForm. class
|-Userdao. class
|-Struts-bean.tld
|-Struts-config.xml
|-Struts-html.tld
|-Struts-logic.tld
|-Struts-template.tld
|-Adduser. jsp
|-Index. jsp
|-Viewuser. jsp
Step 1: configure the development environment
(If you do not have any software, please download it from http://www.apache.org)
Tomcat5.0 configuration (create a mystruts application and copy relevant files)
Find the confCatalinalocalhost subdirectory in your tomcat installation directory. Create the mystruts. xml file.
The file content is as follows. In this file, we will configure a connection pool. Change the relevant driver, database user, and password to your own local configuration.
Copy the JDBC driver to the Tomcat 5.0 commonlib directory. Put struts. jar mystrutsWEB-INFlib directory.
<Context path = "/mystruts" docBase = "D: wwwmystrutsmystrutsmystruts" debug = "0" privileged = "true">
<Resource name = "jdbc/TestDB"
Auth = "Container"
Type = "javax. SQL. DataSource"/>
<ResourceParams name = "jdbc/TestDB">
<Parameter>
<Name> factory </name>
<Value> org. apache. commons. dbcp. basicperformancefactory </value>
</Parameter>
<Parameter>
<Name> maxActive </name>
<Value> 10 </value>
</Parameter>
<Parameter>
<Name> maxIdle </name>
<Value> 5 </value>
</Parameter>
<Parameter>
<Name> maxWait </name>
<Value> 10000 </value>
</Parameter>
<Parameter>
<Name> username </name>
<Value> sa </value>
</Parameter>
<Parameter>
<Name> password </name>
<Value> test </value>
</Parameter>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.