ALaxmi Shankaran

+ Follow
since Feb 23, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ALaxmi Shankaran

I am using one BMP whose persistence is one table whose primary key is autogenerated,
Now in ejbCreate method which way is preferred
whether to use the primary key class ?
or not to pass the primary key field in the insert query (as it is autogenerated it will automatically
insert the incremented value)
My EJB method is as like --

public Collection ejbFindCompanyRecords(){
Collection companyCollection=new ArrayList();

try {
-- got connection
-- created statement
-- resultset
-- populated collection
-- closed resources used

} catch(SQLException sqlExc){

} catch(NamingException namingExc){

-- closed resources if any open
}catch(SQLException sqlExc){

return companyCollection;

My Home interface is as like --

public Collection findCompanyRecords()
throws FinderException,RemoteException;

My deployment descriptor as like --

-- proper resource reference here

My servlet part of code --

InitialContext context = new InitialContext();
Object ref=context.lookup("Company");
CompanyHome companyHome=(CompanyHome)PortableRemoteObject.narrow(ref,CompanyHome.class);
Collection companyCollection=companyHome.findCompanyRecords(); // Here it gives exception ..........

I am getting exception as ....

java.lang.ClassCastException: java.lang.String
Hi all
First time i am using BMP EJB
In one BMP i have written one Finder method as ejbFindCompanyRecords which returns a Collection
Also i have declared that in the home interface.
public Collection ejbFindCompanyRecords() throws FinderException,RemoteException;
From servlet ,I am calling this finder method as
Collection companyCollection=companyHome.findCompanyRecords();

it compiles well but while run time it gives me casting exception
I am confused wether to create the remote instance or not...
I am using struts 1.0. I want to do client side validations.
If i do that in the validate() method of the ActionForm class ,then will it be executed on server side.
As in the struts1.1 i can use the validator framework,what strategy shd i follow in struts1.0.
19 years ago
I have one servlet method .In that depending upon the different request(From 2 different jsp pages ),i want to redirect to 2 different pages .
How can i get that from where the request comes?
19 years ago
If in a servlet i get a parameter from a jsp.
And from that method only with the RequestDispatcher,i forward the request to another jsp,
then whether the request object retains in the second jsp also , i mean can i again get
that parameter over there?
19 years ago
In callable statements what exactly registerOutParameter does?
e.g storedProc.registerOutParameter(1, java.sql.Types.VARCHAR);
Can the finder methods be called from the servlet.

Which is the better option 1) calling them directly from servlet
2) write a wrapper method in session beanto call them ?

function validate(){
if((document.all.filname.value=="") || (document.all.filname.value==null)){
alert("Please enter filename");
return false;
//code to submit the form
return true;
I am facing one problem one field in my jsp is of the input type - file
onblur of that i have written one js function and checking for some validation
and then returning true/false accordingly but in this case my page get submitted even though
the function returns false can anybody has solution?
In EJB ,while creating home object we often narrow it as

Context context = new InitialContext();
Object homeObject = context.lookup("Example");

ExampleHome examplehome = (ExampleHome)PortableRemoteObject.narrow(homeObject, ExampleHome.class);

Then in case of remote object instead of using the same way as
Example example = (Example)PortableRemoteObject.narrow(examplehome.create(), Example.class);
why the following way is preffered?
Example example = (Example)examplehome.create();

Is casting differs in these two case??
Can anybody tell me how to use the shortcut keys to display a particulat url in a java program using javascript
when i use any simple query like
select quantity from purchaseorder where ponumber=somenumber
then if record is not present then it returns false for if( which is correct
but when i am using the query as
select max(quantity) from purchaseorder where ponumber=somenumber
then even though no records presents then also returns true for if( why it is so?
In many interviews there is frequently asked question about life cycle of the servlet
I know the init(),service(), and destory() methods well
But how to answer this question up to the point (how much scope)
And please can u explain about
Do not override service() method.
19 years ago
In one interview ,interviewer asked me one question as....
Why we require two seperate interfaces as home and remote?
Can't we declare the methods (we do in remote) in the home interface only?
I answered that to hide the business methods from the client,
as the client has direct access only to the home interface..
Is it correct?
Please guide me.