Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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

843840Feb 3 2010 — edited Feb 4 2010
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2010
Added on Feb 3 2010
5 comments
852 views