Maven整合SSM项目(七)中

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用版 2核4GB 50GB
简介: Maven整合SSM项目(七)

二.五 创建各个 配置文件,将各自框架的 配置信息放置进去


配置文件 要放置在 src/main/resources 里面。


20191031154947616.png


1 . 数据库 db.properties


jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=UTF-8
jdbc.username=root
jdbc.password=abc123


2 . 日志文件 log4j.properties


### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=info, stdout
## 配置MyBatis的级别
log4j.logger.com.yjl.mapper = debug


3 .mybatis 配置文件 SqlMapConfig.xml


<?xml version="1.0" encoding="UTF-8"?>
<!-- 引入约束 -->
<!DOCTYPE configuration  
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"  
  "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
  <settings>
    <!-- 设置配置文件 -->
    <!-- 开启二级缓存 -->
    <setting name="cacheEnabled" value="true"/>
    <!-- 控制懒加载的 -->
    <setting name="lazyLoadingEnabled" value="true"/>
    <setting name="aggressiveLazyLoading" value="false"/>
    <setting name="multipleResultSetsEnabled" value="true"/>
    <setting name="useColumnLabel" value="true"/>
    <setting name="useGeneratedKeys" value="false"/>
    <setting name="autoMappingBehavior" value="PARTIAL"/>
    <setting name="autoMappingUnknownColumnBehavior" value="WARNING"/>
    <setting name="defaultExecutorType" value="SIMPLE"/>
    <setting name="defaultStatementTimeout" value="25"/>
    <setting name="defaultFetchSize" value="100"/>
    <setting name="safeRowBoundsEnabled" value="false"/>
    <setting name="localCacheScope" value="SESSION"/>
    <setting name="jdbcTypeForNull" value="OTHER"/>
    <setting name="lazyLoadTriggerMethods" value="equals,clone,hashCode,toString"/>
    <!-- 设置日志为 log4j -->
    <setting name="logImpl" value="LOG4J"/>
  </settings>
  <!-- 配置别名 -->
  <typeAliases>
    <!-- 定义包的形式 ,可以多个-->
    <package name="com.yjl.pojo"/>
  </typeAliases>
  <!-- 放置在别名之后,环境之前 -->
  <plugins>
    <!-- 分页插件,引入拦截器 -->
    <plugin interceptor="com.github.pagehelper.PageInterceptor">
      <!-- 指定数据库为mysql,虽然会自动监测。 -->
      <property name="helperDialect" value="mysql"/>
    </plugin>
  </plugins>
</configuration>


4 . springmvc 的配置文件


<?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:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
        http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/aop
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd ">
  <!-- 配置的是注解的,重写视图解析器 -->
  <context:component-scan base-package="com.yjl.action"></context:component-scan>
  <!--配置静态资源 -->
  <mvc:resources location="/js/" mapping="/js/**"></mvc:resources>
  <mvc:resources location="/css/" mapping="/css/**"></mvc:resources>
  <mvc:resources location="/image/" mapping="/image/**"></mvc:resources>
  <!-- 设置fastjson的配置方案 -->
    <mvc:annotation-driven>
      <!-- 设置不使用默认的消息转换器 -->
        <mvc:message-converters register-defaults="false">
          <!-- 配置Spring的转换器 -->
          <bean class="org.springframework.http.converter.StringHttpMessageConverter"/>
        <bean class="org.springframework.http.converter.xml.XmlAwareFormHttpMessageConverter"/>
        <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter"/>
        <bean class="org.springframework.http.converter.BufferedImageHttpMessageConverter"/>
            <!-- 配置fastjson中实现HttpMessageConverter接口的转换器 -->
            <bean id="fastJsonHttpMessageConverter" 
              class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
                <!-- 加入支持的媒体类型:返回contentType -->
                <property name="supportedMediaTypes">
                    <list>
                        <!-- 这里顺序不能反,一定先写text/html,不然ie下会出现下载提示 -->
                       <value>text/html;charset=UTF-8</value>
                        <value>application/json;charset=UTF-8</value>
                    </list>
                </property>
         <!-- 可添加其他的属性来扩展功能,如日期 -->
                 <property name="features">
                    <list>
                    <!-- 默认的意思就是不配置这个属性,配置了就不是默认了 -->
                       <!-- 是否输出值为null的字段 ,默认是false-->
                        <value>WriteMapNullValue</value>
                        <value>WriteNullNumberAsZero</value>
                        <value>WriteNullListAsEmpty</value>
                        <value>WriteNullStringAsEmpty</value>
                        <value>WriteNullBooleanAsFalse</value>
                        <value>WriteDateUseDateFormat</value>
                    </list>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>
  <!-- 视图解析器 -->
  <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <!-- 前缀 -->
    <property name="prefix" value="/WEB-INF/jsp/"></property>
    <!-- 后缀 -->
    <property name="suffix" value=".jsp"></property>
  </bean>
