ssh简单入门级案例教程
准备工作:struts2.3.34+spring4.2.2+hibernate3.3.2
导入需要的开发包:
struts开发包---注意:javassist-3.18.1-GA.jar包与hibernate中的重复(只保留高版本即可)
hibernate开发包
此外还需要在hibernate解压包中找到lib/optional/c3p0文件夹,然后将c3p0-0.9.2.1.jar和mchange-commons-java-0.2.3.4.jar拷贝到工程lib目录下
spring开发包
除了javadoc.jar和sources.jar包名结尾的包,其他包全部拷贝到工程项目lib中
最后别忘了将mysql驱动包拷贝到lib中
2、web.xml
Spring提供了ContextLoaderListener,该监听器实现了ServletContextListener接口,他在Web应用程序启动时被触发。当他创建时会自动查找WEB-INF/下的applicationContext.xml,所以当只有一个配置文件且文件名为applicationContext.xml时,则只需要在web.xml文件中配置ContextLoaderListener监听器即可.当有多个配置文件需要载入,则应该使用<context-param>元素指定配置文件的文件名,ContextLoaderListener加载时,会查找名为contextConfigLocation的初始化参数。当Web应用程序启动时先读取web.xml文件,然后创建spring容器,之后根据配置文件内容,装配Bean实例。
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>sklm_2</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>home.jsp</welcome-file>
</welcome-file-list> <!-- 让spring随web启动而创建的监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 配置spring配置文件位置参数 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param> <!-- struts2核心配置 -->
<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>/*</url-pattern>
</filter-mapping> </web-app>
web.xml
3、实体和映射文件
(1)User.java
package cn.xyp.web.entity; import java.sql.Date; public class User { private Long user_id;
private String user_name;
private String user_password;
private int user_age;
private String user_sex;
private String user_address;
private Date user_create_time;
public User(){} public User(String user_name, String user_password, int user_age, String user_sex, String user_address,
Date user_create_time) {
this.user_name = user_name;
this.user_password = user_password;
this.user_age = user_age;
this.user_sex = user_sex;
this.user_address = user_address;
this.user_create_time = user_create_time;
} public Long getUser_id() {
return user_id;
}
public void setUser_id(Long user_id) {
this.user_id = user_id;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_password() {
return user_password;
}
public void setUser_password(String user_password) {
this.user_password = user_password;
}
public int getUser_age() {
return user_age;
}
public void setUser_age(int user_age) {
this.user_age = user_age;
}
public String getUser_sex() {
return user_sex;
}
public void setUser_sex(String user_sex) {
this.user_sex = user_sex;
}
public String getUser_address() {
return user_address;
}
public void setUser_address(String user_address) {
this.user_address = user_address;
}
public Date getUser_create_time() {
return user_create_time;
}
public void setUser_create_time(Date user_create_time) {
this.user_create_time = user_create_time;
} @Override
public String toString(){
return "User [user_id="+user_id+", user_name="+user_name+", user_password="+user_password+", user_age="+user_age+", "
+ "user_sex="+user_sex+", user_address="+user_address+", user_create_time="+user_create_time+"]";
} }
user.java
(2)、User.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="cn.xyp.web.entity">
<class name="User" table="sys_user">
<id name="user_id" type="long">
<generator class="native"></generator>
</id> <property name="user_name" type="java.lang.String"></property>
<property name="user_password" type="java.lang.String"></property>
<property name="user_age" type="int"></property>
<property name="user_sex" type="java.lang.String"></property>
<property name="user_address" type="java.lang.String"></property>
<property name="user_create_time" type="java.sql.Date"></property>
</class>
</hibernate-mapping>
User.hbm.xml
4、DAO
(1)UserDAO.java接口类
package cn.xyp.web.dao; import java.util.List; import cn.xyp.web.entity.User; public interface UserDAO { /**
* 向数据库中添加用户
* @param user
*/
public void add(User user); /**
* 刷新user在数据库中的信息
* @param user
*/
public void update(User user); /**
* 根据被给定的id号删除对应的user
* @param id
*/
public void delete(long id); /**
* 根据被给定的name和password查找user
* @param name
* @param password
* @return
*/
public User findByName(String name, String password); /**
* 根据被给定的id号查找user
* @param id
* @return
*/
public User findById(long id); /**
* 从数据库中查找所有信息
* @return
*/
public List<User> findAll();
}
UserDAO
(2)UserDAOImpl.java 接口实现类
package cn.xyp.web.dao; import java.util.List; import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction; import cn.xyp.web.entity.User; public class UserDAOImpl implements UserDAO { private SessionFactory sessionFactory; //构造方法注入SessionFactory对象
public UserDAOImpl(SessionFactory sessionFactory){
this.sessionFactory = sessionFactory;
} //使用SessionFactory对象返回Session对象
public Session currentSession(){
return sessionFactory.openSession();
} @Override
public void add(User user) {
Session session = null;
try {
session = currentSession();
Transaction tx = session.beginTransaction();
session.save(user);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
}finally{
session.close();
} } @Override
public void update(User user) {
Session session = null;
try {
session = currentSession();
Transaction tx = session.beginTransaction();
session.save(user);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
}finally{
session.close();
} } @Override
public void delete(long id) {
Session session = null;
try {
session = currentSession();
Transaction tx = session.beginTransaction();
User user = (User)session.get(User.class, id);
session.delete(user);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
}finally{
session.close();
} } @Override
public User findByName(String name, String password) {
Session session = null;
User user = null;
try {
session = currentSession();
Transaction tx = session.beginTransaction();
String hsql = "from User m where m.user_name = :uname and m.user_password= :upassword";
Query query = session.createQuery(hsql);
query.setParameter("uname", name);
query.setParameter("upassword", password);
user = (User) query.uniqueResult();
tx.commit();
}catch(HibernateException e){
e.printStackTrace();
}finally{
session.close();
} return user;
} @Override
public User findById(long id) {
Session session = null;
User user = null;
try {
session = currentSession();
Transaction tx = session.beginTransaction();
String hsql = "from User u where u.user_id= :id";
Query query = session.createQuery(hsql);
user = (User) query.setParameter("id", id);
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
}finally{
session.close();
}
return user;
} @Override
public List<User> findAll() {
Session session = null;
List<User> list = null;
try {
session = currentSession();
Transaction tx = session.beginTransaction();
String hsql = "from User";
Query query = session.createQuery(hsql);
list = query.list();
tx.commit();
} catch (HibernateException e) {
e.printStackTrace();
}finally{
session.close();
}
return list;
} }
UserDAOImpl
5、业务逻辑层
(1)UserService.java接口类
package cn.xyp.web.service; import java.util.List; import cn.xyp.web.entity.User; public interface UserService { public void add(User user);
public void update(User user);
public void delete(long id);
public User findByName(String name, String password);
public User findById(long id);
public List<User> findAll(); }
UserService.java
(2)UserServiceImpl.java接口实现类
package cn.xyp.web.service;
/**
* 设值注入DAO层组件
*/
import java.util.List; import cn.xyp.web.dao.UserDAO;
import cn.xyp.web.entity.User; public class UserServiceImpl implements UserService { private UserDAO userDao; public void setUserDao(UserDAO userDao){
this.userDao = userDao;
} @Override
public void add(User user) { if(userDao.findById(user.getUser_id())==null){
userDao.add(user);
}
} @Override
public void update(User user) {
if(userDao.findById(user.getUser_id())==null){
userDao.update(user);
} } @Override
public void delete(long id) {
if(userDao.findById(id)==null){
userDao.delete(id);
} } @Override
public User findByName(String name, String password) {
User user = userDao.findByName(name, password);
return user;
} @Override
public User findById(long id) {
User user = userDao.findById(id);
return user;
} @Override
public List<User> findAll() {
List<User> list = userDao.findAll();
return list;
} }
UserServiceImpl.java
6、Action
(1)UserRegisterAction.java类(用户注册类)
package cn.xyp.web.action;
/**
*设置注入业务逻辑组件
*/
import com.opensymphony.xwork2.ActionSupport; import cn.xyp.web.entity.User;
import cn.xyp.web.service.UserService; public class UserRegisterAction extends ActionSupport { /**
*
*/
private static final long serialVersionUID = -4501870315633237256L;
private User user;
private UserService userService;
public User getUser(){
return user;
}
public void setUser(User user){
this.user = user;
} //注入业务逻辑组件
public void setUserService(UserService userService){
this.userService = userService;
} public String execute(){
userService.add(user);
return SUCCESS;
}
}
UserRegisterAction.java
(2)UserLoginAction.java类(用户登录类)
package cn.xyp.web.action;
/**
* 设置用户登录注入
*/
import com.opensymphony.xwork2.ActionSupport; import cn.xyp.web.entity.User;
import cn.xyp.web.service.UserService; public class UserLoginAction extends ActionSupport { /**
*
*/
private static final long serialVersionUID = 7448295814371243220L; private User user;
private UserService userService;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
//注入业务逻辑组件
public void setUserService(UserService userService) {
this.userService = userService;
} public String execute(){
String b = null;
try {
User user_ = userService.findByName(user.getUser_name(), user.getUser_password());
if(user_ != null){
b = SUCCESS;
}
} catch (Exception e) {
b = ERROR;
}
return b;
} }
UserLoginAction.java
(3)UserDeleteAction.java类(删除用户类)
package cn.xyp.web.action; import com.opensymphony.xwork2.ActionSupport; import cn.xyp.web.service.UserService; public class UserDeleteAction extends ActionSupport { /**
* 删除用户
*/
private static final long serialVersionUID = -2132782345900294714L;
private UserService userService;
private long id; public void setUserService(UserService userService) {
this.userService = userService;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
} public String execute(){
userService.delete(getId());
return SUCCESS;
} }
UserDeleteAction.java
(4)UserQueryAction.java(查询所有用户)
package cn.xyp.web.action;
/**
* 查找数据库中的所有信息
*/
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
import cn.xyp.web.entity.User;
import cn.xyp.web.service.UserService; public class UserQueryAction extends ActionSupport { /**
*
*/
private static final long serialVersionUID = 1483788569708897545L;
private UserService userService; public void setUserService(UserService userService) {
this.userService = userService;
} public String execute(){
List<User> list = userService.findAll();
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("userList", list);
return SUCCESS;
} }
UserQueryAction.java
(5)UserUpdateAction.java(更新用户)
package cn.xyp.web.action; import com.opensymphony.xwork2.ActionSupport; import cn.xyp.web.entity.User;
import cn.xyp.web.service.UserService; public class UserUpdateAction extends ActionSupport { /**
* 更新用户信息
*/
private static final long serialVersionUID = 6174197960048716176L; private UserService userService;
private User user;
private long id;
public UserService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
this.userService = userService;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
} public String showUser(){
User user = userService.findById(id);
setUser(user);
return SUCCESS;
} public String execute(){
userService.update(user);
return SUCCESS;
} }
UserUpdateAtion.java
7、struts.xml
spring托管将Struts2中的Action的实例化工作交由Spring容器统一管理,同时使Struts2中的Action实例能够访问Spring提供的业务逻辑资源,spring容器依赖注入的优势也可以体现,Struts2提供的spring插件struts2-spring-plugin-2.3.16.3.jar配合<constant name="struts.objectFactory" value="spring">使得Struts2的action由Spring来负责进行实例化.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts> <!-- spring配置 -->
<!-- 告诉struts运行时使用spring来创建对象 -->
<constant name="struts.objectFactory" value="spring"/> <package name="crm" extends="struts-default">
<!-- class属性值是spring定义的Bean,当执行execute()返回success时,控制转到另一个动作userQuery -->
<action name="userRegister" class="userRegisterAction">
<result name="success" type="redirectAction">/userQuery</result>
</action> <action name="userLogin" class="userLoginAction">
<result name="success">/welcome.jsp</result>
<result name="error">/register.jsp</result>
</action> <action name="userQuery" class="userQueryAction">
<result name="success">/displayAll.jsp</result>
</action> <action name="userDelete" class="userDeleteAction">
<result name="success" type="redirectAction">/userQuery</result>
</action> <action name="userShow" class="userShowAction" method="showUser">
<result name="success">/update.jsp</result>
</action> <action name="userUpdate" class="userUpdateAction">
<result name="success" type="redirectAction">/userQuery</result>
</action> </package>
</struts>
struts.xml
8、applicationContext.xml
spring 框架提供了多种数据源类,可以使用spring提供的DriverManagerDataSource类还可以使用第三方数据源,如C3P0的ComboPooledDataSource数据源类,注意相应的两个jar包c3p0-0.9.2.1.jar mchange-commons-java-0.2.3.4.jar.
Hibernate4已经完全实现自己的事物管理,所以spring4不提供HibernateDaoSupport和HibernateTemplete的支持。可以在应用程序的spring上下文中,像配置其他bean那样来配置HibernateSession工厂。如果要使用XML文件定义对象与数据库之间的映射,则需要在spring中配置LocalSessionFactoryBean。hibernateProperties属性配置了Hibernate如何进行操作的细节。"hibernate.current_session_context_class"是为当前Session提供一个策略,Session由org.springframework.orm.hibernate4.SpringSessionContext.currentSession得到。将sessionFactory注入到其他Bean中,如注入到DAO组件中,使其获得SessionFactory的引用后,就可以实现对数据库的访问。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd"> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/sklm?useUnicode=true&characterEncoding=UTF-8"></property>
<property name="user" value="root"></property>
<property name="password" value="123456"></property>
<property name="maxPoolSize" value="40"></property>
<property name="minPoolSize" value="1"></property>
<property name="initialPoolSize" value="2"></property>
<property name="maxIdleTime" value="20"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>cn/xyp/web/entity/User.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">true</prop>
<prop key="hibernate.temp.use_jdbc_metadata_defaults">false</prop>
<prop key="hibernate.current_session_context_class">org.springframework.orm.hibernate3.SpringSessionContext</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
</props>
</property>
</bean> <bean id="userDao" class="cn.xyp.web.dao.UserDAOImpl">
<!-- 构造方法注入会话工厂组件sessionFactory -->
<constructor-arg>
<ref bean="sessionFactory"/>
</constructor-arg>
</bean> <bean id="userService" class="cn.xyp.web.service.UserServiceImpl">
<!-- 设置注入DAO组件 -->
<property name="userDao" ref="userDao"></property>
</bean> <bean id="userRegisterAction" class="cn.xyp.web.action.UserRegisterAction">
<!-- 设置业务逻辑组件 -->
<property name="userService" ref="userService"></property>
</bean> <bean id="userLoginAction" class="cn.xyp.web.action.UserLoginAction">
<property name="userService" ref="userService"></property>
</bean> <bean id="userQueryAction" class="cn.xyp.web.action.UserQueryAction">
<property name="userService" ref="userService"></property>
</bean> <bean id="userDeleteAction" class="cn.xyp.web.action.UserDeleteAction">
<property name="userService" ref="userService"></property>
</bean> <bean id="userUpdateAction" class="cn.xyp.web.action.UserUpdateAction">
<property name="userService" ref="userService"></property>
</bean> <bean id="homeAction" class="cn.xyp.web.action.HomeAction"> </bean> </beans>
applicationContext.xml
9、jsp
(1)displayAll.jsp显示所有信息
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>显示会员信息</title>
</head>
<body> <h4>会员信息</h4>
<table border="1">
<tr>
<td>会员id</td><td>会员名</td><td>密码</td><td>会员年龄</td><td>会员性别</td><td>会员联系方式</td><td>会员地址</td><td>注册会员日期</td><td>删除</td><td>修改</td>
</tr>
<s:iterator value="#request.userList" id="user">
<tr>
<td><s:property value="#user.user_id"/></td>
<td><s:property value="#user.user_name"/></td>
<td><s:property value="#user.user_password"/></td>
<td><s:property value="#user.user_age"/></td>
<td><s:property value="#user.user_sex"/></td>
<td><s:property value="#user.user_phone"/></td>
<td><s:property value="#user.user_address"/></td>
<td><s:property value="#user.user_create_time"/></td> <td>
<a href="<s:url action="userDelete"><s:param name="id"><s:property value="#user.user_id"/></s:param></s:url>">删除</a>
</td>
<td>
<a href="<s:url action="userShow"><s:param name="id"><s:property value="#user.user_id"/></s:param></s:url>">修改</a>
</td> </tr>
</s:iterator>
</table>
<a href="register.jsp">返回注册页面</a> </body>
</html>
displayAll.jsp
(2) login.jsp用户登录
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>会员登陆</title>
</head>
<body> <s:form action="userLogin" method="post">
<s:textfield name="user.user_name" label="会员姓名:"></s:textfield>
<s:password name="user.user_password" label="会员口令:"></s:password>
<s:submit value="登 陆"></s:submit>
</s:form> </body>
</html>
login.jsp
(3)register.jsp用户注册
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>会员注册页面</title>
</head>
<body> <s:form action="userRegister" method="post">
<h4><s:text name="欢迎注册会员"></s:text></h4>
<s:property value="exception.message"/>
<s:textfield name="user.user_name" label="会员姓名 " tooltip="Enter your name!" required="true"></s:textfield>
<s:password name="user.user_password" label="会员口令 " tooltip="Enter your password!" required="true"></s:password>
<s:textfield name="user.user_age" label="年 龄 " required="true"></s:textfield>
<%-- <s:select name="user.user_sex" label="性 别" list="{'男','女'}" headKey="00" headValue="男" theme="simple" required="true"></s:select> --%>
<s:radio name="user.user_sex" label="性别" list="{'男','女'}" value="男"></s:radio>
<s:textfield name="user.user_address" label="会员住址 " required="true"></s:textfield>
<s:submit value="提 交"></s:submit>
</s:form> </body>
</html>
register.jsp
(4)update.jsp用户信息更改
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改会员信息</title>
</head>
<body> <s:form action="userUpdate" method="post">
<h4><s:text name="修改会员信息"></s:text></h4>
<s:actionerror/> <s:hidden name="user.user_id" value="%{user.user_id}"></s:hidden>
<s:textfield name="user.user_name" label="会员姓名:" tooltip="Enter your name!" required="true"></s:textfield>
<s:password name="user.user_password" label="会员口令:" tooltip="Enter your password!" required="true"></s:password>
<s:textfield name="user.user_age" label="年 龄:" required="true"></s:textfield>
<s:select name="user.user_sex" label="性 别:" list="{'男','女'}" headKey="00" headValue="男" theme="simple" required="true"></s:select>
<s:textfield name="user.user_address" label="会员住址:" required="true"></s:textfield>
<s:submit value="提 交"></s:submit>
</s:form> </body>
</html>
update.jsp
(5)welcome.jsp欢迎页面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>欢迎来到时空联盟</title>
<style type="text/css">
body{
background-image: url('WebContent/WEB-INF/img/shikong.png');
background-position: center top;
background-repeat: no-repeat; }
</style>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
welcome.jsp
本文参考自https://www.cnblogs.com/zhaozihan/p/5893785.html
ssh简单入门级案例教程的更多相关文章
- bootstrap-typeahead 自动补全简单的使用教程
参考链接: 参考1 : https://segmentfault.com/a/1190000006036166参考2 : https://blog.csdn.net/u010174173/articl ...
- ASP.NET MVC案例教程(二)
ASP.NET MVC案例教程(二) 让第一个页面跑起来 现在,我们来实现公告系统中的第一个页面——首页.它非常简单,只包括所有公告分类的列表,并且每个列表项是一个超链接.其中分类数据是用我们的Moc ...
- ASP.NET MVC案例教程(三)
ASP.NET MVC案例教程(二) 让第一个页面跑起来 现在,我们来实现公告系统中的第一个页面——首页.它非常简单,只包括所有公告分类的列表,并且每个列表项是一个超链接.其中分类数据是用我们的Moc ...
- 史上最简单的 GitHub 教程
史上最简单的 GitHub 教程 温馨提示:本系列博文已经同步到 GitHub,如有需要的话,欢迎大家到「github-tutorial」进行Star和Fork操作! 1 简介 GitHub 是一个面 ...
- GIS地理工具案例教程——批量合并影像-批量镶嵌栅格
GIS地理工具案例教程--批量合并影像-批量镶嵌栅格 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 关键词:批量.迭代.循环.自动.智能.地理 ...
- GIS地理工具案例教程——合并选中图层
GIS地理工具案例教程--合并选中图层 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 功能:并图层列表中 描述:对图层列表中选中图层进行合并. ...
- GIS地理工具案例教程——批量合并影像
GIS地理工具案例教程——批量合并影像 商务合作,科技咨询,版权转让:向日葵,135—4855__4328,xiexiaokui#qq.com 描述:合并目录下的所有影像 功能:对指定工作空间下的栅格 ...
- GIS地理工具案例教程——批量去除多边形的之间的间隙
GIS地理工具案例教程--批量去除多边形的之间的间隙 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 问题:几乎所有的手工生产的数据,都存在多边 ...
- GIS地理工具案例教程——批量去除多边形的重叠部分
GIS地理工具案例教程--批量去除多边形的重叠部分 商务合作,科技咨询,版权转让:向日葵,135-4855__4328,xiexiaokui#qq.com 问题:几乎所有的手工生产的数据,都存在多边形 ...
随机推荐
- Django:管理站点
1.自定义管理页面 自定义管理界面需要创建一个类,继承admin.ModelAdmin booktest/admin.py class BookInfoAdmin(admin.ModelAdmin): ...
- MySQL命令:增删与改
首先是对数据库的修改: --删除一个叫bbb111的数据库 DROP DATABASE bbb111; 对某数据库里一个表的修改: 重命名一张表 -- 三种效果一样的形式 RENAME TABLE 原 ...
- mysq数据库基本操作
MySQL的数据库名称,表名称是区分大小写,MySQL 的SQL keywords不区分大小写: if when you attempt to log in, you get an error mes ...
- git知识点
先说几个名词 未被追踪的文件:指的是新建的文件或文件夹且还没加入到暂存区(新建的还没有被git add 过得) 未加入到暂存区的文件:指的是已经被追踪过,但是没有加入到暂存区(已经执行过git add ...
- 转:Java 集合详解
原文地址:https://www.cnblogs.com/ysocean/p/6555373.html 一.集合的由来 通常,我们的程序需要根据程序运行时才知道创建多少个对象.但若非程序运行,程序开发 ...
- 在RAC执行相关操作发生ora-01031:insufficient privileges解决方法
grid用户下 寻找命令的路径 如which crsctl su - root用户 然后根据找到的路径去执行命令 如 /u01/app/oracle/product/11.2.0/db_1/bin/c ...
- kubernetes的Kubelet
1. kubelet简介 在kubernetes集群中,每个Node节点都会启动kubelet进程,用来处理Master节点下发到本节点的任务,管理Pod和其中的容器.kubelet会在API Ser ...
- Python 字符串常用方法总结
明确:对字符串的操作方法都不会改变原来字符串的值 1,去掉空格和特殊符号 name.strip() 去掉空格和换行符 name.strip('xx') 去掉某个字符串 name.lstrip() ...
- myeclipse项目导入到eclipse, HttpServletRequest报红现象
eclipse项目中关于导入的项目里提示HttpServletRequest 不能引用的解决办法 当使用eclipse导入外部的web工程时,有时会提示HttpServletRequest, Serv ...
- zabbix agentd安装
一.Linux客户端1.创建zabbix用户 groupadd zabbix useradd -g zabbix -M -s /sbin/nologin zabbix 2.解压agent包 zabbi ...