一直對shh很感興趣,也一直有用shh開發東西,但是學習地並不深入。
1.ssh開發最好用myeclipse,這個ide真的非常好用,框架搭建基本不用花太大的力氣。
2.當用hibernate去鏈接oracle的時候經常會出現sid識別不了的情況,這時候就要去修改一下oracle的配置文件裏。
3.oracle的監聽程序一定要打開。
4.structs2.x和hibernate4有jar包衝突,要替換相應的jar包才行。
5.如果某個jsp頁面是要登陸之後才能看得見的那麼這個jsp頁面不能放到WebRoot目錄下面,應該放到web-inf目錄下面,這樣的話這個jsp頁面只能通過action跳轉過來。
6.structs配置文件裏面的action的類class一定要和spring配置文件裏面配置的一樣。
<action name="doctorlogin" class="loginAction" method="Doctorlogin">
<result name="doctorls">/person_doctor.jsp</result>
<result name="doctorl">/login.jsp</result>
</action>
<bean id="loginAction" class="cn.it.bing.action.LoginAction" >
<property name="doctorDao" ref="DoctorsDAO"></property>
<property name="userDao" ref="UsersDAO"></property>
</bean>
7.除了抽取類之外還可以抽取jsp頁面,把一般jsp頁面要引用到的東西放到一個.jspf文件裏面,到時候其他jsp頁面直接
- <head>
- <%@ include file="/public/head.jspf" %>
- </head>
8.同時也可以將多臺運用到action的配置當中比如這樣:
- <action name="send_*_*" class="sendAction">
- <result name="send">/WEB-INF/{1}/{2}.jsp</result>
- </action>
- <frame src="send_main_left.action" />
- <frame src="send_main_right.action" />
9.充分利用好軟件設計模式的內容可以讓代碼更整潔,比如利用範型去實現多態。
@SuppressWarnings("unchecked")
@Service("baseService ")
@Lazy(true)
public class BaseServiceImpl<T> implements BaseService<T> {
private Class clazz; //clazz?д洢?˵?ǰ?????????ͣ???????T
@Resource //???????????棬?Ͳ??????set??????ʹ?÷???ע?????????Կ????set?????ɵ???
private SessionFactory sessionFactory;
public BaseServiceImpl() {
System.out.println("this??????ǵ?ǰ???ù??췽???Ķ???" + this);
System.out.println("??ȡ??ǰthis????ĸ?????Ϣ" + this.getClass().getSuperclass());
System.out.println("??ȡ??ǰthis????ĸ?????Ϣ(??????????Ϣ)" + this.getClass().getGenericSuperclass());
//?õ????͵IJ???????
ParameterizedType type = (ParameterizedType) this.getClass().getGenericSuperclass();
clazz = (Class)type.getActualTypeArguments()[0];
}
protected Session getSession() {
//?ӵ?ǰ?̻߳?ȡsession?????û???