• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

error in jsp when calling a javabean

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
// my html code that calls the Javabean stored in the following path : "http//localhost:8080/vennila/Beans/bean.jsp"
<html>

<body>
<jsp:useBean id="a" class="sun.bean" scope="session"/>
<jsp:setProperty name="a" property="*"/>
<%=a.getName()%>
<%=a.getName2()%>
</body>

</html>


// my input page that calls the <html>

<head>

<title>New Page 1</title>
</head>

<body>

<form method="POST" action="http://localhost:8080/vennila/Beans/bean.jsp">

<p><input type="text" name="name" size="20"></p>
<p><input type="text" name="name2" size="20"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>

</body>

</html>

// my java bean stored in the following path : C:\Program Files\Apache Tomcat 4.0\webapps\vennila\WEB-INF\classes

package sun;
public class bean implements java.io.Serializable
{
private String name;
private String name2;

public bean()
{
}

public void setName(String name1)
{
name=name1;
}
public String getName()
{
return name;
}

public void setName2(String name3)
{
name2=name3;
}
public String getName2()
{
return name2;
}
}

while compiling the bean file i haven't got any error but when executing the jsp file i am getting the following error,

org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\vennila\WEB-INF\classes\sun\bean.class. The major.minor version '49.0' is too recent for this tool to understand.


An error occurred at line: 4 in the jsp file: /Beans/bean.jsp

Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\vennila\Beans\bean$jsp.java:60: Class sun.bean not found.
sun.bean a = null;
^

when i execute the same code in my neighbours system its working. kindly let me know what could be the reason in my system or is it in my program.
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you check whether you compiled the file using the JDK version used by tomcat. Most likely you are having multiple JDK versions in your system
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic