how to call javabean from jsp? i wanted to call javabean from jsp with in my own folder keeping at webapps folder. Pleasssssssssssssss help me for this.................:sad:

Push, can you provide a little clearer post with more specific details about what you are trying to do and what the problem is...

typically in JSP you would use the useBean tag to indicate what Bean you want to use...

There are paramters to indicate the class or type of bean to use and scope of the bean and name or id of the bean....

if the bean doesn't already exist in the scope you have indicated, it will be created if you have provided the class parameter, if you only provided the type parameter, it will not create a new one, but only use the existing one, if it exists... so type is useful only if you know the bean already exists in the scope... and you don't want a new one created.... default scope, I believe, is page based, so it will not persist unless you make it a larger scope...

So you call the <JSP:useBean ...> you provide a name/id for the bean and a class for the bean... in the useBean tage you use id="XXX" to give the bean a name and then when you set or get values later you use name="XXX" to indicate the name you gave the bean in its id="XXX" earlier.... this sems strange... when you create the bean, you give it an "id" this id becomes the "name" you used in later tags to refer to the bean... why didn't they jsut make all tags call it name="XXX" or id="XXX" rather thanmixing them.... who knows... in any case be careful of that point....

Scope can be page, request, session or application


the bean file should be in a JAR file and should be in /WEB-INF/lib or be in a folder structure that matches the package structure the folder structure must be sub-folders of /WEB-INF/classes

i.e. /WEB-INF/classes/com/rgtaylor/java/web/beans
or
/WEB-INF/lib/rgtaylorBeans.jar

If your Web Hosting company or SysAdmin doesn't allow you to use those locations, you can not do anything with it really... your only option then is to include the code directly inthe JSP files, which is not a good idea...

if you are asking how to place the files in some other location... unless you hack the server source, you can't... it is coded, for security reasons to require a /WEB-INF/ location... things under this folder can not be directly accessed or referenced from outside your webapp... So I place my main pages under "webapps/myapp", for example, but then all the included stuff, is placed under "webapps/myapps/WEB-INF/"...

Peace,

thank u sir, 4 u r timely replay.............

Push, can you provide a little clearer post with more specific details about what you are trying to do and what the problem is...

typically in JSP you would use the useBean tag to indicate what Bean you want to use...

There are paramters to indicate the class or type of bean to use and scope of the bean and name or id of the bean....

if the bean doesn't already exist in the scope you have indicated, it will be created if you have provided the class parameter, if you only provided the type parameter, it will not create a new one, but only use the existing one, if it exists... so type is useful only if you know the bean already exists in the scope... and you don't want a new one created.... default scope, I believe, is page based, so it will not persist unless you make it a larger scope...

So you call the <JSP:useBean ...> you provide a name/id for the bean and a class for the bean... in the useBean tage you use id="XXX" to give the bean a name and then when you set or get values later you use name="XXX" to indicate the name you gave the bean in its id="XXX" earlier.... this sems strange... when you create the bean, you give it an "id" this id becomes the "name" you used in later tags to refer to the bean... why didn't they jsut make all tags call it name="XXX" or id="XXX" rather thanmixing them.... who knows... in any case be careful of that point....

Scope can be page, request, session or application


the bean file should be in a JAR file and should be in /WEB-INF/lib or be in a folder structure that matches the package structure the folder structure must be sub-folders of /WEB-INF/classes

i.e. /WEB-INF/classes/com/rgtaylor/java/web/beans
or
/WEB-INF/lib/rgtaylorBeans.jar

If your Web Hosting company or SysAdmin doesn't allow you to use those locations, you can not do anything with it really... your only option then is to include the code directly inthe JSP files, which is not a good idea...

if you are asking how to place the files in some other location... unless you hack the server source, you can't... it is coded, for security reasons to require a /WEB-INF/ location... things under this folder can not be directly accessed or referenced from outside your webapp... So I place my main pages under "webapps/myapp", for example, but then all the included stuff, is placed under "webapps/myapps/WEB-INF/"...

Peace,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.