</beans>


5 . spring 的配置文件dao 层 applicationContext-dao.xml


<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
    http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.2.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
  <!-- 加载db.properties文件中的内容,db.properties文件中key命名要有一定的特殊规则 -->
  <context:property-placeholder location="classpath:db.properties" />
  <!-- 配置数据源 ,dbcp -->
  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="${jdbc.driverClassName}"/>
        <property name="jdbcUrl" value="${jdbc.url}"/>
        <property name="user" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>
  <!-- sqlSessionFactory -->
  <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <!-- 数据库连接池 -->
    <property name="dataSource" ref="dataSource" />
    <!-- 加载mybatis的全局配置文件 -->
    <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" />
  </bean>
  <!-- mapper扫描器 -->
  <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <!-- 扫描包路径,如果需要扫描多个包,中间使用半角逗号隔开 -->
    <property name="basePackage" value="com.yjl.mapper"></property>
    <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
  </bean>
</beans>


6 . springmvc 的配置文件 tx 事务层 applicationContext-tx.xml


<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
    http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.2.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<!-- 事务管理器 
  对mybatis操作数据库事务控制,spring使用jdbc的事务控制类
-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  <!-- 数据源
  dataSource在applicationContext-dao.xml中配置了
   -->
  <property name="dataSource" ref="dataSource"/>
</bean>
<!-- 通知 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
  <tx:attributes>
    <!-- 传播行为 -->
    <!--列举常见的方法形式-->
          <tx:method name="insert*" propagation="REQUIRED" />  
          <tx:method name="update*" propagation="REQUIRED" />  
          <tx:method name="edit*" propagation="REQUIRED" />  
          <tx:method name="save*" propagation="REQUIRED" />  
          <tx:method name="add*" propagation="REQUIRED" />  
          <tx:method name="new*" propagation="REQUIRED" />  
          <tx:method name="set*" propagation="REQUIRED" />  
          <tx:method name="remove*" propagation="REQUIRED" />  
          <tx:method name="delete*" propagation="REQUIRED" />  
          <tx:method name="change*" propagation="REQUIRED" />  
          <tx:method name="get*" propagation="REQUIRED" read-only="true" />  
          <tx:method name="find*" propagation="REQUIRED" read-only="true" />  
          <tx:method name="count*" propagation="REQUIRED" read-only="true" />  
          <tx:method name="load*" propagation="REQUIRED" read-only="true" />  
          <tx:method name="*" propagation="REQUIRED" read-only="true" />  
  </tx:attributes>
</tx:advice>
<!-- aop -->
<aop:config>
  <aop:advisor advice-ref="txAdvice" pointcut="execution(* com.yjl.service.impl.*.*(..))"/>
</aop:config>
</beans>


7 . spring的业务 层 applicationContext-service.xml


<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-3.2.xsd 
    http://www.springframework.org/schema/mvc 
    http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd 
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context-3.2.xsd 
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop-3.2.xsd 
    http://www.springframework.org/schema/tx 
    http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<!--添加事务-->
<!-- 
<context:component-scan base-package="com.yjl.action"></context:component-scan>
 -->
<bean id="userService" class="com.yjl.service.impl.UserServiceImpl"></bean>
</beans>


