GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes jsp:useBean tag Rules Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "jsp:useBean tag Rules" Watch "jsp:useBean tag Rules" New topic
Author

jsp:useBean tag Rules

Rina Magro
Ranch Hand

Joined: May 25, 2006
Posts: 63
Hi all
I am a bit confused re tag Rules.
On Heads First Servlets n Jsp Book pg 354, it says that i can code a useBean tag with a 'type' attribute on its own as long as the bean ALREADY EXISTS.
Coincidentally at work im using this code:

and i know for sure i have a bean object set in my request, so how come i am getting an Instantiation Exception still, saying i should declare either a class or a beanName.
Please help.
Thanks lots
Rina
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
Hi Rina,

Are you sure you have bean call imap in the request scope?

If scope is missing, by default it will find in the page scope only.
You have used scope="request", so in the request scope there must
be a bean called imap in order to be able to use:

<jsp:useBean id="imap" type="java.lang.Object" scope="request"/>



Thanks,
[ August 15, 2007: Message edited by: Chandra Bhatt ]

cmbhatt
Rina Magro
Ranch Hand

Joined: May 25, 2006
Posts: 63
Hi Chandra
thanks for your quick reply.
i just thought i could use any id n that i only needed d id to be able to call the bean in my jsp page later . So now this code works:

One other thing please, any suggestion why EL doesnt work for me, i thought this was enabled by default. I checked my DD for any settings but don't know what else to do, any ideas please
thnx a million
Rina
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
One other thing please, any suggestion why EL doesnt work for me, ...


EL is only enabled by default when using a JSP 2.0 compliant container (make sure you're using Tomcat 5.x or later) and a Deployment Descriptor version 2.4 or higher.

See your Deployment Descriptor (DD).

Thanks,
Rina Magro
Ranch Hand

Joined: May 25, 2006
Posts: 63
Hi Chandra
im using Weblogic 8.1.3 and my DD says:

so i guess i can't use EL in my app.
I have used JSTL but would i be able to embed scripting inside my JSTL eg.
<c:if test="<%request.ge.........
thanks
Rina
Chandra Bhatt
Ranch Hand

Joined: Feb 28, 2007
Posts: 1707
I have used JSTL but would i be able to embed scripting inside my JSTL eg.
<c:if test="<%request.ge.........



Yeah, of-course you can use!

Rina Magro
Ranch Hand

Joined: May 25, 2006
Posts: 63
thanks Chandra, im so used to scripting, so bit shaky till i get d hang of all this jstl,el etc.
regards
Rina
khushhal yadav
Ranch Hand

Joined: Jun 20, 2007
Posts: 242

And Rina

For

One other thing please, any suggestion why EL doesnt work for me, ...


Try to include this
<%@ page isELIgnored="false"%>
in your JSP page.

And see whether it works.
As it's going to override all the previous declarations/steps which might be resulting to this problem.

I think, it should work.

Regards,
Khushhal


rgrds,
Khushhal
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Rina,
if Weblogic 8 does not support servlets 2.4, I strongly recommend you to get a servlets 2.4 compliant container to study for the exam, or may find it difficult to get on with the examples of your book.


[My Blog]
All roads lead to JavaRanch
Rina Magro
Ranch Hand

Joined: May 25, 2006
Posts: 63
is it only EL i wouldn't be able to practice on or something else also please?
thanks
regards
Riina
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

2.3 and 2.4 have significant differences. Some of these features will not work properly with a 2.3 container. Tomcat 5.5 is fine.
 
GeeCON Prague 2014
 
subject: jsp:useBean tag Rules