• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Legal value for env-entry-type

 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

If I define a class of mine.
And that has a single argument constructor which takes a String or a single Charcter as an argument.

Let the class be Test.
And it's under package com.scwcd

Then,
Is the entry
<env-entry-type>com.scwcd.Test</env-entry-type>

valid??

Regards,
Khushhal
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<env-entry-type> can be any type that takes a single String as a constructor
parameter (or a single Character if it's java.lang.Character).

My doubt, if I have a class that takes a char as constructor argument.
Would that do, or it must be java.lang.Character in case of single char
constructor parameter.


Thanks,
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Christophe,

It means now if I add

<env-entry-name>test</env-entry-name>
<env-entry-value>10</env-entry-value>


to <env-entry> element.

Then when I will use the name test, it will refer to instance of my class which is created by passing "10" as an argument to the class single argument constructor.

And if it a remote component, I do have to register the name test with registeries.

Is it so Christophe??

And Chandra for your problem, I think that will do..

Regards,
Khushhal
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chandra,
I don't think primitives are allowed. Maybe that would ok with Java5.0's autoboxing feature, but not for Servlets2.4 (which uses JDK prior to 5.0). I think you'll have to use a Character class for your constructor.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then when I will use the name test, it will refer to instance of my class which is created by passing "10" as an argument to the class single argument constructor.

Yes, that's right. This will refer to an instance of class com.scwcd.Test registered in JNDI, and whose value is set to 10.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe,

That was not what I meant; I meant apart from Character class if I have one
class that takes char as constructor argument, would that do in that place?


Thanks,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I don't think it will do, you have to use java.lang.Character, not char. (my previous reply still holds )
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe

I think it works for all the classes that accept single String as an anly argument or a single character(primitive) for java.lang.Charater.

Then how come it can work for a Class that accept java.lang.Character as an argument?

Regards,
Khushhal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic