an error has occured while executing my project...

S

supraja

one file is RegistrationForm.jsp i places it in c:/tomcat6.0/webapps/
SWF/CAP/
error::

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 16 in the jsp file: /CAP/
RegistrationForm.jsp

nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY cannot be
resolved to a type
13: <%
14: try
15: {
16: String c = (String)
session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY);
17: String parm = (String) request.getParameter("captchafield");
18:
19: //out.println(parm + " ? " + c + ":");

the file RegistrationForm.jsp
<%
String c = (String)
session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY);
String parm = (String) request.getParameter("captchafield");

//out.println(parm + " ? " + c + ":");

if (c != null && parm != null) {
if (c.equals(parm)) {
out.println("<b>Form Registered Successfully</b>");
response.sendRedirect("index.jsp?todo='Registration Completed
Successfully...'");
} else {
out.println("<b>Please Re-Enter the Code Correctly and Then
Submit</b>");
}
}
and the servlet code is::

package nl.captcha.servlet;

/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and
Comments
*/
public class Constants {

public final static String SIMPLE_CAPCHA_SESSION_KEY =
"SIMPLE_CAPCHA_SESSION_KEY";
public final static String SIMPLE_CAPCHA_TEXTPRODUCER =
"cap.text.producer";
public final static String SIMPLE_CAPTCHA_BG_IMP = "cap.bg.imp";
public final static String SIMPLE_CAPTCHA_BOX = "cap.border";
public final static String SIMPLE_CAPTCHA_BOX_C = "cap.border.c";
}

actually this might be simple problem but i cannot understand the
problem.. can u please help me....
 
Joined
Nov 25, 2008
Messages
17
Reaction score
0
<%@ page import="nl.captcha.servlet.Constants" %>
add this to your jsp file.
and make sure: session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY) this value is not null.
 
Last edited:
L

Lew

supraja said:
one file is RegistrationForm.jsp i places it in c:/tomcat6.0/webapps/
SWF/CAP/
error::

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 16 in the jsp file: /CAP/
RegistrationForm.jsp

nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY cannot be
resolved to a type
13: <%
14: try

DO NOT USE TAB CHARACTERS TO INDENT USENET POSTS!
15: {
16: String c = (String)
session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY);
17: String parm = (String) request.getParameter("captchafield");
18:
19: //out.println(parm + " ? " + c + ":");

the file RegistrationForm.jsp
<%
String c = (String)
session.getAttribute(nl.captcha.servlet.Constants.SIMPLE_CAPCHA_SESSION_KEY);
String parm = (String) request.getParameter("captchafield");

//out.println(parm + " ? " + c + ":");

if (c != null&& parm != null) {
if (c.equals(parm)) {
out.println("<b>Form Registered Successfully</b>");
response.sendRedirect("index.jsp?todo='Registration Completed
Successfully...'");
} else {
out.println("<b>Please Re-Enter the Code Correctly and Then
Submit</b>");
}
}
and the servlet code is::

This is not servlet code.
package nl.captcha.servlet;

/**
* @author Administrator
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and
Comments
*/
public class Constants {

public final static String SIMPLE_CAPCHA_SESSION_KEY =
"SIMPLE_CAPCHA_SESSION_KEY";
public final static String SIMPLE_CAPCHA_TEXTPRODUCER =
"cap.text.producer";
public final static String SIMPLE_CAPTCHA_BG_IMP = "cap.bg.imp";
public final static String SIMPLE_CAPTCHA_BOX = "cap.border";
public final static String SIMPLE_CAPTCHA_BOX_C = "cap.border.c";
}

actually this might be simple problem but i cannot understand the
problem.. can u [sic] please help me....

"u" is txtspeek, not English.

I suspect that your 'Constants' class is not in scope for the servlet. What
is the ".class" file organization of the WAR?

I'm also suspicious of the way you deployed it. What happens if you use the
Tomcat deployer app? I've never seen an app deployed to a subdirectory of a
subdirectory of "webapps/" so it looks fishy.

Can you prepare an SSCCE?
http://sscce.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top