CMS-day02

cms-day02

1、富文本框

1.1、传值到前台

让图片描述内容,隐藏的输入框来接收输入的内容然后将其内容返回给前台

<input type="hidden" id="txtIntro" name="intro" />
...
<script type="text/javascript">
		var E = window.wangEditor
			//获取到咱们的编辑器位置
			var editor = new E('#intro');
			//获到取相应的元素(提交的intro元素)
			var txtIntro = $('#txtIntro');
			//监听编辑器的修改事件(html就是编辑器中的内容)
			editor.customConfig.onchange = function(html) {
				//把富文框的内容放进去
				txtIntro.val(html);
			}
			editor.create();
	</script>

1.2、内容回显

  • 需要保存的是被选中的那一个input加上checked属性
  • 富文本框的回显
<input type="hidden" id="txtIntro" name="intro" />
...
<script type="text/javascript">
		var E = window.wangEditor
		//获取到咱们的编辑器位置
		var editor = new E('#intro');
		//获到取相应的元素(提交的intro元素)
		var txtIntro = $('#txtIntro');
		//监听编辑器的修改事件(html就是编辑器中的内容)
		editor.customConfig.onchange = function(html) {
			//把富文框的内容放进去
			txtIntro.val(html);
		}
		editor.create();
		editor.txt.html('${img.intro}');
		txtIntro.val(editor.txt.html());
</script>

2、前端页面展示与图片轮播

  • 去从后台拿到所有图片
  • 把图片在相应的轮播位置进行循环
  • 注意: 要保证第一个图片有.active样式的
<!-- varStatus[LoopTagSupport]:每次循环的状态(包含下标,次数,...) -->
 <c:forEach items="${imgs}" var="img" varStatus="s">
	<div class="item 
		<c:if test="${s.index==0}">
			active
		</c:if>
	">
		<img src="${img.storepath}" style="max-height: 500px;width:100%;" alt="码农">
		<div class="carousel-caption">
			${img.intro}
		</div>
	</div>
</c:forEach>

3、分页查询

3.1、真假分页

  • 真分页(limit):匀速,用户体验还可以,用得多一点
  • 假分页(内存中):每一次非常慢(后面就快),还会占内存

3.2、设计一个分页对象

/**
 * 分页对象
 * @author Administrator
 *
 */
public class PageList<T> {

	//当前页 -> 前台传过来
	private int currentPage = 1;
	//每页条数 -> 前台传过来/自己定义
	private int pageSize = 10;
	//首页(第一页)
	private int firstPage = 1;
	//上一页 计算出来  currentPage>1?currentPage-1:1
	private int prevPage;
	//下一页 计算出来 currentPage<lastPage?currentPage+1:lastPage
	private int nextPage;
	//尾页 == 总页数 
	private int lastPage;
	//总页数 计算出来 totalCount%pageSize==0?totalCount/pageSize:totalCount/pageSize+1
	private int totalPage;
	//总条数 -> 数据库中查询出来
	private int totalCount;
	//当前页的数据 -> 数据库中查询出来
	private List<T> data = new ArrayList<>();
	
	
	public PageList(){}
	/**
	 * @param currentPage:前台传过来
	 * @param pageSize:前台传过来
	 * @param totalCount:数据库中查询
	 * @param data:数据库中查询
	 */
	public PageList(int currentPage, int pageSize, int totalCount, List<T> data) {
		this.currentPage = currentPage;
		this.pageSize = pageSize;
		this.totalCount = totalCount;
		this.data = data;
		//计算上一页  当前页>1 ? 当前页-1 : 1
		this.prevPage = this.currentPage>1 ? this.currentPage-1 : 1;
		//计算总页数 总条数%每页条数==0? 总条数/每页条数:总条数/每页条数+1
		this.totalPage = this.totalCount%this.pageSize==0?this.totalCount/this.pageSize:this.totalCount/this.pageSize+1;
		this.lastPage = this.totalPage; //最后一页就是总页数
		//计算下一页 当前页<总页数?当前页+1:总页数;
		this.nextPage = this.currentPage<this.totalPage?this.currentPage+1:this.totalPage;
	}
	//getter,setter省略
	
}

3.3、设计SQL条件对象

  • 接收前台传过来的分页条件(currentPage,pageSize)
public class SqlCondition {
	//当前页
	private int currentPage = 1;
	//每页条数
	private int pageSize = 10;
	//getter,setter省略
}	

3.4、在dao层中完成方法

  • 根据条件查询到数据,封装成PageList对象 返回
/**
 * 最后返回的是PageList对象,里面都要有值
 * 	 	PageList(int currentPage, int pageSize, int totalCount, List<T> data)
 */
@Override
public PageList<Images> queryAll(SqlCondition condition) {
	//①.拿到当前页与每页条数
	int currentPage = condition.getCurrentPage();
	int pageSize = condition.getPageSize();
	//一.查询总条数
	//1.1 准备查询总条数的sql
	String sql = "select count(*) from t_image";
	//1.2执行sql拿到总条数
	Integer totalCount = jdbcTemplate.queryForObject(sql, Integer.class);
	//二.查询当前页的数据
	//2.1 计算当前页是从第几条数据开始的
	int beginIndex = (currentPage-1) * pageSize;
	//2.2 准备相应的SQL
	String dataSql = "select * from t_image limit "+beginIndex+","+pageSize;
	//2.3 执行查询功能
	List<Images> data= jdbcTemplate.query(dataSql, new BeanPropertyRowMapper<>(Images.class));
	
	//三.创建PageList对象并且返回
	PageList pageList = new PageList(currentPage,pageSize,totalCount,data);
	return pageList;
}

3.5、在controller层中修改方法

  • controller中的修改
@RequestMapping("/query")
public String query(SqlCondition condition,Model model){
	model.addAttribute("pageList",imageService.queryAll(condition));
	return "main";
}

3.6、在前台页面展示

  • 页面中的展示(循环的是pageList.data)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CMS32L032 RST 端口复用是指利用CMS32L032芯片上的RST引脚进行端口复用的技术。具体来说,CMS32L032芯片上的RST引脚可以在不影响芯片正常复位功能的情况下,通过特定的电路设计和编程设置,实现将RST引脚用作其他功能的输入输出端口。这样就可以通过该引脚与其他设备或模块进行通信或控制。 引用中提到的TCP SYN扫描是一种常见的端口扫描技术,它通过发送SYN报文并等待响应来确定目标端口的状态。如果收到SYN/ACK响应,表示该端口在监听状态,而如果收到RST响应,表示该端口没有监听。而引用中提到的端口635是Linux的mountd服务使用的端口,它是一个流行的扫描目标。引用中提到的端口135是Microsoft的DCE RPC end-point mapper服务使用的端口,用于注册服务的位置。 综合以上引用内容,CMS32L032 RST 端口复用可能是指使用CMS32L032芯片的RST引脚来实现端口的复用功能,通过特定的电路设计和编程设置来实现与其他设备或服务的通信或控制。请注意,这只是一种推测,具体情况可能需要进一步的信息来确认。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [信安学习---day21-25](https://blog.csdn.net/ekko_jay/article/details/128008695)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [软件测试肖sir__接口测试之基本介绍(2)](https://blog.csdn.net/m0_47403059/article/details/121456595)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值