Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

jsp bean problem

  Asked By: Colleen    Date: Jul 07    Category: Java    Views: 665
  

I use apache-tomcat-6.0.13 and I'm trying to use Beans in my jsp page
, but unfortunately I got this error:

An error occurred at line: 23 in the jsp file: /index.jsp
NewBean cannot be resolved to a type

here is my jsp page:

jsp:useBean id="theBean" class="NewBean" />
<p><%
int j = theBean.doubleIt(3);
out.println("j is: "+j); %></p>

and here is my simple bean class:

public class NewBean {
public int doubleIt(int number) {
return 2 * number;
}
}

I should tell that I have compiled the bean class and placed it into
WEB-INF\classes directory .
I dont know whether I shoukld add somthing in web.xml or not.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Sydney Thompson     Answered On: Jul 07

You should provide packaging for your bean  class and it will work !

 
Answer #2    Answered By: Kim Cruz     Answered On: Jul 07


Thanks a lot ,
it solved my problem  ,
but I can not find any reasonable reason for it,

 
Didn't find what you were looking for? Find more on jsp bean problem Or get search suggestion and latest updates.




Tagged: