Preethi Chaloori

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

Recent posts by Preethi Chaloori

Hi! Dilip,
I would definitely think that the problem is "memory leak". Since you mentioned connecting to the database, do check to see if you have closed all the necessary streams and connections once you are done with them.
I agree with paul. You need to have some print statements all over your code to debug.
Good Luck
Preethi
23 years ago


Hi! SivaKumar,
I do not believe that the compiler will complain about the ";" at the end.
It generally shouldn't matter but you could try doing this:

String title = ServletUtil.headWithTitle(" Hello WWW ");
out.println(title+........whatever your code );
Preethi

Originally posted by Sivakumar Jagadeesan:
Hi everybody
I am using tomcat3.1 in windows98 machine
it works fine
But i was not able to compile these program
ServletUtil.java
package test ;
public class ServletUtil {
public static final String DOCTYPE = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
public static String headWithTitle(String title){
return (DOCTYPE + "\n" +
"<HTML>\n" +
"<HEAD><TITLE>" + title + "</TITLE></HEAD>");
}

};
Hello.java
package test;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Hello extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException , IOException {

res.setContentType("text/html");
PrintWriter out = res.getWriter();
out.println(ServletUtil.headWithTitle(" Hello WWW ") + "\n" +
"<BODY>\n" +
"<H1> Hello WWW -- BY Siva </H1>\n" +
"</BODY></HTML>");
}
};
These two file are present in the c:\tomcat\source\test
I am generating the class files in
c:\tomcat\webapps...\classes\test
when i compiled ServletUtil it did well , but when i compiled Hello.java the compiler was sayin that it can't undestand
ServletUtil.headWithTitle(" Hello wwww");
can u pls help me in this
Thank you
rgds
Siva


23 years ago
Hi!Ben,
I think the problem is more related to the Casting in general than specifically to the bean that you have written. There are certain rules you need to follow when casting.
The ClassCastException is generally thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.
I am new to EJB too and there could be something that I do not know.

Good luck,
Preethi
Hi!Tom,
Following are the main things you need to write custom jsp tags:
1. Write a Tag implementation class. Your class must either extend TagSupport or BodyTagSupport classes( Which in turn implement Tag interface). Give your imple in appropriate method
2. Create a TLD file(tag Library discriptor file) to define your custom tags. Shortname is generally the prefix that your planning to use. The <tag><name> is generally the suffix you are planning to use.
<tagclass = takes the absolute path of the class file>
eg: <preethi:customtag>
3. Create a jsp file and include the following line
<%@ taglib uri="name of the tld file" prefix="shortname" %>

use the custom tags whereever you want the desired behavior
Now once everything is in place, the following steps are needed if you are using Tomcat:
1. create a web.xml file or copy the one they have already provided in the examples and follow the setup. You need to give your tld file name here.
2. Copy the manifest file from the examples
3. create a war file. It will create in your current directory. Cut and paste it into WebApps directory.

4. Open the server.xml file and to the end add the path. You will be using this to test your jsp
Well, make sure the server is running and the type in the location of the jsp page and you should see the results
If this dosen't help you go to
www.javasoft.com and type in JSPTag Library tutorials in the search and you will be all set.
The key point is that all the files should be in the right directory structure.
Preethi :-))
23 years ago
Hi! Dilip,
Just to give you an idea....
I think the problem has to do with the "caching" in your browser.
Try clearing the cache or try looking up more info.
Good Luck
Preethi
23 years ago

Hi!
See if this helps
Establish the JNDI initial Context.
Locate the Home interface of the Enterprise JavaBean using JNDI.
Use the Home interface instruct the Container to create an instance of the Enterprise JavaBean.
Preethi

Originally posted by Dheeraj Thakur:
I've created an application using Entity Bean and have deployed it successfully using Inprise AppServer 4.0 but when I am calling this bean from my client program/servlet I get an exception which says...
javax.naming.NoInitialContextException: Need to specify class name in environment or system property: java.naming.factory.initial
and says it is something to do with the naming lookup (JNDI).
I tried to run the same application on another machine and it works fine there.
Can anyone tell me what setting needs to be done in the first machine to set this right.


Hi!
If you want to use servlets and jsp's only the Tomcat should be quite sufficient(any web server). But if you plan on using ejb then you need an application server.
i don't think you should have any problems if you install both but use only one. Because if you have to deploy your servlets you have start the specific server on which you have configured all your class files, jsp's, htmls etc in order to see your output
Please correct me if I am wrong
Preethi

Originally posted by Sankar Subbiramaniam:
Hi,
Currently i have installed Tomcat server. Now i want to learn and develop EJB. So i am planning to install Orion server. Will there be a conflict b/W Orion and Tomcat ? If so can i just use Orion server alone to run my servlets and JSP ?
Please help.
regards
sankar


Originally posted by sean cee:
Hi, I have an interesting Q for you!
public class AQuestion
{
public void method(Object o)
{
System.out.println("Object version");
}
public void method(String s)
{
System.out.println("String version");
}
public static void main(String agrs[])
{
AQuestion a = new AQuestion();
a.method(null);
}
}
will print "String version" according to the answer
I have no idea about this one..
AND if the (Object o) is replaced with (StringBuffer sb) then compiler error 'cos java doesn't know which method I am refering to.. so.. I guess there is something about Object class..
Can someone tell me why? Thanks.


************************************************************
Hi! Sean if I understand you correctly, your intention is to pass in an object reference to the method "amethod" and see the output as "object version".
Well, it is possible if you actually pass in an object reference.
When you say,
1.StringBuffer buf = new StringBuffer(),
you are creating an object of type StringBuffer and so now you can pass in that reference to amethod() which is expecting an object.

2.StringBuffer buf;
Here an object is not created. You are just declaring a var of type StringBuffer.
So, when you try to pass in that variable the compiler will complain.
Hopefully this answers your question. If I have misunderstood you please disregard this answer.
Hi! Sagar,
For Q4: My answers would be C and E
First declare that the method throws an Exception(E) and in the method at Line 4 insert the statement which actually throws an exception(C)
For Q5: Regarding handling ascii code, I would assume he is asking about converting from ascii to bytes and vice versa in which case only "InputStreamReader" and "OutputStreamWriter" can be used.
Corrections are welcome
Regards
Preethi Chaloori
Hi!
I agree with Anbooo. 2 Objects are ready to be GC.
String x= "Red";
String y="green";
x="hello";
x=y;
x=null;
Initially var x hold the address of object "Red" and y holds the address of object "green".
Then another object "hello" is created and added to the pool and its address is placed in var x. So, now the var x holds the address of object "hello" and not "Red".
"Red" is dangling
After this a copy of address that y holds is placed in x. So, now x has the address of the object "green".
"hello" is dangling
now x which points to object "green" at this point is set to null.
"green" does not dangle because x was only holding a copy of the address and not the actual address.
Actual address is with y and it still points to object "green".
So, Finally we are left with 2 dangling objects which can be garbage collected.

Please correct me if I am wrong
Regards,
Preethi :-))
Hi!
There are two important points regarding Anonymous classes.
1. Anonymous inner classes may implement an interface
The syntax for this is:

new InterfaceName(){
// body

}
where, we should assume that there are hidden words between the "new" keyword and "InterfaceName" which are "class" "implements"
2. Anonymous inner classe may extend another class
To extend an existing class, the arguments for the superclass constructor may be placed in the argument part of the new expression,
new SuperClass(Message){
//body
}
Here again, "class" "extends" is hidden.
This is what I have understood so far about the anonymous classes. I may be wrong. So, please feel free to correct me.
More info can be found in RHE
Regards,
Preethi :-))
Hi! Hopefully this helps,

byte-->short--> int --> long --> float -->double
char--->int
As long as the direction is upward it OK. But the reverse direction is "not OK".
Assigning short to int--long--float--double is Ok but you cannot assign int to short or short to byte.
As for byte and char, byte is 8 bits and char is 16 bits. The short is also 16 bits. So, the only place a char can fit in, after these two are left out is an int, which is 32 bits.

Please correct me if I am wrong.
Regards,
Preethi
Hi! The name of the outer class "AbstractOuter" is kinda misleading. The outer class is not abstract. Only the inner class is abstract. It has an abstract method which is implemented
in the subclass "newAby"(which is legal becus Abstract classes cannot be instantiated but can be subclassed). The outer class has a method "makeInner" which creates an instance of the subclass of the inner class( legal because "newAby" is not abstract). Then using this instance the "amethod()" is invoked.
When an instance of the outer class was created in main() and the "makeInner()" invoked, it in turn created the "newAby" instance and invoked the "amethod()", thus printing out the message
"this comes from the abstract inner subclass".
Hope this helps.....:-))
I may have missed out something or there may be an error, so please feel free to point it out.
Preethi