日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ssh结合使用

發布時間:2023/12/2 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ssh结合使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

springxml配置

<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns="http://xmlns.jcp.org/xml/ns/javaee"xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"id="WebApp_ID" version="3.1"><display-name>ssh02</display-name><welcome-file-list><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file><welcome-file>index.jsp</welcome-file><welcome-file>default.html</welcome-file><welcome-file>default.htm</welcome-file><welcome-file>default.jsp</welcome-file></welcome-file-list><!--配置struts過濾器 --><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>*.action</url-pattern></filter-mapping><!-- 配置spring監聽器 --><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener><context-param><param-name>contextConfigLocation</param-name><param-value>classpath:spring.xml</param-value></context-param> </web-app>

  



?

UserAction?類

package com.qianfeng.action;import com.qianfeng.dao.UserDao; import com.qianfeng.entity.User;public class UserAction {private User u = new User();private UserDao ud;public UserDao getUd() {return ud;}public void setUd(UserDao ud) {this.ud = ud;}public void setU(User u) {this.u = u;}public User getU() {return u;}public String login() {String str = "index";if (ud.login(u)) {str = "ss";}return str;}}

  

?

UserDao類

package com.qianfeng.dao;import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.query.Query;import com.qianfeng.entity.User;public class UserDao {private SessionFactory sf;public void setSf(SessionFactory sf) {this.sf = sf;}public boolean login(User u) {Session session = sf.openSession();Query query = session.createQuery("from User where acount=? and pwd=?");query.setString(0, u.getAcount());query.setString(1, u.getPwd());Object rs = query.uniqueResult();session.close();return rs == null ? false : true;} }

 User類

package com.qianfeng.entity;import java.io.Serializable;public class User implements Serializable {private int id;private String acount;private String pwd;public User() {super();}public String getAcount() {return acount;}public User(String acount, String pwd) {super();this.acount = acount;this.pwd = pwd;}public void setAcount(String acount) {this.acount = acount;}public String getPwd() {return pwd;}public void setPwd(String pwd) {this.pwd = pwd;}public int getId() {return id;}public void setId(int id) {this.id = id;}}

  

login 登錄界面

ss登錄成功界面

?

轉載于:https://www.cnblogs.com/rzqz/p/7085551.html

總結

以上是生活随笔為你收集整理的ssh结合使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。