惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
G
Google Developers Blog
Spread Privacy
Spread Privacy
I
InfoQ
V
V2EX
S
Schneier on Security
小众软件
小众软件
C
CERT Recently Published Vulnerability Notes
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
L
Lohrmann on Cybersecurity
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
The Hacker News
The Hacker News
S
SegmentFault 最新的问题
C
Cybersecurity and Infrastructure Security Agency CISA
NISL@THU
NISL@THU
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
Latest news
Latest news
S
Secure Thoughts
Project Zero
Project Zero
MongoDB | Blog
MongoDB | Blog
I
Intezer
Security Latest
Security Latest
Apple Machine Learning Research
Apple Machine Learning Research
Vercel News
Vercel News
N
Netflix TechBlog - Medium
V2EX - 技术
V2EX - 技术
量子位
T
Threatpost
T
The Blog of Author Tim Ferriss
Y
Y Combinator Blog
T
Tor Project blog
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
C
Check Point Blog
博客园 - Franky
Google DeepMind News
Google DeepMind News
The Register - Security
The Register - Security
The GitHub Blog
The GitHub Blog
L
LINUX DO - 热门话题

博客园 - Fei飞

关于下划线的有无,和超链接的颜色变化 Action里跳转到错误页的另一种方法(struts1.2) - Fei飞 - 博客园 java获取本机IP - Fei飞 - 博客园 jdk环境变量 Tomcat虚拟路径 - Fei飞 - 博客园 杨辉三角的画法(c语言) - Fei飞 - 博客园 完成SSh构架的搭建 js表单验证控制代码大全 颜色编码表 mysql中文配置 js实现按钮控制加减 Could not execute JDBC batch update C的错误分析 用js获取select所选的值 我是大海里的一页扁舟 类型转换和页面获取值(总爱忘的) JDBCTM中Statement接口提供的execute、executeQuery和executeUpdate之间的区别 html标签大全 struts标签库
struts中,防止F5刷新,造成重复投票方法
Fei飞 · 2008-03-11 · via 博客园 - Fei飞

现声明一个变量p:int p;

public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
函数里加入一个if语句

if(p==1){
    
    return mapping.findForward("error");
   }else
   {
    p=0;
    p=p+1;
   }
return mapping.findForward("show");
解释:当第一次提交时p不等于1,所以执行else,顺利跳转到显示投票页,
当刷新时,p由于缓存已经是1了,所以p==1,这样就跳转到错误页error,显示“不能重复投票”
说明:还未研究绑定IP,之后这个方法还需改进。