[软件设计/软件工程] STRUTS2STUDENTSINFOMANAGE STRUTS2版学生管理系统

[复制链接]
发表于 2022-5-2 12:58:21
java1234官网

验证码更改功能

首先要有一个自动生成验证码的jsp文件,比如image.jsp,我们只需要掌握里面

// 将验证码存储在 SESSION 中
session.setAttribute("sRand",sRand);

这句话就够了。

在首页编写一个img元素,并为其添加一个onclick事件,如:

函数加载图像(){
document.getElementById("randImage").src = "image.jsp?"+Math.random();
}

<img onclick="javascript:loadimage();" title="再试一个" name="randImage" id="randImage" src="image.jsp" width="60" heigh="20" border="1" align="absmiddle"/>

这样就可以达到更换验证码的效果,如图:





获取响应对象:ServletActionContext.getResponse()

eclipse中项目名有红色感叹号

【解决方法】:右键项目名BuildPath--->Configure Build Paht...,然后上面有几个选项卡,在Libraries中找到红叉的包就是路径错误的包。进入classpath修改对应包的当前路径。然后在eclipse中回到F5刷新项目。

课程列表未显示:

调试调试发现



项目导入的包有:



已导入两个新包

足够。网上查的

json-lib.jar 开发包使用:

依赖包:
commons-beanutils.jar;
commons-httpclient.jar;
commons-lang.jar;
ezmorph.jar;很多人使用的时候会提示net.sf.ezmorph.xxx 找不到,但是缺少这个:
morph-1.0.1.jar

(Java1234 official website
Verification code change function
First, there should be a JSP file that automatically generates the verification code, such as image JSP, we just need to master it
//Store the verification code in session
session. setAttribute("sRand",sRand);
That's enough.
Write an img element on the home page and add an onclick event to it, such as:
Function load image (){
document. getElementById("randImage"). src = "image.jsp?"+ Math. random();
}
<img onclick="javascript:loadimage();"  Title = "try again" name = "randimage" id = "randimage" SRC = "image. JSP" width = "60" height = "20" border = "1" align = "absmiddle" / >
In this way, the effect of replacing the verification code can be achieved, as shown in the figure:
Get response object: servletactioncontext getResponse()
Project names in eclipse have red exclamation marks
[solution]: right click the project name buildpath - > configure build paht, Then there are several tabs above. The package with the Red Cross found in libraries is the package with the wrong path. Enter classpath to modify the current path of the corresponding package. Then go back to F5 in eclipse to refresh the project.
Course list not shown:
Debugging discovery
The packages imported by the project include:
Two new packages have been imported
Enough. Check it online
json-lib. Jar development kit uses:
Dependent packages:
commons-beanutils. jar;
commons-httpclient. jar;
commons-lang.jar;
ezmorph. jar; Many people will prompt net sf. ezmorph. XXX cannot be found, but this is missing:
morph-1.0.1. jar
)





上一篇:DELPHI2009下编译提示“找不到”EXCEL_TLB”
下一篇:ANDROID 3开发中遇到的环境问题--整个项目的ECLIPSE报错

使用道具 举报

Archiver|手机版|小黑屋|吾爱开源 |网站地图

Copyright 2011 - 2012 Lnqq.NET.All Rights Reserved( ICP备案粤ICP备14042591号-1粤ICP14042591号 )

关于本站 - 版权申明 - 侵删联系 - Ln Studio! - 广告联系

本站资源来自互联网,仅供用户测试使用,相关版权归原作者所有

快速回复 返回顶部 返回列表