二.六 web.xml 核心配置 WEB-INF 文件下


web.xml


<!-- 启动spring -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:spring/applicationContext-*.xml</param-value>
  </context-param>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <!-- 乱码过滤器 -->
  <filter>
    <filter-name>EncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.CharacterEncodingFilter
    </filter-class>
    <init-param>
      <param-name>encoding</param-name>
      <param-value>utf-8</param-value>
    </init-param>
    <init-param>
      <param-name>forceEncoding</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>EncodingFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!-- 隐藏域方法 -->
  <filter>
    <filter-name>hiddenHttpMethodFilter</filter-name>
    <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>hiddenHttpMethodFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!--前端控制 器 -->
  <servlet>
    <servlet-name>springMVC</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:spring/springmvc.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>springMVC</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>


二.八 service层及其实现类 UserServiceImpl


UserService.java 接口: 基本与 UserMapper.java 接口一致


package com.yjl.service;
import java.util.List;
import com.yjl.pojo.User;
import com.yjl.pojo.UserExample;
/**
 @author:岳泽霖
 @date: 2019年9月9日 下午7:40:35
 @Description 类的相关描述
*/
public interface UserService {
    int countByExample(UserExample example);
    int deleteByExample(UserExample example);
    int deleteByPrimaryKey(Integer id);
    int insert(User record);
    int insertSelective(User record);
    List<User> selectByExample(UserExample example);
    User selectByPrimaryKey(Integer id);
    int updateByExampleSelective( User record,UserExample example);
    int updateByExample(User record, UserExample example);
    int updateByPrimaryKeySelective(User record);
    int updateByPrimaryKey(User record);
    //根据sql语句进行相应的查询
  List<User> pageExample(int limit, int offset);
}


UserServiceImpl.java 实现类


package com.yjl.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.yjl.mapper.UserMapper;
import com.yjl.pojo.User;
import com.yjl.pojo.UserExample;
import com.yjl.service.UserService;
/**
 @author:岳泽霖
 @date: 2019年9月9日 下午7:40:49
 @Description 类的相关描述  
*/
//注意,此时用的是注解的形式
@Service
public class UserServiceImpl implements UserService{
  @Autowired
  private UserMapper userMapper;
  @Override
  public int countByExample(UserExample example) {
    return userMapper.countByExample(example);
  }
  @Override
  public int deleteByExample(UserExample example) {
    return userMapper.deleteByExample(example);
  }
  @Override
  public int deleteByPrimaryKey(Integer id) {
    return userMapper.deleteByPrimaryKey(id);
  }
  @Override
  public int insert(User record) {
    return userMapper.insert(record);
  }
  @Override
  public int insertSelective(User record) {
    return userMapper.insertSelective(record);
  }
  @Override
  public List<User> selectByExample(UserExample example) {
    return userMapper.selectByExample(example);
  }
  @Override
  public User selectByPrimaryKey(Integer id) {
    return userMapper.selectByPrimaryKey(id);
  }
  @Override
  public int updateByExampleSelective(User record, UserExample example) {
    return userMapper.updateByExampleSelective(record,example);
  }
  @Override
  public int updateByExample(User record, UserExample example) {
    return userMapper.updateByExample(record,example);
  }
  @Override
  public int updateByPrimaryKeySelective(User record) {
    return userMapper.updateByPrimaryKeySelective(record);
  }
  @Override
  public int updateByPrimaryKey(User record) {
    return userMapper.updateByPrimaryKey(record);
  }
  @Override
  public List<User> pageExample(int page, int rowNum) {
    PageHelper.startPage(page, rowNum);
    UserExample example=new UserExample();
    return userMapper.selectByExample(example);
  }
}


二.九 UserAction 控制类


package com.yjl.action;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yjl.pojo.User;
import com.yjl.service.UserService;
/**
@atuhor:岳泽霖
@Description: 类描述
*/
@Controller
@RequestMapping(value="/user")
public class UserAction {
  @Autowired
  private UserService userService;
  //转到登录的页面
  @RequestMapping(value="toLogin")
  public String toLogin(Model model){
    model.addAttribute("user",new User());
    return "user/login";
  }
  //一定不要忘记添加 produces 属性。  添加时,方法为POST
  @RequestMapping(value="add",method=RequestMethod.POST,produces={"application/json"})
  public @ResponseBody Map<String,Object> add(User user){
    userService.insert(user);
    Map<String,Object> resultMap=new HashMap<String,Object>();
    resultMap.put("request_status",true);
    return resultMap;
  }
  //修改时,方法为PUT   
  @RequestMapping(value="edit/{id}",method=RequestMethod.PUT,produces={"application/json"})
  public @ResponseBody Map<String,Object> edit(User user){
    userService.updateByPrimaryKeySelective(user);
    Map<String,Object> resultMap=new HashMap<String,Object>();
    resultMap.put("request_status",true);
    return resultMap;
  }
  //删除时,方法用DELETE
  @RequestMapping(value="deleteById/{id}",method=RequestMethod.DELETE,produces={"application/json"})
  public @ResponseBody Map<String,Object> deleteById(@PathVariable(value="id") int id){
    userService.deleteByPrimaryKey(id);
    Map<String,Object> resultMap=new HashMap<String,Object>();
    resultMap.put("request_status",true);
    return resultMap;
  }
  //查询时,用GET
  @RequestMapping(value="findById/{id}",method=RequestMethod.GET,produces={"application/json"})
  public @ResponseBody Map<String,Object> findById(@PathVariable(value="id") int id){
    User user=userService.selectByPrimaryKey(id);
    Map<String,Object> resultMap=new HashMap<String,Object>();
    resultMap.put("request_status",true);
    resultMap.put("user",user);
    return resultMap;
  }
  //查询时,用GET
  @RequestMapping(value="findAll",method=RequestMethod.GET,produces={"application/json"})
  public @ResponseBody Map<String,Object> findAll(){
    List<User> userList=userService.pageExample(1,10);
    Map<String,Object> resultMap=new HashMap<String,Object>();
    resultMap.put("request_status",true);
    resultMap.put("userList",userList);
    return resultMap;
  }
}


二.十 前端页面 login.jsp


在WEB-INF 下创建 jsp/user/ login.jsp 页面。 不要忘记在 js里面放置 jquery.js


20191031155040198.png


login.jsp 页面:


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-2.1.1.min.js"></script>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<title>展示</title>
</head>
<body>
  <h2>两个蝴蝶飞,Maven整合SSM框架使用</h2>
  <form:form commandName="user" type="post">
    <button type="button" id="add" onclick="addJson()">添加</button><br/>
    <button type="button" id="edit" onclick="editJson()">修改</button><br/>
    <button type="button" id="delete" onclick="delJson()">删除</button><br/>
    <button type="button" id="findById" onclick="findByIdJson()">查询id></button><br/>
    <button type="button" id="findAll" onclick="findAllJson()">查询全部</button><br/>
    <div id="showId"> 展示的信息</div>
  </form:form>
  <script>
  function addJson(){
    jsonAjax("add","add","id=10&name=精灵妹&password=1234&sex=女&age=24&description=一个快乐的精灵&_method=POST");
  }
  function editJson(){
    jsonAjax("edit","edit/10","id=10&name=精灵妹&description=一个快乐的精灵哈哈&_method=PUT");    
    }
  function delJson(){
    jsonAjax("delete","deleteById/10","_method=DELETE");
  }
  function findByIdJson(){
    jsonAjax("findById","findById/10","_method=GET");
  }
  function findAllJson(){
    jsonAjax("findAll","findAll","_method=GET");
  }
  function jsonAjax(sign,url,data){
    var message="";
    switch(sign){
      case "add":{
        message="添加成功";
        break;
      }
      case "edit":{
        message="修改成功";
        break;
      }
      case "delete":{
        message="删除成功";
        break;
      }
      case "findById":{
        message="查询单个成功";
        break;
      }
      case "findAll":{
        message="查询全部成功";
        break;
      }
    }
    $.ajax({
      type:"post", 
      url:url,  //注意请求路径
      data:data,
      success:function(resultData){
        if(resultData.request_status){
          //清空
          $("#showId").empty();
          //追加
          $("#showId").append(message+"<br/>");
          if(sign=="findById"){
            var data=resultData.user;
            var str="<table><tr><th>编号</th><th>姓名</th><th>描述</th></tr>";
            str+="<tr>"; 
            str+="<td>"+data.id+"</td>"; 
            str+="<td>"+data.name+"</td>"; 
            str+="<td>"+data.description+"</td>"; 
            str+="</tr>"; 
            str+="</table>";
            $("#showId").append(str);
          }
          if(sign=="findAll"){
            var data=resultData.userList;
            var str="<table><tr><th>编号</th><th>姓名</th><th>描述</th></tr>";
            $.each(data,function(idx,item){ 
              str+="<tr>"; 
              str+="<td>"+item.id+"</td>"; 
              str+="<td>"+item.name+"</td>"; 
              str+="<td>"+item.description+"</td>"; 
              str+="</tr>"; 
            }) 
            str+="</table>";
            $("#showId").append(str);
          }
        }
      }
    })
  }
  </script>
