Jsp error:  req cannot be resolved

Hi
I'm trying to run the following error page jsp
<%@ page import="javax.servlet.http.*;" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>untitled</title>
</head>
<body>
<%= new java.util.Date().toString() %>
<% String theMessage = (String)req.getAttribute("message"); %>
</body>
</html>
BUT I keep getting
req cannot be resolved. The rest of the page works fine if I take the String theMessage... line with out.
Thanks in advance
geekpie

Thanks. For some reason I had been assuming you used the same variable name to access the request parameter in a jsp as you used when you sent it from the servlet (in my case "req").

Similar Messages

  • I am getting this error - JspFormsSession cannot be resolved to a type

    Hi
    I am getting following error when I try to open a jsp file.
    Any solution?
    JSP line details are -
    JspFormsSession openrules_session = (JspFormsSession) session.getAttribute(s_attr);
    Error is -
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 4 in the jsp file: /index.jsp
    Generated servlet error:
    JspFormsSession cannot be resolved to a type
    An error occurred at line: 4 in the jsp file: /index.jsp
    Generated servlet error:
    JspFormsSession cannot be resolved to a type
    An error occurred at line: 4 in the jsp file: /index.jsp
    Generated servlet error:
    JspFormsSession cannot be resolved to a type
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    Now I am confident that the problem is with library including, as the same thing happens with other libraries.
    I found that such a warning appears every time:
    Classpath entry /jspbook/src/lib/mail.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.Unfortunately, I've no idea how to include this in a proper way. I think that setting it in "Add External JARs" in "Java Build Path" is enough... or not?
    Seems we're close to solve the problem. May be this screen shot will be helpful to determine the problem?
    http://img257.imageshack.us/img257/3967/screenshotjavaeejspbook.png
    You can see that libraries are included in the Project Explorer

  • Jsp:useBean gives cannot be resolved to a type in Tomcat

    Hi, I am using Tomcat 5.5
    I have a simple JavaBean for test purposes :
    import java.io.Serializable;
        public class testBean implements Serializable {
            int number;
            public testBean() {
            public int getNumber() {
                return number;
            public void setNumber(int newValue) {
                number = newValue;
        }In a file called testBean.java
    I have successfuly compiled it and put the class file the WEB-INF/classes directory.
    I have the following JSP page :
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <jsp:useBean id="pub" scope="session" class="testBean" />
    <jsp:setProperty name="pub" property="number" value="1" />
    <html>
    <head>
    </head>
    <body>
    <jsp:getProperty name="pub" property="number" />
    </body>
    </html>When I open this jsp page I get the following error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /test.jsp
    Generated servlet error:
    testBean cannot be resolved to a typeThis example is pretty minimal and I don't understand why it doesn't work. The error seems to be coming from the first JSP statement.
    Any help would be greatly appreciated.
    Thanks in advance.

    1. Put your bean class in a package.
    package test;
    import...........2. Put the .class file in web-inf/classes/test/testBean.class
    3. Specify the fully qualified name of the class in the useBean declaration.
    <jsp:useBean class="test.testBean" .../>Note: You'd be better off following the java bean naming conventions. Specifically your class name should be TestBean (first letter caps).
    ram.

  • GEF4 Setup Error - FXCanvas cannot be resolved to a type

    Hallo,
    I tried to setup the development environment for GEF4, as specified in the GEF Contributor guide, and I found the following error:
    FXCanvas cannot be resolved to a type.
    (se attached file)
    This error is persistent, and it seems i am not able to find a solution despite I tried multiple times to setup the environment, as specified in the GEF/GEF4 contributor guide .
    This is the list of steps I followed for the setup
    Check Java 8 (oracle) is installed, that is required by the e(fx)clipse plugin.
    Download Eclipse IDE for Eclipse Committers. In my case: eclipse-committers-mars-R-win32.zip
    Install plugins needed by GEF4, in my case:
    e(fx)clipse - IDE, from http://download.eclipse.org/efxclipse/simrel-contrib/mars/m7/tools/site
    e(fx)clipse - IDE - PDE, from http://download.eclipse.org/efxclipse/simrel-contrib/mars/m7/tools/site
    API Tools Execution Environment Descriptions, from: http://download.eclipse.org/eclipse/updates/4.5-I-builds
    Oomph Version Management, from: http://download.eclipse.org/releases/mars'
    Maven Integration for Eclipse (includes Incubating components), from: http://download.eclipse.org/releases/mars
    Clone the GEF4 Git repository and import the projects in the workspace
    Set MARS.target: from org.eclipse.gef4.target project, double click the target definition, wait for the target is fully resolved, and click on "set as target platform".
    Adjust preferences. select Menu > Window > Preferences:
    Java > Compiler > Errors/Warnings: ignore the "Deprecated and restricted API"
    Plug-in Development > Compilers: Ignore the "References to discouraged classes"
    At the end of the setup, I can not compile the GEF4 project, because "FXCanvas cannot be resolved to a type. "
    See image.
    Does anyone has an idea on how to fix this ?
    Kind Regards.
    Patrik

    I updated the respective section of the contributor guide to make it even more explicit, why the "Specify Execution Environment for J2SE-1.7 (and optionally J2SE-1.8)" is important. I also saw that the guide still listed the e(fx)clipse 2.0.0 Mars M7 contribution. I updated it to refer to the e(fx)clipse 2.0.0 Mars release. You might want to update your IDE accordingly.

  • Runtime error - Session cannot be resolved to a type

    Hello! I try to get JavaMail working, but all in vain.
    The problem is I get such an error every time.
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 29 in the jsp file: /SendMail.jsp
    Session cannot be resolved to a type
    26:    prop.put("mail.smtp.host",hostMail);
    27:    prop.put("mail.smtp.user",fromEmail);
    28:    prop.put("mail.smtp.auth","true");
    29:    Session ses =  Session.getInstance(prop,null);
    30:    ses.setDebug(true);
    31:    MimeMessage msg = new MimeMessage(ses);
    32:    MimeBodyPart m1 = new MimeBodyPart();
    An error occurred at line: 29 in the jsp file: /SendMail.jsp
    Session cannot be resolved
    26:    prop.put("mail.smtp.host",hostMail);
    27:    prop.put("mail.smtp.user",fromEmail);
    28:    prop.put("mail.smtp.auth","true");
    29:    Session ses =  Session.getInstance(prop,null);
    30:    ses.setDebug(true);
    31:    MimeMessage msg = new MimeMessage(ses);
    32:    MimeBodyPart m1 = new MimeBodyPart();
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:729)I'm using Eclipse, so I've added external JARs there (activation.jar, mail.jar, mailapi.jar, pop3.jar, smtp.jar). In addition to this, the same libraries are in +/opt/jdk1.6.0_13/jre/lib/+.
    I've imported javax.mail.*, java.util.*, javax.mail.internet.* in my JSP file. I tried to do a lot of manipulations. Also I tried to use different code examples, but the error in the line "Session.getInstance(props, null)" remains the same.
       Properties prop = new Properties();
       prop.put("mail.smtp.host",hostMail);
       prop.put("mail.smtp.user",fromEmail);
       prop.put("mail.smtp.auth","true");
       Session ses =  Session.getInstance(prop,null);The same problem remains when I do this as a Servlet. Class compilation with javac occurs without errors.
    Might the problem be in version compatibility? I use: ArchLinux, Tomcat 5.5, JavaMail 1.4.2.
    Thanks in advance.
    Edited by: Pavel_Z on May 7, 2009 4:55 PM

    Now I am confident that the problem is with library including, as the same thing happens with other libraries.
    I found that such a warning appears every time:
    Classpath entry /jspbook/src/lib/mail.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.Unfortunately, I've no idea how to include this in a proper way. I think that setting it in "Add External JARs" in "Java Build Path" is enough... or not?
    Seems we're close to solve the problem. May be this screen shot will be helpful to determine the problem?
    http://img257.imageshack.us/img257/3967/screenshotjavaeejspbook.png
    You can see that libraries are included in the Project Explorer

  • JSP impot class cannot be resolved to a type

    This has got to be an easy problem but we cannot seem to figure it out.
    I am using Tomcat 6.0.18 and JRE 1.5.09
    This is my class:
    package hello;
    public class hello{
    public void run(){
         System.out.println("Hello World");
    }}This is my JSP:
    <%@ page language="java" import="java.util.* , java.io.* , java.text.*" errorPage="error.jsp"%>
    <%@ page import="hello.*" %>
    <%
    hello h = new hello();
    h.run();
    %>and this is the error:
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 7 in the jsp file: /test.jsp
    hello cannot be resolved to a type
    4:
    5: <%
    6:
    7: hello h = new hello();
    8: h.run();
    9:
    10: %>
    I have the "hello.class" in
    C:\Tomcat6\webapps\ROOT\WEB-INF\classes\hello
    C:\Tomcat6\webapps\ROOT\WEB-INF\classes
    C:\Tomcat6\webapps\ROOT\WEB-INF
    C:\Tomcat6\webapps\manager\WEB-INF\classes\hello
    C:\Tomcat6\webapps\manager\WEB-INF\classes
    C:\Tomcat6\webapps\manager\WEB-INF
    C:\Tomcat6\webapps\host-manager\WEB-INF\classes\hello
    C:\Tomcat6\webapps\host-manager\WEB-INF\classes
    C:\Tomcat6\webapps\host-manager\WEB-INF
    Can someone pelase offer a suggestion and please tell me where the CLASS file should actually reside? Please?

    hii..
    Try this code.I hope u wil get the output.
    test.jsp
    <%@ page language="java" import="java.util.* , java.io.* , java.text.*" errorPage="error.jsp"%>
    <%@ page import="hello.*" %>
    <html>
    <head></head>
    <body><%
    hello h = new hello();
    out.println( h.run());%>
    </body>
    </html>
    hello.java
    package hello;
    public class hello{
    public String run(){
         String a="Hello World";
    return a;
    }}

  • Include JSP in JSP - Error:  cannot be resolved to a type

    Hello,
    Several of my jsp pages include other jsp pages. The project has many errors: "x cannot be resolved to a type". Is there a way to resolve these errors? Below is a small example of the issue:
    JSP #1:
    <%@ page import="com.testing.Introduction" %>
    <html>
    <head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Hello</title>
    </head>
    <body>
    <%
         Introduction intro = new Introduction();
         String speak = intro.sayHello();
    %>
    <p><%=speak %></p>
    <%@ include file="Name.jsp" %>
    </body>
    </html>  JSP #2:
    <html>
    <head>
    <title>Name</title>
    </head>
    <body>
    <%
         String speak2 = intro.sayName();
    %>
    <p>
    <%=speak2 %>
    </p>
    </body>
    </html>Class:
    package com.testing;
    public class Introduction
         public static void main(String[] args) {
         public Introduction() {
              super();
         public String sayHello() {
              return "Hello";          
         public String sayName()     {
              return "My name is Sam";
    }The error shows up in Name.jsp; the issue is with "intro". Any ideas how to resolve this issue?
    Thank you in advance for your help!

    The jsp page Name.jsp appears to be missing the import statement that appears in the first page.
    <%@ page import="com.testing.Introduction" %>The included file is included character for character into the main page which is then treated as a single jsp page for the response. The include directive is invoked at the time of page translation. Given this, I don't see the purpose of using the <html> <head> and <title> tags in the second and included page. I don't think that this suggests the proper purpose of the include directive.
    Note too that if the included file changes, all of the jsp files that call this file need to be updated as well. Servers can handle the alteration of the main jsp, but may not serve the altered content if the included file changes.
    For more information see here. http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPIntro8.html

  • What is cannot be resolved to a type error?

    When i run jsp programs, am getting :
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 6 in the jsp file: /dbcoffee.jsp
    Generated servlet error:
    CoffeeQBean cannot be resolved to a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    what does cannot be resolved to a type mean?

    I am getting the same error but while creating a Web Service.
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         org.apache cannot be resolved to a type
         _service cannot be resolved
         _serviceClient cannot be resolved
         _serviceClient cannot be resolved
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         _serviceClient cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         The constructor TemperatureConverterStub(null, String) is undefined
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         _operations cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         _serviceClient cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         org.apache cannot be resolved to a type
         at ws.example.TemperatureConverterStub.<init>(TemperatureConverterStub.java:17)
         at ws.example.TemperatureConverterServiceClient.main(TemperatureConverterServiceClient.java:8)If you want I can post the files too.

  • HttpServletRequest cannot be resolved to a type in JSP - eclipse

    Hi,
    i've created a webapp in eclipse ver 3.2.
    my jsp looks like this:
    <%!
    private boolean checkLoginRule(HttpServletRequest request, HttpServletResponse response, Integer nLevel) {
    // if user was already authenticated pass him on
    if (request.getSession(true).getAttribute("userID") == null)
    response.sendRedirect("index.jsp");
    else {
    Integer nUserLevel =(Integer)request.getSession(true).getAttribute("userRole");
    if (nUserLevel.intValue() < nLevel.intValue())
    return false;
    return true;
    %>
    i'm getting an error:
    HttpServletRequest cannot be resolved to a type
    What to do?

    import the following package...
    import javax.servlet.http.HttpServletRequest

  • JSP Object Cannot be resolved to a type

    hi!
    i'm new to the jsp business nd i tried to create a 3 tier program with a web interface where the web pulls out data from the data base through RMI. here UserDataObject is the interface that extends Remote interface.
    However this same code works perfectly when i run it from a servlet. but it dusnt seem to work with JSP...i use tomcat 5.5 and everything is in place..(WEB-INF etc)
    this is the code:
    <%
    try {
    UserDataObject udo = (UserDataObject) Naming.lookup("//localhost:1099/Item");
    Vector v = udo.getByStatus(username,0);
    } catch (NotBoundException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
    } catch (SQLException e){
    e.printStackTrace();
    %>and this is the error i get!
    An error occurred at line: 110 in the jsp file: /selling.jsp
    Generated servlet error:
    UserDataObject cannot be resolved to a typeI am quite confident that there's nothing wrong with RMI, since data runs back and forth in the servlets and the other application i made..
    my problem is How come the same code that works perfectly in servlet doesnt work in jsp...?
    plz help me out
    thnx
    nandun

    well...thnx for all the replies...how ever i did solve this problem after struggling with it for about 8 hrs...
    thr trick is to put the class UserDataObject in a pakcage and import it at the top of the jsp page..
    ie.
    <%@ page import = "rmi.UserDataObject"%> etc...
    rmi is the package i stuffed it in...
    hope some1 finds this helpful and think good thoughts about me!
    cheers
    nandun

  • [JSP] UserTransaction cannot be resolved to a type

    I have a JSP page that uses the UserTransaction type, but iam getting an error:
    UserTransaction cannot be resolved to a typeI have imported UserTransaction using this code:
    <%@ page import="java.sql.*,javax.transaction.*" %>Is there a separate Jar for UserTransaction that needed to be copied to the classpath?

    The implementation is provided by your container so check in your container's jee jar.

  • JspWriter cannot be resolved to a type

    The following is CheckAddress.jsp page which checks if the form has the name and phone fields filled in or not. If not then it must print the errors. But the problem I am having is that the Eclipse is showing me the error "JspWriter cannot be resolved to a type".
    If I ignore this error and run the page in the j2ee preview server in eclipse than I get the following error:
    >
    Unable to compile class for JSP
    An error occurred at line: 22 in the jsp file: /CheckAddress.jsp
    Generated servlet error:
    The method prinln(String) is undefined for the type JspWriter
    An error occurred at line: 22 in the jsp file: /CheckAddress.jsp
    Generated servlet error:
    The method prinln(String) is undefined for the type JspWriter
    An error occurred at line: 22 in the jsp file: /CheckAddress.jsp
    Generated servlet error:
    The method prinln(String) is undefined for the type JspWriter
    Caused by:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    >
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <%--Provide Directives to inform JSP of packages needed--%>
    <%@page language="java" import="java.util.*"%>
    <%@page language="java" import="java.io.*"%>
    <%--Specify JSTL tag library for use --%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <meta http-equiv="Content-Type" content="text/html; charaset=ISO-8859-1">
    <title>Check Address</title>
    </head>
    <body>
    <%--Declare the java bean for the addresslist to be queried --%>
         <jsp:useBean id="dbab" class="addressBean.DBAddressBean" />
    <%--Use JSP scripting elements to define two methods --%>
    <%!
         List<String> checkAddress(String Name, String Phone){
          List<String> errors = new ArrayList<String>();
          if((Name == null) || (Name.equals(""))){
               errors.add("Name must not be blank");
          if((Phone == null)||(Phone.equals(""))){
               errors.add("Phone must not be blank");
          return errors;
         void printErrors(JspWriter out, List<String> errors) throws IOException{
              //Report the errors
              out.prinln("<p class=\"error1\">The following errors occured: <br />");
              out.prinln("<ul>");
              Iterator<String> i = errors.iterator();
              while(i.hasNext()){
                   out.println("<li type=\"disc\">"+i.next()+"</li>");
              out.prinln("</ul></p><p><b>please try again</b></p><br />");
    %>     
    <%--Use the internal Scriptlet to call an internal method and get the request parameters with the form info--%>
    <%
         List<String> errors = checkAddress(request.getParameter("Name"), request.getParameter("Phone"));
    %>
    <%--Use JSTL tags to get the values of the parameters for all of the form info --%>
         <c:set var="aid" value="${param.aid}"/>
         <c:set var="Name" value="${param.Name}"/>
         <c:set var="Street" value="${param.Street}"/>
         <c:set var="City" value="${param.City}"/>
         <c:set var="State" value="${param.State}"/>
         <c:set var="Zip" value="${param.Zip}"/>
         <c:set var="Phone" value="${param.Phone}"/>
    <%--Use JSP elements to set the values in the Java Beans--%>
         <jsp:setProperty name="dbab" property="id" value="${aid}"/>
         <jsp:setProperty name="dbab" property="name" value="${Name}"/>
         <jsp:setProperty name="dbab" property="street" value="${Street}"/>
         <jsp:setProperty name="dbab" property="city" value="${City}"/>
         <jsp:setProperty name="dbab" property="state" value="${State}"/>
         <jsp:setProperty name="dbab" property="zip" value="${Zip}"/>
         <jsp:setProperty name="dbab" property="phone" value="${Phone}"/>
    <%--Use the scriptlet to determine where to go now --%>
    <%--Notice how the JSP element tag is used within the scriptlet, the scriptlet needs to be "closed" and "reopened"--%>
    <%
         if(errors.size()==0){
              dbab.saveChanges();
              response.sendRedirect("AddressList.jsp");
         }else{
              //print errors
              printErrors(out, errors);
    %>          
         <jsp:include page="EditAddress.jsp"/>
    <%
    %>     
    </body>
    Edited by: blinkaj on Apr 18, 2010 2:15 AM

    Thanks elOpalo, even though eclipse is still showing the error, things are running fine after I rectified my typing mistake about the prinln. :)

  • File cannot be resolved to a type

    In my JSP page, I am trying to find the existance of a file on the server. I have a method which checks for the file and return the result. I am using this JSP as declaration and then using its methods in html tags. It seems fine to me, but I am getting this error at the very begining of my JSP declaration tag ie "<%! ". Can anyone suggest something ?
    error message is:
    "org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /fastran.jsp
    Generated servlet error:
    File cannot be resolved to a type"
    Here is my JSP Page:
    <%!
    String f3 = "ftn03" ;
    String f3not = "ftn03 file not uploaded";
    String f7 = "ftn07" ;
    String f7not = "ftn07 file not uploaded";
    String f9 = "ftn09" ;
    String f9not = "ftn09 file not uploaded";
    public String checkFile3()
        File ch3 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn03") ;
        if (ch3.exists() == true)
            return f3 ;
        else
            return f3not ;
    public String checkFile7()
        File ch7 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
        if (ch7.exists() == true)
            return f7 ;
        else
            return f7not ;
    public String checkFile9()
        File ch9 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn09") ;
        if (ch9.exists() == true)
            return f9 ;
        else
            return f9not ;
    %>
    <html>
    <head>
    <title> Fastran </title>     
    </head>
    <body>
    <img src="logo.jpeg" width="101" height="75" align = "Right">
    <img src="h_corporate_center.jpg" width="622" height="102">
    <b>
    <form method="post" action="upload.jsp" name="submit" enctype="multipart/form-data">
    Upload Files: <input type="file" name="filefield" >��<input type="submit" name="submit" value="Upload"><br>
    <font color = "Red"><h5>(ftn03,ftn07, and ftn09)</h5></font><br><br><br>
    Uploaded files :
    <%= checkFile3() %>
    <%= checkFile7() %>
    <%= checkFile9() %>
    <br><br><br><br><br><br><br><br><br><br><br><br>
    <input type=button onClick="location.href='logintest.jsp'" value='Home'>  <input type=button onClick="location.href='processForm.jsp'" value='Proceed'><br>
    </form>
    </body>
    </html>Message was edited by:
    NasirMunir

    grrrrrrrrrrrrrrrrr, my bad.
    Thanks a lot for pointing that out. Sometimes one can
    miss such simple things. embarrassed
    don't be embarrassed. people a lot smarter than you or I have made much more stupid mistakes

  • Javax.servlet.ServletContext cannot be resolved in Tomcat 5.5.12

    I deployed my web application in Tomcat 5.5.12 (Solaris 10 platform), and found following error message:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 16 in the jsp file: /countrydetail.jsp
    Generated servlet error:
    javax.servlet.ServletContext cannot be resolved
    An error occurred at line: 16 in the jsp file: /countrydetail.jsp
    Generated servlet error:
    ctx cannot be resolved
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:409)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.
    Apache Tomcat/5.5.12
    The application was developed by NetBeans 5 RC2 and runed well under Windows platform.
    The error appears when I click link . At first I thought it may be caused by JSF, but I tested the sample JSF web with simliar link, and there is no problem.
    I do saw servlet-api.jar (which contains javax.servlet.ServeletContext) in Tomcat common/lib. Why tomcat can not locate the class?

    I solved this problem by deploying the application in Tomcat 5.5.15. It seems that the problem in above post is a bug in Tomcat 5.5.12.
    Details please refer to http://issues.apache.org/bugzilla/show_bug.cgi?id=38211

  • My class cannot be resolved to a type

    I just installed jstl and I am trying to get it work using this test code. The class Customer is in WEB-INF/classes, an ArrayList of Customer objects is stored in the session in the attribute "results". Any ideas why this is failing?
    <base href="<%= request.getScheme() +"://" + request.getServerName() + (request.getServerPort() != 80 ? ":" + request.getServerPort() : "") + request.getRequestURI() %> "/>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ page import="java.util.Collection,
                     java.util.ArrayList"%>
    <%@ taglib prefix="h" tagdir="/WEB-INF/tags" %>
    <jsp:useBean id="customer" class="Customer" />
    <jsp:useBean id="results" scope="session" class="java.util.ArrayList" />
    <table>
    <c:forEach items="${customer.results}" var="item">
    <tr>
         <td><c:out value="${item.id}"/></td>
         <td><c:out value="${item.name}"/></td>
    </tr>
    </c:forEach>
    </table>Here is the error I'm getting:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 8 in the jsp file: /listCustomers.jsp
    Generated servlet error:
    Customer cannot be resolved to a type
    An error occurred at line: 8 in the jsp file: /listCustomers.jsp
    Generated servlet error:
    Customer cannot be resolved to a type
    An error occurred at line: 8 in the jsp file: /listCustomers.jsp
    Generated servlet error:
    Customer cannot be resolved to a type
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         Search.doPost(Search.java:95)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 8 in the jsp file: /listCustomers.jsp
    Generated servlet error:
    Customer cannot be resolved to a type
    An error occurred at line: 8 in the jsp file: /listCustomers.jsp
    Generated servlet error:
    Customer cannot be resolved to a type
    An error occurred at line: 8 in the jsp file: /listCustomers.jsp
    Generated servlet error:
    Customer cannot be resolved to a type
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         Search.doPost(Search.java:95)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.16 logs.

    I added this line to my class:
    package storePackage;and put the compiled class in: WEB-INF/classes/storePackage/
    Then I changed my jsp to:
    <base href="<%= request.getScheme() +"://" + request.getServerName() + (request.getServerPort() != 80 ? ":" + request.getServerPort() : "") + request.getRequestURI() %> "/>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ page import="java.util.Collection,
                     java.util.ArrayList"%>
    <%@ taglib prefix="h" tagdir="/WEB-INF/tags" %>
    <c:set var="customer" value="<%= new Customer() %>"/>
    <jsp:useBean id="customer" class="com.storePackage.Customer" />
    <jsp:useBean id="results" scope="session" class="java.util.ArrayList" />
    <table>
    <c:forEach items="${customer.results}" var="item">
    <tr>
         <td><c :o ut value="${item.id}"/></td>
         <td><c :o ut value="${item.name}"/></td>
    </tr>
    </c:forEach>
    </table>Now I'm getting this:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /listCustomers.jsp(9,0) The value for the useBean class attribute com.CustomerPackage.Customer is invalid.
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         Search.doPost(Search.java:95)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: /listCustomers.jsp(9,0) The value for the useBean class attribute com.CustomerPackage.Customer is invalid.
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
         org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
         org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
         org.apache.jasper.compiler.Generator.generate(Generator.java:3304)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         Search.doPost(Search.java:95)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.16 logs.

Maybe you are looking for

  • Sort field in action monitor

    Dear Experts, I'm trying to take bulk/mass printouts for CRM transactions, using t.code- CRMC_ACTION_JOB.here we have a field called SORT FIELD1.please tell me the significance of this.actually there is no furthur filteration criteria for this.like-u

  • Service Control Manager - 7000

    I installed Oracle Client on a Windows Pro 2000 computer. In the Event Log I received next message: Source: Services Control Manager ID: 7000 Failure at start of service "OracleWebAssistance0" because of a mistake. The service has not answered inquir

  • Unity 7 dial by name directory handler question

    /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in

  • PDFDocumentRuntimeException: Failed to  USEPDF

    Hello,   I created a offline interactive form in a DC by following this exercise: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/user-interface-technology/wd%20java/wdjava%20archive/offline%20interactive%20pdf%20for

  • Is there a program that finds hardware and OS problems?mid-2012 pro

    What about spywear?... my answering machine turned on then router was accessable to my laptop!!!! I now keep the mac router unplugged when not in use. Also, the 10.4.11 pro USB out to a perifferial microprocessor (arduino uno R3) has stopped communic