This discussion is archived
3 Replies Latest reply: Oct 15, 2012 1:32 AM by M.A.N RSS

Deployed Captcha Code on webcenter spaces using customized Task Flow

M.A.N Newbie
Currently Being Moderated
Dears,

i am using Captcha Code, make new Task flow and fragment to be deployed on webcenter spaces, the code working correctly when am execute RUN from JDeveloper 11.1.1.4.0, but when i deploy it on webcenter spaces version 11.1.1.5 and call this Task Flow from webcenter spaces the image not appear(Actually its Servlet code).

as mentioned on Oracle PDF (http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html ) -- > How-to use Captcha with ADF Faces and Oracle ADF

add Servlet on web.xml, then make Managed Bean Code (add it into faces-config.xml) , then create new task flow and call the method that execute the Managed Bean from ADF Task Flow Page.

1 - Servlet on web.xml :
<servlet>
<servlet-name>CaptchaServlet</servlet-name>
<servlet-class>nl.captcha.servlet.SimpleCaptchaServlet</servlet-class>
<init-param>
<param-name>width</param-name>
<param-value>250</param-value>
</init-param>
<init-param>
<param-name>height</param-name>
<param-value>75</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CaptchaServlet</servlet-name>
<url-pattern>/captchaservlet.jpg</url-pattern>
</servlet-mapping>

2 - Managed Bean :
public void callMethod() {

FacesContext fctx = FacesContext.getCurrentInstance();
ExternalContext ectx = fctx.getExternalContext();
HttpServletRequest request = (HttpServletRequest)ectx.getRequest();
Captcha captcha = (Captcha)ectx.getSessionMap().get(Captcha.NAME);
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
//bad luck - but ignore
System.out.println("UTF not supported !");
}
String answer = (String)ectx.getRequestMap().get("bestGuess");
if (answer != null && captcha.isCorrect(answer)) {
sendMail();
SendMail_ToExternal();

} else {
fctx.addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Please write the number shown in the Picture",
null));
}

}


i am download the Captcha JAR from Oracle : http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html , Download Captcha an using it as Task Flow to deploy it on webcenter spaces, but as i told you when i Run this code from JDeveloper working correctly, but the problem when i deploy it on webcenter spaces the Servlet code with image not appear. i wanna to know if servlet code working with deployed task flows on webcenter spaces or not ?

Please Advise..

Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points