Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with JSP  RSS feed

 
Salman Faraz
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Respected Friends,
I am facing some problems while working with Java Beans and JSP, I am
writting a very simple JSP page which simply gets the values from a Java Bean and display it on the browser, but when ever I try to run this JSP page than tomcat is unable to recognize the Java Bean and every time it
gives me the error(exception) that CurrentTimeBean(it is the bean) is not found,all other JSP pages are running perfectly and there is also no problem with tomcat, the procedure which I am following is as follows:

1) First I create my Java Bean its name is "CurrentTimeBean.java" than I create my jsp page which is getting values from the bean its name is
"CurrentTimeBean.jsp", I save the these two files on following location :

D:\TOMCAT\WEBAPPS\ROOT\CurrentTimeBean.java
D:\TOMCAT\WEBAPPS\ROOT\CurrentTimeBean.jsp

2) than I compile my bean from command prompt so that its class file can be generated.
3) than I go to the browser and type the following command:

http://localhost:8080/CurrentTimeBean.jsp

but it gives me the error(exception) saying that CurrentTimeBean is not found, .Please tell that what mistake am I making also please note that that tomcat and all other JSP files are running perfectly but I dont know that why tomcat does not identify CurrentTimeBean.java , the source code for CurrentTimeBean.java and CurrentTimeBean.jsp is as follows:



The code for CurrentTimeBean.jsp is as follows:



Please reply as soon as possible.

Regards,
Salman Faraz.
 
Jesus Angeles
Ranch Hand
Posts: 2069
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Salman,

On which folder is the CurrentTimeBean.class file located now?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, the bean needs to be in a package.
You could get away without this in pre java1.4.1 days but not now.

Second, your classes need to be under:
{your webapp}/WEB-INF/classes/{your package}/{your class}

Once you've pacakged your bean, you will want to fully qualify the class attribute of your useBean tag:
<jsp:useBean id="time" class="mypackage.CurrentTimeBean"/>
 
Salman Faraz
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Jesus Angeles,
The location of CurrentTimeBean.class is as follows:

D:\TOMCAT\WEBAPPS\ROOT\CurrentTimeBean.class

is this the right location or I need to place it some where else, pleae reply as soon as possible.

Regards,
Salman Faraz.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is this the right location or I need to place it some where else


Salman, what is the use of posting a question if you are not going to pay any attention to the responses? Ben has clearly and correctly already answered your question.
[ November 08, 2005: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!