zoukankan      html  css  js  c++  java
  • sina sae 部署 java ssh 项目

    转自:http://jacobcookie.iteye.com/blog/1876798

     1. 在sae上使用struts,需要添加的Listener,在com.company.listener中添加SaeListener.java。

        

    Java代码  收藏代码
    1. package com.company.listener;  
    2.   
    3. import javax.servlet.ServletContextEvent;  
    4. import javax.servlet.ServletContextListener;  
    5. import javax.servlet.http.HttpSessionAttributeListener;  
    6. import javax.servlet.http.HttpSessionBindingEvent;  
    7. import javax.servlet.http.HttpSessionEvent;  
    8. import javax.servlet.http.HttpSessionListener;  
    9.   
    10. /* 
    11.  * 在sae上使用struts,需要添加的Listener 
    12.  */  
    13. public class SaeListener implements ServletContextListener,HttpSessionListener,HttpSessionAttributeListener{  
    14.   
    15.     public void contextDestroyed(ServletContextEvent arg0) {}  
    16.   
    17.     public void contextInitialized(ServletContextEvent arg0) {}  
    18.   
    19.     public void sessionCreated(HttpSessionEvent arg0) {}  
    20.   
    21.     public void sessionDestroyed(HttpSessionEvent arg0) {}  
    22.   
    23.     public void attributeAdded(HttpSessionBindingEvent arg0) {}  
    24.   
    25.     public void attributeRemoved(HttpSessionBindingEvent arg0) {}  
    26.   
    27.     public void attributeReplaced(HttpSessionBindingEvent arg0) {}  
    28.   
    29. }  

       

        2.在web.xml文件中添加sae监听器。

       

    Xml代码  收藏代码
    1. <!-- sae需要的监听器 -->  
    2.  <listener>  
    3.      <listener-class>  
    4.          com.company.listener.SaeListener  
    5.      </listener-class>  
    6.  </listener>  

        3、修改mysql数据库连接信息,sae提供的是phpMysql。

         

    Java代码  收藏代码
    1. db.username=(sae提供的用户名,在汇总信息那里)  
    2. db.pwd=(sae提供的密码,在汇总信息那里)  
    3. db.driverClassName=com.mysql.jdbc.Driver  
    4. db.url=jdbc:mysql://w.rdc.sae.sina.com.cn:3307/(sae提供的数据库名)  

       

        4、最后一步让我抓狂,fk。我以为输入域名就会自动访问网站的首页,事实我想错了,尼玛的浪费了我多少时光。

          需要在【AppConfig】里的【目录默认页面】添加你的首页【index.jsp】,然后在二级域名后面加上index.jsp,这样就可以访问了。

  • 相关阅读:
    JVM学习笔记(一)------基本结构
    基于 Android 的 3D 视频样本代码
    Objective-C语法之代码块(block)的使用
    javabean总结
    oncopy和onpaste
    Linux/UNIX之信号(2)
    Html的空格显示
    硬盘的读写原理
    IntentFilter
    MyEclipse配置启动多个Tomcat
  • 原文地址:https://www.cnblogs.com/x_wukong/p/3721798.html
Copyright © 2011-2022 走看看