File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes where to put my bean Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "where to put my bean " Watch "where to put my bean " New topic
Author

where to put my bean

sushil pandey
Greenhorn

Joined: Jun 14, 2004
Posts: 7
hi
i m using apache server 4.1.18 and my problem is that i've created a bean(java file) which i want to call in a jsp page now i dont know where to put that java file ,i've tried using packege but i dont now where that java file goes
my java file is as follows


package com.taglib.wdjsp.component;
import java.util.*;

public class CurrentTimeBean
{
private int hours;
private int minutes;

public CurrentTimeBean()
{
Calendar now = Calendar.getInstance();
this.hours=now.get(Calendar.HOUR_OF_DAY);
this.minutes=now.get(Calendar.MINUTE);
}

public int getHours()
{
return hours;
}

public int getMinutes()
{
return minutes;
}
}

where to put this file to be accessed by my jsp file as
shown

<jsp:useBean id="time" class="CurrentTimeBean"/>
<html>
<body>
It is now <jsp:getProperty name="time" property="minutes"/>
minutes past the hour.
</body>
</html>


YOU CAN'T LEAVE UR HABIT!!!<br />AS WHEN U REMOVE H,A BIT REMAINS<br />WHEN U REMOVE A,BIT STILL REMAINS<br />WHEN U REMOVE B,IT STILL REMAINS
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56153
    
  13

With a class named CurrentTimeBean in package com.taglib.wdjsp.component, the class file should be:



[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
sushil pandey
Greenhorn

Joined: Jun 14, 2004
Posts: 7
actully i've tried to to put my files in the directory path u said but there are a 15 WEB-INF folder in the apache group folder which one should i use
i'm using windows 2000
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56153
    
  13

The one for the web application that you want this to be part of. If you don't know which is which, you need to take some time to get your folders (and your thoughts) organized to know how your web apps are laid out and configured on disk.
sushil pandey
Greenhorn

Joined: Jun 14, 2004
Posts: 7
you are right!!! it's working now
thanks for bearing my silly question

thanks a lot
[ June 15, 2004: Message edited by: sushil pandey ]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: where to put my bean
 
Similar Threads
bean cannot be found in any scope
Problems with JSP
Setting up directory structure for Bean Component in JSP
Now J2EE - plzzzzzzzzzzzzz help
where to put my java file bean to be accessed by my jsp page in apache 4.1.18