forked from p4fmevgyr/XYSH
Compare commits
22 Commits
Author | SHA1 | Date |
---|---|---|
|
f17b613e9b | 2 years ago |
|
36a9e65f79 | 2 years ago |
|
2a6791e0f8 | 2 years ago |
|
ca209e26d3 | 2 years ago |
|
3f1329d342 | 2 years ago |
|
98f362486d | 2 years ago |
|
1386ee0859 | 2 years ago |
|
fe35e2ed6a | 2 years ago |
|
1c7cf1b777 | 2 years ago |
|
9c3c368a53 | 2 years ago |
|
4fa6203ef9 | 2 years ago |
|
4086f9d458 | 2 years ago |
|
2b76373e1b | 2 years ago |
|
ac2c42e4c1 | 2 years ago |
|
f20f6b6166 | 2 years ago |
|
bb1f608e18 | 2 years ago |
|
e46b5ab04b | 2 years ago |
|
71af896289 | 2 years ago |
|
89f58dfe90 | 2 years ago |
|
f1ae4450a7 | 2 years ago |
|
5dce8cb59e | 2 years ago |
|
8c953cd34e | 2 years ago |
@ -0,0 +1,22 @@
|
||||
package com.controller.admin;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.po.Auser;
|
||||
import com.service.admin.AdminService;
|
||||
@Controller
|
||||
public class AdminController {
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
@RequestMapping("/admin")
|
||||
public String toLogin(@ModelAttribute Auser auser) {
|
||||
return "admin/login";
|
||||
}
|
||||
@RequestMapping("admin/login")
|
||||
public String login(@ModelAttribute Auser auser, Model model, HttpSession session) {
|
||||
return adminService.login(auser, model, session);
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.controller.admin;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.service.admin.AdminEmailAndUserService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin")
|
||||
public class AdminEmailAndUserController extends BaseController{
|
||||
@Autowired
|
||||
private AdminEmailAndUserService adminEmailAndUserService;
|
||||
@RequestMapping("/selectEmail")
|
||||
public String selectAllEmail(Model model) {
|
||||
return adminEmailAndUserService.selectAllEmail(model);
|
||||
}
|
||||
@RequestMapping("/delete")
|
||||
public String delete(Integer id) {
|
||||
return adminEmailAndUserService.delete(id);
|
||||
}
|
||||
@RequestMapping("/selectUser")
|
||||
public String selectUser(Model model) {
|
||||
return adminEmailAndUserService.selectBuserEmail(model);
|
||||
}
|
||||
@RequestMapping("/lock")
|
||||
public String lock(Integer id) {
|
||||
return adminEmailAndUserService.lock(id);
|
||||
}
|
||||
@RequestMapping("/unLock")
|
||||
public String unLock(Integer id) {
|
||||
return adminEmailAndUserService.unLock(id);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.controller.before;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
|
||||
import com.exception.UserLoginNoException;
|
||||
@Controller
|
||||
public class BaseBeforeController {
|
||||
/**
|
||||
* 前台用户登录权限控制,处理方法执行前执行该方法
|
||||
* @throws UserLoginNoException
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void isLogin(HttpSession session, HttpServletRequest request) throws UserLoginNoException {
|
||||
if(session.getAttribute("emailuser") == null){
|
||||
throw new UserLoginNoException("没有登录");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.controller.admin;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
|
||||
import com.exception.AdminLoginNoException;
|
||||
@Controller
|
||||
public class BaseController {
|
||||
/**
|
||||
* 登录权限控制,处理方法执行前执行该方法
|
||||
* @throws AdminLoginNoException
|
||||
*/
|
||||
@ModelAttribute
|
||||
public void isLogin(HttpSession session, HttpServletRequest request) throws AdminLoginNoException {
|
||||
if(session.getAttribute("auser") == null){
|
||||
throw new AdminLoginNoException("没有登录");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.forum.dao.CommentDao">
|
||||
|
||||
|
||||
<resultMap id="comment" type="Comment">
|
||||
<id property="id" column="cid"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="userComment" column="usercomment"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="forumId" column="forum_id"/>
|
||||
<association property="forum" javaType="Forum">
|
||||
<id property="id" column="id"/>
|
||||
</association>
|
||||
</resultMap>
|
||||
<delete id="delById">
|
||||
delete from comment where id=#{id}
|
||||
</delete>
|
||||
|
||||
<select id="findByForumIdAndParentCommentNull" resultMap="comment">
|
||||
select c.id cid,c.username,c.email,c.content,c.avatar,
|
||||
c.create_time,c.forum_id,c.parent_comment_id
|
||||
from comment c, forum b
|
||||
where c.forum_id = b.id and c.forum_id = #{forumId}
|
||||
order by c.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="saveComment" parameterType="Comment">
|
||||
insert into comment (username,email,content,avatar,
|
||||
create_time,forum_id,parent_comment_id, usercomment)
|
||||
values (#{username},#{email},#{content},#{avatar},
|
||||
#{createTime},#{forumId},#{parentCommentId}, #{userComment});
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="findByParentCommentId" resultMap="comment">
|
||||
select c.id cid, c.username, c.email, c.content, c.avatar,
|
||||
c.create_time, c.forum_id, c.parent_comment_id
|
||||
from comment c
|
||||
where c.parent_comment_id = #{parentCommentId}
|
||||
</select>
|
||||
|
||||
<select id="getAllComment" resultType="com.forum.entity.Comment">
|
||||
select id,username,email,content,create_time from comment
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,106 @@
|
||||
package com.controller.before;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.po.Email;
|
||||
import com.service.before.EmailService;
|
||||
import com.util.MyUtil;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/email")
|
||||
public class EmailController extends BaseBeforeController{
|
||||
@Autowired
|
||||
private EmailService emailService;
|
||||
/**
|
||||
* 写信
|
||||
*/
|
||||
@RequestMapping("/write")
|
||||
public String write(Email myemail, Model model, HttpServletRequest request, HttpSession session) {
|
||||
return emailService.write(myemail,model,request,session);
|
||||
}
|
||||
/**
|
||||
* 回复初始化
|
||||
*/
|
||||
@RequestMapping("/reEmailInit")
|
||||
public String reEmailInit(Integer id, Model model, HttpSession session) {
|
||||
return emailService.reEmailInit(id, model);
|
||||
}
|
||||
/**
|
||||
* 收信
|
||||
*/
|
||||
@RequestMapping("/recieve")
|
||||
public String recieve(Model model, HttpSession session) {
|
||||
return emailService.recieve(model, session);
|
||||
}
|
||||
/**
|
||||
* 已发送
|
||||
*/
|
||||
@RequestMapping("/send")
|
||||
public String send(Model model, HttpSession session) {
|
||||
return emailService.send(model, session);
|
||||
}
|
||||
/**
|
||||
* 打开信件看详情
|
||||
*/
|
||||
@RequestMapping("/detail")
|
||||
public String detail(Model model, Integer id) {//id接收参数id
|
||||
return emailService.detail(model, id);
|
||||
}
|
||||
/**
|
||||
* 删除一个邮件
|
||||
*/
|
||||
@RequestMapping("/deleteOne")
|
||||
public String deleteOne(Integer id) {//id接收参数id
|
||||
return emailService.deleteOne(id);
|
||||
}
|
||||
/***
|
||||
* 删除多个邮件
|
||||
*/
|
||||
@RequestMapping("/deleteMore")
|
||||
public String deleteMore(Integer ids[]) {//id接收参数id
|
||||
return emailService.deleteMore(ids);
|
||||
}
|
||||
/**
|
||||
* 下载附件,该方法不访问数据库,故只写控制层
|
||||
*/
|
||||
@RequestMapping("/down")
|
||||
public String down(String fileid, HttpServletRequest request, HttpServletResponse response) {//fileid接收参数fileid
|
||||
String aFilePath = null; //要下载的文件路径
|
||||
FileInputStream in = null; //输入流
|
||||
ServletOutputStream out = null; //输出流
|
||||
try {
|
||||
//从workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps下载
|
||||
aFilePath = request.getServletContext().getRealPath("uploadfiles");
|
||||
//设置下载文件使用的报头
|
||||
response.setHeader("Content-Type", "application/x-msdownload" );
|
||||
response.setHeader("Content-Disposition", "attachment; filename="
|
||||
+ MyUtil.toUTF8String(fileid));
|
||||
// 读入文件
|
||||
in = new FileInputStream(aFilePath + "\\"+ fileid);
|
||||
//得到响应对象的输出流,用于向客户端输出二进制数据
|
||||
out = response.getOutputStream();
|
||||
out.flush();
|
||||
int aRead = 0;
|
||||
byte b[] = new byte[1024];
|
||||
while ((aRead = in.read(b)) != -1 & in != null) {
|
||||
out.write(b,0,aRead);
|
||||
}
|
||||
out.flush();
|
||||
in.close();
|
||||
out.close();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.forum.dao.LinkDao">
|
||||
|
||||
|
||||
|
||||
|
||||
<insert id="saveLink" parameterType="Link">
|
||||
insert into link(name ,address,create_time) values (#{name},#{address},#{createTime});
|
||||
</insert>
|
||||
|
||||
|
||||
|
||||
<delete id="deleteLink">
|
||||
delete from link where id = #{id}
|
||||
</delete>
|
||||
<select id="getAllLink" resultType="Link">
|
||||
select id,name,address,create_time from link
|
||||
</select>
|
||||
<select id="countLink" resultType="java.lang.Integer">
|
||||
select count(*) from link
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.forum.dao.MessageDao">
|
||||
|
||||
|
||||
|
||||
<resultMap id="messages" type="message">
|
||||
<id property="id" column="id"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="msg_avatar" column="msg_avatar"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
|
||||
<collection property="replies" ofType="reply">
|
||||
<id property="id" column="rid"/>
|
||||
<result property="content" column="con"/>
|
||||
<!-- <result property="reply_name" column="reply_name"/>-->
|
||||
<result property="names" column="names"/>
|
||||
<result property="createTime" column="ctime"/>
|
||||
<result property="avatar" column="avatar"/>
|
||||
<result property="mes_id" column="mes_id"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<delete id="deleteById">
|
||||
delete from message where id=#{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="findAllMessage" resultMap="messages">
|
||||
select m.*,
|
||||
r.id rid,
|
||||
r.content con,
|
||||
r.names names,
|
||||
r.create_time ctime,
|
||||
r.avatar,
|
||||
r.mes_id
|
||||
from message m left join reply r on r.mes_id=m.id
|
||||
order by m.create_time desc
|
||||
</select>
|
||||
<select id="getIndexMessage" resultMap="messages">
|
||||
select m.*
|
||||
from message m
|
||||
order by m.create_time desc
|
||||
limit 0,6
|
||||
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
<select id="findAll" resultType="com.forum.entity.Message">
|
||||
select id,content,name, create_time from message
|
||||
</select>
|
||||
|
||||
<insert id="saveMessage" parameterType="message">
|
||||
insert into message (content,name,create_time,msg_avatar)
|
||||
values (#{content},#{name},#{createTime},#{msg_avatar})
|
||||
</insert>
|
||||
|
||||
<insert id="saveReplyMessage" parameterType="reply">
|
||||
insert into reply (content,names,create_time,mes_id,avatar)
|
||||
values (#{content},#{names},#{createTime},#{mes_id},#{avatar})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.forum.dao.NoticeDao">
|
||||
<select id="findAllNotice" resultType="notice">
|
||||
select * from notice
|
||||
</select>
|
||||
<select id="countNotice" resultType="java.lang.Integer">
|
||||
select count(*) from notice
|
||||
</select>
|
||||
|
||||
<insert id="addNotices" parameterType="notice">
|
||||
insert into notice(content) values(#{content})
|
||||
</insert>
|
||||
|
||||
<delete id="deleteNotice" parameterType="int">
|
||||
delete from notice where id=#{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.forum.dao.ReplyDao">
|
||||
<delete id="del">
|
||||
delete from reply where id=#{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="findAll" resultType="com.forum.entity.Reply">
|
||||
select id,content,names ,create_time from reply
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,49 @@
|
||||
package com.controller.before;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.po.Buser;
|
||||
import com.service.before.UserService;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/user")
|
||||
public class UserController {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@RequestMapping("/register")
|
||||
public String register(@ModelAttribute Buser buser,Model model, HttpSession session, String code) {
|
||||
return userService.register(buser, model, session, code);
|
||||
}
|
||||
@RequestMapping("/login")
|
||||
public String login(@ModelAttribute Buser buser,Model model, HttpSession session, String code) {
|
||||
return userService.login(buser, model, session, code);
|
||||
}
|
||||
/**
|
||||
* 转到登录页面
|
||||
*/
|
||||
@RequestMapping("/toLogin")
|
||||
public String toLogin(Model model) {
|
||||
return userService.toLogin(model);
|
||||
}
|
||||
/**
|
||||
* 转到注册页面
|
||||
*/
|
||||
@RequestMapping("/toRegister")
|
||||
public String toRegister(Model model) {
|
||||
return userService.toRegister(model);
|
||||
}
|
||||
/**
|
||||
* 修改密码
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public String update(Model model, HttpSession session, String bpwd) {
|
||||
return userService.update(model, session, bpwd);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.forum.dao.UserDao">
|
||||
<update id="update">
|
||||
update user set password=#{password} where username=#{username}
|
||||
</update>
|
||||
|
||||
<select id="queryByUsernameAndPassword" resultType="com.forum.entity.User">
|
||||
select * from user
|
||||
where username = #{username} and password = #{password};
|
||||
</select>
|
||||
|
||||
<insert id="addUser" parameterType="user">
|
||||
insert into user(username,password,email,create_time,update_time,type,school,avatar)
|
||||
values(#{username},#{password},#{email},#{createTime},#{updateTime},#{type},#{school},#{avatar})
|
||||
</insert>
|
||||
<select id="getAllUser" resultType="com.forum.entity.User">
|
||||
select id,username,password,email,create_time,type from user
|
||||
</select>
|
||||
<delete id="deleteUser" >
|
||||
delete from user where id = #{id}
|
||||
</delete>
|
||||
<select id="count" resultType="Integer" >
|
||||
select count(*) from user where type = 0
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,95 @@
|
||||
package com.controller.before;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Random;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
@Controller
|
||||
public class ValidateCodeController {
|
||||
private char code[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
|
||||
'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y',
|
||||
'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M',
|
||||
'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2',
|
||||
'3', '4', '5', '6', '7', '8', '9' };
|
||||
private static final int WIDTH = 50;
|
||||
private static final int HEIGHT = 20;
|
||||
private static final int LENGTH = 4;
|
||||
@RequestMapping("/validateCode")
|
||||
public void validateCode(HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException, IOException {
|
||||
// TODO Auto-generated method stub
|
||||
// 设置响应报头信息
|
||||
response.setHeader("Pragma", "No-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
// 设置响应的MIME类型
|
||||
response.setContentType("image/jpeg");
|
||||
|
||||
BufferedImage image = new BufferedImage(WIDTH, HEIGHT,
|
||||
BufferedImage.TYPE_INT_RGB);
|
||||
Font mFont = new Font("Arial", Font.TRUETYPE_FONT, 18);
|
||||
Graphics g = image.getGraphics();
|
||||
Random rd = new Random();
|
||||
|
||||
// 设置背景颜色
|
||||
g.setColor(new Color(rd.nextInt(55) + 200, rd.nextInt(55) + 200, rd
|
||||
.nextInt(55) + 200));
|
||||
g.fillRect(0, 0, WIDTH, HEIGHT);
|
||||
|
||||
// 设置字体
|
||||
g.setFont(mFont);
|
||||
|
||||
// 画边框
|
||||
g.setColor(Color.black);
|
||||
g.drawRect(0, 0, WIDTH - 1, HEIGHT - 1);
|
||||
|
||||
// 随机产生的验证码
|
||||
String result = "";
|
||||
for (int i = 0; i < LENGTH; ++i) {
|
||||
result += code[rd.nextInt(code.length)];
|
||||
}
|
||||
HttpSession se = request.getSession();
|
||||
se.setAttribute("code", result);
|
||||
|
||||
// 画验证码
|
||||
for (int i = 0; i < result.length(); i++) {
|
||||
g.setColor(new Color(rd.nextInt(200), rd.nextInt(200), rd
|
||||
.nextInt(200)));
|
||||
g.drawString(result.charAt(i) + "", 12 * i + 1, 16);
|
||||
}
|
||||
|
||||
// 随机产生2个干扰线
|
||||
for (int i = 0; i < 2; i++) {
|
||||
g.setColor(new Color(rd.nextInt(200), rd.nextInt(200), rd
|
||||
.nextInt(200)));
|
||||
int x1 = rd.nextInt(WIDTH);
|
||||
int x2 = rd.nextInt(WIDTH);
|
||||
int y1 = rd.nextInt(HEIGHT);
|
||||
int y2 = rd.nextInt(HEIGHT);
|
||||
g.drawLine(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
// 释放图形资源
|
||||
g.dispose();
|
||||
try {
|
||||
OutputStream os = response.getOutputStream();
|
||||
|
||||
// 输出图像到页面
|
||||
ImageIO.write(image, "JPEG", os);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue