Bonjour,

J'essaie de mettre en oeuvre JCaptcha sans succès dans une application Struts-1.3.10.

Dans mon projet, j'ai une dépendance sur :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
<dependency>
			<groupId>com.octo.captcha</groupId>
			<artifactId>jcaptcha-integration-struts</artifactId>
			<version>1.0</version>
			<exclusions>
				<exclusion>
					<groupId>struts</groupId>
					<artifactId>struts</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
Je déclare le plugin dans mon struts-config.xml :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
 
	<plug-in className="com.octo.captcha.module.struts.CaptchaServicePlugin"/>
Je déclare l'action dédiée au rendu des images dans le struts-config également :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
<action-mappings>
(...)
<action path="/jcaptcha"
			type="com.octo.captcha.module.struts.image.RenderImageCaptchaAction" />
</action-mappings>
Dans ma JSP (/pages/register.jsp), j'ai les différents bouts de code suivants :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
 
<%@ taglib uri="/WEB-INF/jcaptcha.tld" prefix="jcaptcha"%>
 
 
<html:form action="/inscriptionAction.do"
	onsubmit="return validateRegistrationForm(this);">
 
<tr>
				<th align="right"><jcaptcha:question />:</th>
				<td align="left"> <img src="/jcaptcha.do" />
				<br />
				<input type="text"
					name="jcaptcha_response"  /></td>
			</tr>
Lorrsque j'appelle la page, il n'y a pas de rendu d'image alors que lorsque j'appelle directement l'action, une image s'affiche...

Ne serait-ce pas lié au code de rendu de l'image de la classe com.octo.captcha.module.struts.image.RenderImageCaptchaAction dans laquelle il y a notamment :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
   85           httpServletResponse.setHeader("Cache-Control", "no-store");
   86           httpServletResponse.setHeader("Pragma", "no-cache");
   87           httpServletResponse.setDateHeader("Expires", 0);
   88           httpServletResponse.setContentType("image/jpeg");
   89           ServletOutputStream responseOutputStream =
   90                   httpServletResponse.getOutputStream();
   91           responseOutputStream.write(captchaChallengeAsJpeg);
   92           responseOutputStream.flush();
   93           responseOutputStream.close();
Merci pour votre aide.