在SpringSide 3 中使用JCaptcha
2009-09-22 00:00:00 来源:WEB开发网好了,下面看看具体步骤。
1、先在Spring的配置文件中配置CaptchaService的Bean,如下:
<!--JCaptcha验证码服务 -->
<bean id="captchaService" class="com.octo.captcha.service.image.DefaultManageableImageCaptchaService">
<property name="captchaEngine">
<bean class="org.springside.modules.security.jcaptcha.GMailEngine" />
</property>
<property name="minGuarantedStorageDelayInSeconds" value="600" />
</bean>
2、在web.xml中配置Filter,如下:
<!-- SpringSide's JCaptcha filter -->
<filter>
<filter-name>jcaptchaFilter</filter-name>
<filter-class>org.springside.modules.security.jcaptcha.JCaptchaFilter</filter-class>
<init-param>
<param-name>failureUrl</param-name>
<param-value>/login.action?error=2</param-value>
</init-param>
</filter>
<!-- jcaptcha图片生成URL. -->
<filter-mapping>
<filter-name>jcaptchaFilter</filter-name>
<url-pattern>/security/jcaptcha.jpg</url-pattern>
</filter-mapping>
<!-- jcaptcha登录表单处理URL.
必须放在springSecurityFilter的filter-mapping定义之前 -->
<filter-mapping>
<filter-name>jcaptchaFilter</filter-name>
<url-pattern>/j_spring_security_check</url-pattern>
</filter-mapping>
Tags:SpringSide 使用 JCaptcha
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接