</body>
</html>



相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
7天前
|
Java Apache Maven
Maven 项目文档
在`C:/MVN/consumerBanking`中创建Maven Java项目,使用命令`mvn archetype:generate`生成基础结构。确保`pom.xml`包含`maven-site-plugin`和`maven-project-info-reports-plugin`,版本至少为3.3和2.7,以避免`NoClassDefFoundError`。运行`mvn site`生成文档。
|
7天前
|
Java Apache Maven
Maven 项目文档
在`C:/MVN/consumerBanking`,使用`mvn archetype:generate`命令创建Java项目后,确保更新`pom.xml`,添加`maven-site-plugin`和`maven-project-info-reports-plugin`,至少版本3.3和2.7。运行`mvn site`时遇到`NoClassDefFoundError`,需升级`maven-site-plugin`至3.3以上以解决。
|
2天前
|
存储 安全 Java
2024ide构建maven项目是总是卡在解析Maven依赖项目 加速方案
2024ide构建maven项目是总是卡在解析Maven依赖项目 加速方案
12 4
2024ide构建maven项目是总是卡在解析Maven依赖项目 加速方案
|
2天前
|
Java Apache Maven
Maven 项目文档
使用Maven创建`consumerBanking`项目,执行`mvn archetype:generate`命令初始化。确保`pom.xml`包含`maven-site-plugin`至少版本3.3和`maven-project-info-reports-plugin`至少版本2.7,以避免NoClassDefFoundError。升级插件解决文档构建问题。
|
2天前
|
Java Maven
Maven项目打包成jar项目后运行报错误: 找不到或无法加载主类 Main.Main 和 jar中没有主清单属性解决方案
Maven项目打包成jar项目后运行报错误: 找不到或无法加载主类 Main.Main 和 jar中没有主清单属性解决方案
9 0
|
2天前
|
缓存 Java Maven
IDEA如何把MAVEN项目打包成jar包并且用命令行启动
IDEA如何把MAVEN项目打包成jar包并且用命令行启动
8 0
|
5天前
|
前端开发 Java
基于SSM框架的手机商城项目
基于SSM框架的手机商城项目
11 0
|
5天前
|
前端开发 JavaScript Java
杨校老师项目之基于SSM大学生创新创业项目管理系统
杨校老师项目之基于SSM大学生创新创业项目管理系统
17 0
|
5天前
|
前端开发 Java 关系型数据库
杨校老师项目之基于SSM企业物流快递配送管理系统
杨校老师项目之基于SSM企业物流快递配送管理系统
18 0
|
5天前
|
前端开发 Java 关系型数据库
杨校老师项目之基于SSM社区疫情防控人员访客登记报备平台
杨校老师项目之基于SSM社区疫情防控人员访客登记报备平台
10 0

推荐镜像

更多