如何学好java

如何学好java,其实很简单,只要用心体会,慢慢积累!
posts - 106, comments - 7, trackbacks - 0, articles - 3
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

mldn's ssh

Posted on 2011-06-11 15:35 哈希 阅读(194) 评论(0)  编辑  收藏 所属分类: java 常用框架
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
    xsi:schemaLocation
="http://java.sun.com/xml/ns/j2ee   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
<!-- <filter>
        
<filter-name>encoding</filter-name>
        
<filter-class>
            org.lxh.myzngt.filter.EncodingFilter
        
</filter-class>
        
<init-param>
            
<param-name>charset</param-name>
            
<param-value>gbk</param-value>
        
</init-param>
    
</filter>
    
<filter-mapping>
        
<filter-name>encoding</filter-name>
        
<url-pattern>/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>userlogin</filter-name>
        <filter-class>
            org.lxh.myzngt.filter.UserLoginFilter
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>userlogin</filter-name>
        <url-pattern>/jsp/user/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>userlogin</filter-name>
        <url-pattern>/jsp/ques/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>adminlogin</filter-name>
        <filter-class>
            org.lxh.myzngt.filter.AdminLoginFilter
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>adminlogin</filter-name>
        <url-pattern>/jsp/admin/*</url-pattern>
    </filter-mapping>
    <filter>
        <filter-name>opensession</filter-name>
        <filter-class>
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>opensession</filter-name>
        <url-pattern>*.do</url-pattern>
    </filter-mapping>-->
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/classes/applicationContext.xml
        </param-value>
    </context-param>
    <servlet>
        <servlet-name>context</servlet-name>
        <servlet-class>
            org.springframework.web.context.ContextLoaderServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>
            org.apache.struts.action.ActionServlet
        </servlet-class>
        <init-param>
            <param-name>config</param-name>
            <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>debug</param-name>
            <param-value>3</param-value>
        </init-param>
        <init-param>
            <param-name>detail</param-name>
            <param-value>3</param-value>
        </init-param>
        <load-on-startup>0</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
</web-app>

 struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
    
<data-sources />
    
<form-beans>
        
<form-bean name="userForm"
            type
="org.lxh.myzngt.struts.form.UserForm" />
        
<form-bean name="questionForm"
            type
="org.lxh.myzngt.struts.form.QuestionForm" />
        
<form-bean name="answerForm"
            type
="org.lxh.myzngt.struts.form.AnswerForm" />
        
<form-bean name="itemForm"
            type
="org.lxh.myzngt.struts.form.ItemForm" />
        
<form-bean name="indexForm"
            type
="org.apache.struts.action.DynaActionForm" />
        
<form-bean name="showForm"
            type
="org.apache.struts.action.DynaActionForm" />
        
<form-bean name="userinfoForm"
            type
="org.apache.struts.action.DynaActionForm" />
        
<form-bean name="adminForm"
            type
="org.lxh.myzngt.struts.form.AdminForm" />
        
<form-bean name="adminuserForm"
            type
="org.lxh.myzngt.struts.form.AdminuserForm" />
        
<form-bean name="adminquestionForm"
            type
="org.apache.struts.action.DynaActionForm" />
        
<form-bean name="adminitemForm"
            type
="org.lxh.myzngt.struts.form.AdminitemForm" />
        
<form-bean name="adminsubitemForm"
            type
="org.lxh.myzngt.struts.form.AdminsubitemForm" />
        
<form-bean name="adminloginForm"
            type
="org.lxh.myzngt.struts.form.AdminloginForm" />

    
</form-beans>

    
<global-exceptions />
    
<global-forwards />
    
<action-mappings>
        
<action attribute="userForm" input="/jsp/errors.jsp"
            name
="userForm" parameter="status" path="/jsp/user" scope="request"
            type
="org.lxh.myzngt.struts.action.UserAction">
            
<forward name="registersuccess"
                path
="/jsp/index.do?status=list">
            
</forward>
            
<forward name="registerfailure" path="/jsp/register.jsp"></forward>
            
<forward name="loginsuccess"
                path
="/jsp/index.do?status=list">
            
</forward>
            
<forward name="loginfailure" path="/jsp/login.jsp"></forward>
            
<forward name="exists" path="/jsp/updatepwd.jsp"></forward>
            
<forward name="notexists" path="/jsp/forgetpwd.jsp"></forward>
            
<forward name="updatepwddo" path="/jsp/updatepwd_do.jsp"></forward>
            
<forward name="userinfo" path="/jsp/user/userinfo.jsp"></forward>
            
<forward name="updatedo" path="/jsp/user/update_do.jsp"></forward>
        
</action>
        
<action attribute="questionForm" input="/jsp/errors.jsp"
            name
="questionForm" parameter="status" path="/jsp/ques/question"
            scope
="request" type="org.lxh.myzngt.struts.action.QuestionAction">
            
<forward name="insertdo" path="/jsp/ques/question_do.jsp"></forward>
        
</action>
        
<action attribute="answerForm" input="/jsp/errors.jsp"
            name
="answerForm" parameter="status" path="/jsp/ques/answer"
            scope
="request" type="org.lxh.myzngt.struts.action.AnswerAction">
            
<forward name="insertdo" path="/jsp/ques/answer_do.jsp"></forward>
        
</action>
        
<action attribute="itemForm" input="/jsp/errors.jsp"
            name
="itemForm" parameter="status" path="/jsp/ques/item"
            scope
="request" type="org.lxh.myzngt.struts.action.ItemAction">
            
<forward name="question" path="/jsp/ques/question.jsp"></forward>
        
</action>
        
<action attribute="indexForm" input="/jsp/errors.jsp"
            name
="indexForm" parameter="status" path="/jsp/index" scope="request"
            type
="org.lxh.myzngt.struts.action.IndexAction">
            
<forward name="indexdo" path="/jsp/index.jsp"></forward>
        
</action>
        
<action attribute="showForm" input="/jsp/errors.jsp"
            name
="showForm" parameter="status" path="/jsp/show" scope="request"
            type
="org.lxh.myzngt.struts.action.ShowAction">
            
<forward name="showquestion"
                path
="/jsp/question_show.jsp">
            
</forward>
            
<forward name="showlist" path="/jsp/list_question.jsp"></forward>
        
</action>
        
<action attribute="userinfoForm" input="/jsp/errors.jsp"
            name
="userinfoForm" parameter="status" path="/jsp/user/userinfo"
            scope
="request" type="org.lxh.myzngt.struts.action.UserinfoAction">
            
<forward name="listmyquestion"
                path
="/jsp/user/list_myquestion.jsp">
            
</forward>
            
<forward name="listanswer"
                path
="/jsp/user/list_answer.jsp">
            
</forward>
            
<forward name="listmyaccept"
                path
="/jsp/user/list_myaccept.jsp">
            
</forward>
            
<forward name="listmyquestionanswer"
                path
="/jsp/user/list_myquestionanswer.jsp">
            
</forward>
            
<forward name="answerdo"
                path
="/jsp/user/accept_answer.jsp">
            
</forward>
            
<forward name="updatequestiondo"
                path
="/jsp/user/question_update_do.jsp">
            
</forward>
        
</action>
        
<action attribute="adminForm" input="/jsp/errors.jsp"
            name
="adminForm" parameter="status" path="/jsp/admin/admin"
            scope
="request" type="org.lxh.myzngt.struts.action.AdminAction">
            
<forward name="insertdo"
                path
="/jsp/admin/admin.do?status=list">
            
</forward>
            
<forward name="updatepwddo"
                path
="/jsp/admin/admin_updatepwd_do.jsp">
            
</forward>
            
<forward name="updatepwdfailure"
                path
="/jsp/admin/admin_updatepwd.jsp">
            
</forward>
            
<forward name="deletedo"
                path
="/jsp/admin/admin.do?status=list">
            
</forward>
            
<forward name="list" path="/jsp/admin/admin_list.jsp"></forward>

        
</action>
        
<action attribute="adminuserForm" input="/jsp/errors.jsp"
            name
="adminuserForm" parameter="status" path="/jsp/admin/adminuser"
            scope
="request"
            type
="org.lxh.myzngt.struts.action.AdminuserAction">
            
<forward name="userlist" path="/jsp/admin/user_list.jsp"></forward>
            
<forward name="list"
                path
="/jsp/admin/adminuser.do?status=list">
            
</forward>
        
</action>
        
<action attribute="adminquestionForm" input="/jsp/errors.jsp"
            name
="adminquestionForm" parameter="status"
            path
="/jsp/admin/adminquestion" scope="request"
            type
="org.lxh.myzngt.struts.action.AdminquestionAction">
            
<forward name="questionlist"
                path
="/jsp/admin/question_list.jsp">
            
</forward>
            
<forward name="list"
                path
="/jsp/admin/adminquestion.do?status=list">
            
</forward>
        
</action>
        
<action attribute="adminitemForm" input="/jsp/errors.jsp"
            name
="adminitemForm" parameter="status" path="/jsp/admin/adminitem"
            scope
="request"
            type
="org.lxh.myzngt.struts.action.AdminitemAction">
            
<forward name="itemlist" path="/jsp/admin/item_list.jsp"></forward>
            
<forward name="list"
                path
="/jsp/admin/adminitem.do?status=list">
            
</forward>
            
<forward name="subitemlist"
                path
="/jsp/admin/subitem_list.jsp">
            
</forward>
        
</action>
        
<action attribute="adminsubitemForm" input="/jsp/errors.jsp"
            name
="adminsubitemForm" parameter="status"
            path
="/jsp/admin/adminsubitem" scope="request"
            type
="org.lxh.myzngt.struts.action.AdminsubitemAction">
            
<forward name="subitemlist"
                path
="/jsp/admin/subitem_list.jsp">
            
</forward>
        
</action>
        
<action attribute="adminloginForm" input="/jsp/errors.jsp"
            name
="adminloginForm" parameter="status" path="/jsp/adminlogin"
            scope
="request"
            type
="org.lxh.myzngt.struts.action.AdminloginAction">
            
<forward name="loginsuccess"
                path
="/jsp/goadmin.htm">
            
</forward>
            
<forward name="loginfailure"
                path
="/jsp/admin_login.jsp">
            
</forward>
        
</action>

    
</action-mappings>

    
<controller
        processorClass
="org.springframework.web.struts.DelegatingRequestProcessor">
    
</controller>
    
<message-resources
        parameter
="org.lxh.myzngt.struts.ApplicationResources" />
    
<plug-in
        className
="org.springframework.web.struts.ContextLoaderPlugIn">
        
<set-property property="contextConfigLocation"
            value
="/WEB-INF/classes/applicationContext.xml" />
    
</plug-in>
</struts-config>

spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
    
<!--<bean id="dataSource"
        class
="org.springframework.jndi.JndiObjectFactoryBean"
        destroy
-method="close">
        
<property name="jndiName">
            
<value>java:comp/env/jdbc/mldn</value>
        
</property>
    
</bean>-->    
        
<bean id="dataSource"
        class
="org.apache.commons.dbcp.BasicDataSource"
        destroy
-method="close">
        
<property name="driverClassName">
        
<value>org.gjt.mm.mysql.Driver</value>
        
</property>
        
<property name="url">
        
<value>jdbc:mysql://localhost:3306/mldn</value>
        </property>
        
<property name="username">
        
<value>root</value>
        
</property>
        
<property name="password">
        
<value>wdf</value>
        
</property>
        
</bean>

    
<bean id="hibernateInterceptor"
        class
="org.springframework.orm.hibernate3.HibernateInterceptor">
        
<property name="sessionFactory">
            
<ref bean="sessionFactory" />
        
</property>
    
</bean>
    
<bean id="sessionFactory"
        class
="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        
<property name="dataSource">
            
<ref bean="dataSource" />
        
</property>
        
<property name="hibernateProperties">
            
<props>
                
<prop key="hibernate.dialect">
                    org.hibernate.dialect.MySQLDialect
                
</prop>
                
<!-- 表示允许自动提交 -->
                
<prop key="hibernate.connection.autocommit">true</prop>
                
<!-- 显示sql语句 -->
                
<prop key="hibernate.show_sql">true</prop>
            
</props>
        
</property>
        
<property name="mappingResources">
            
<list>
                
<value>org/lxh/myzngt/vo/Admin.hbm.xml</value>
                
<value>org/lxh/myzngt/vo/User.hbm.xml</value>
                
<value>org/lxh/myzngt/vo/Item.hbm.xml</value>
                
<value>org/lxh/myzngt/vo/Subitem.hbm.xml</value>
                
<value>org/lxh/myzngt/vo/Answer.hbm.xml</value>
                
<value>org/lxh/myzngt/vo/Question.hbm.xml</value>
            
</list>
        
</property>
    
</bean>
    
<bean id="hibernateTemplate"
        class
="org.springframework.orm.hibernate3.HibernateTemplate">
        
<property name="sessionFactory">
            
<ref bean="sessionFactory" />
        
</property>
    
</bean>
    
<bean id="iuserdao" class="org.lxh.myzngt.dao.IUserDAO"
        abstract
="true">
    
</bean>
    
<bean id="iitemdao" class="org.lxh.myzngt.dao.IItemDAO"
        abstract
="true">
    
</bean>
    
<bean id="iquestiondao" class="org.lxh.myzngt.dao.IQuestionDAO"
        abstract
="true">
    
</bean>
    
<bean id="ianswerdao" class="org.lxh.myzngt.dao.IAnswerDAO"
        abstract
="true">
    
</bean>
    
<bean id="isubitemdao" class="org.lxh.myzngt.dao.ISubitemDAO"
        abstract
="true">
    
</bean>
    
<bean id="iadmindao" class="org.lxh.myzngt.dao.IAdminDAO"
        abstract
="true">
    
</bean>
    
<bean id="iadmindaoimpl"
        class
="org.lxh.myzngt.dao.impl.IAdminDAOImpl" parent="iadmindao">
        
<property name="hibernateTemplate">
            
<ref bean="hibernateTemplate" />
        
</property>
    
</bean>
    
<bean id="isubitemdaoimpl"
        class
="org.lxh.myzngt.dao.impl.ISubitemDAOImpl"
        parent
="isubitemdao">
        
<property name="hibernateTemplate">
            
<ref bean="hibernateTemplate" />
        
</property>
    
</bean>
    
<bean id="ianswerdaoimpl"
        class
="org.lxh.myzngt.dao.impl.IAnswerDAOImpl" parent="ianswerdao">
        
<property name="hibernateTemplate">
            
<ref bean="hibernateTemplate" />
        
</property>
    
</bean>
    
<bean id="iquestiondaoimpl"
        class
="org.lxh.myzngt.dao.impl.IQuestionDAOImpl"
        parent
="iquestiondao">
        
<property name="hibernateTemplate">
            
<ref bean="hibernateTemplate" />
        
</property>
    
</bean>
    
<bean id="iitemdaoimpl" class="org.lxh.myzngt.dao.impl.IItemDAOImpl"
        parent
="iitemdao">
        
<property name="hibernateTemplate">
            
<ref bean="hibernateTemplate" />
        
</property>
    
</bean>
    
<bean id="iuserdaoimpl" class="org.lxh.myzngt.dao.impl.IUserDAOImpl"
        parent
="iuserdao">
        
<property name="hibernateTemplate">
            
<ref bean="hibernateTemplate" />
        
</property>
    
</bean>
    
<bean name="/jsp/user"
        class
="org.lxh.myzngt.struts.action.UserAction">
        
<property name="iuserdao">
            
<ref bean="iuserdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/ques/item"
        class
="org.lxh.myzngt.struts.action.ItemAction" singleton="true">
        
<property name="iitemdao">
            
<ref bean="iitemdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/ques/question"
        class
="org.lxh.myzngt.struts.action.QuestionAction">
        
<property name="iquestiondao">
            
<ref bean="iquestiondaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/index"
        class
="org.lxh.myzngt.struts.action.IndexAction">
        
<property name="iitemdao">
            
<ref bean="iitemdaoimpl" />
        
</property>
        
<property name="iquestiondao">
            
<ref bean="iquestiondaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/show"
        class
="org.lxh.myzngt.struts.action.ShowAction">
        
<property name="iquestiondao">
            
<ref bean="iquestiondaoimpl" />
        
</property>
        
<property name="iitemdao">
            
<ref bean="iitemdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/ques/answer"
        class
="org.lxh.myzngt.struts.action.AnswerAction">
        
<property name="ianswerdao">
            
<ref bean="ianswerdaoimpl" />
        
</property>
        
<property name="iuserdao">
            
<ref bean="iuserdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/user/userinfo"
        class
="org.lxh.myzngt.struts.action.UserinfoAction">
        
<property name="iquestiondao">
            
<ref bean="iquestiondaoimpl" />
        
</property>
        
<property name="ianswerdao">
            
<ref bean="ianswerdaoimpl" />
        
</property>
        
<property name="iuserdao">
            
<ref bean="iuserdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/admin/admin"
        class
="org.lxh.myzngt.struts.action.AdminAction">
        
<property name="iadmindao">
            
<ref bean="iadmindaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/adminlogin"
        class
="org.lxh.myzngt.struts.action.AdminloginAction">
        
<property name="iadmindao">
            
<ref bean="iadmindaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/admin/adminuser"
        class
="org.lxh.myzngt.struts.action.AdminuserAction">
        
<property name="iuserdao">
            
<ref bean="iuserdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/admin/adminquestion"
        class
="org.lxh.myzngt.struts.action.AdminquestionAction">
        
<property name="iquestiondao">
            
<ref bean="iquestiondaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/admin/adminitem"
        class
="org.lxh.myzngt.struts.action.AdminitemAction">
        
<property name="iitemdao">
            
<ref bean="iitemdaoimpl" />
        
</property>
    
</bean>
    
<bean name="/jsp/admin/adminsubitem"
        class
="org.lxh.myzngt.struts.action.AdminsubitemAction">
        
<property name="isubitemdao">
            
<ref bean="isubitemdaoimpl" />
        
</property>
        
<property name="iitemdao">
            
<ref bean="iitemdaoimpl" />
        
</property>
    
</bean>
</beans>



只有注册用户登录后才能发表评论。


网站导航: