一. get.jsp
<%@ page contentType="text/html;charset=UTF-8"%><%@ page import="com.XX.redisUtil"%><% String topicId = request.getParameter("topicId"); if (topicId != null && !topicId.equals("")) { String key = "AAAA:" + topicId; out.println("[" + key + "]="); out.println("" + redisUtil.get(key) + ""); }%>
二. set.jsp
<%@ page contentType="text/html;charset=UTF-8"%><%@ page import="com.XXX.redisUtil"%><% String key = request.getParameter("key"); String value = request.getParameter("value"); if (key != null && !key.equals("")) { String ret = redisUtil.setex(key, 3600, value); out.println("" + ret + ""); out.println("[" + key + "]="); out.println("" + redisUtil.get(key) + ""); }%>