Ravindra Verma

Greenhorn
+ Follow
since Sep 16, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ravindra Verma

You can have request dispatcher object in two ways.
request.getRequestDispatcher("abc"); // #1
or
servletContext.getRequestDispatcher("/abc"); // #2

difference is when you use #1 server will look for the resource abc from current directory. In case of #2 it will start looking from context root so you need to put a '/' before your resource path. In case of #1 you may get in serious troubles sometimes you may need to put whole path like (http://localhost:8080:.........).

Regards
Ravindra
15 years ago
You can get ServletContext either useing ServletRequest object or ServletConfig.
request.getServletContext() or getServletConfig().getServletContext()
15 years ago
This is not possible though you can do it by using some tricks (serialization probably), but still it shows flaws in your design. Inter communication should be based on request parameters only, other application should not be waiting for whole request object.
15 years ago

Joe Lemmer wrote:Hi there,

I have made a superclass and several subclasses which extend it.

The superclass has private instance variables that I assumed the subclasses would all inherit without any issues, but when I try to compile my subclasses, I get the following error:



They are both in the same package and I assumed I was doing the right thing by making all the superclass instance variables private and have getter and setter methods which would also be inherited by the subclasses. Is this not right? Does anybody know where I am going wrong?

Many thanks

Joe


Hey Joe,

I guess private members can not be accessed by sub classes or any other classes. They are visible to same class only. Thing is like you will never share your private things with anyone even your children.


You need to follow a fix pattern.

make class variables private
provide public getters/setters method

Hope it helps.
15 years ago
Adding custom headers are possible in case you send an AJAX request. Other it's browser's work to create HttpRequest object using http protocol and we can't interfere in this process. Instead of doing all this you better use cookies to send that userId, or use url rewriting.
16 years ago
Hi,
This seems to be a configuration problem. Try putting the directory(WEB-INF/classes) in the classpath environment variable before accessing them. Otherwise tomcat can not find these classes.
Thanks
16 years ago