1、配置前端页面
1 <!-- 验证码--> 2 <div class="form-group " style="padding-left: 9%;" id="show"> 3 <span class="glyphicon glyphicon-picture pull-left input-group" style="padding-top: 8px;"></span> 4 <input type="text" class="form-control col-md-7 pull-left" maxlength="4" id="user.user_code" name="user.user_code" placeholder="验证码" style="width:100px;margin-left: 2%"> 5 <img alt="" src="Code.action" src="video/Crocodile.jpg" onclick="this.src='Code.action?'+ Math.random();" class="pull-left" style="width:65px;height: 35px;margin-left: 2%;"/> 6 <small class="control-label pull-left" style="margin-top: 10px;margin-left: 5px;">(点击图片刷新)</small> 7 <label class="control-label pull-left" id="msg_code" style="color: red;margin-top: 3px;margin-left: 5px;"></label> 8 </div>
其中 src="Code.action" onclick="this.src='Code.action?'+ Math.random();",分别为action的name和每次点击图片都自动刷新一次
2、配置Action