Maybach Smith

+ Follow
since Dec 22, 2004
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 Maybach Smith


Vector vec = new Vector();
ListIterator iter = vec.listIterator(); is perfectly valid as Vector extends from AbstractList and no
message should be thrown as cb gthri has pointed out

Am i correct ? Please correct me if i am wrong.This is just for my understanding.

Using ArrayList as pointed by all would be better

[ May 18, 2005: Message edited by: Maybach Smith ]
[ May 18, 2005: Message edited by: Maybach Smith ]
15 years ago
In Session Beans,the ejbRemove() can be called by the container at any time.The bean could be returned back to the pooled state or it can be removed.This implementation would be container specific.

This has been clearly specified in Ed Roman as follows -
Note that some containers will give slightly different outputs than others - it is all implementation specific and is part of EJB product documentation.
We need to keep this in mind while debugging.

Hope this helps.
Hi cb gthri,

Please find the following lines taken from Core-Servlets and JSP by Marty Hall.This would help you understand why we should not override the service method in HTTPServlet :

1.You can add support for other services like doPost,doGet,doPut,
doTrace, etc., perhaps in a subclass. Overriding service
directly precludes this possibility.
2. You can add support for modification dates by adding a get-
LastModified method. If you use doGet, the standard service
method uses the getLastModified method to set
Last-Modified headers and to respond properly to conditional
GET requests (those containing an If-Modified-Since
header). See Section 2.8 (An Example Using Servlet Initialization
and Page Modification Dates) for an example.
3. You get automatic support for HEAD requests. The system just
returns whatever headers and status codes doGet sets, but omits
the page body. HEAD is a useful request method for custom
HTTP clients. For example, link validators that check a page for
dead hypertext links often use HEAD instead of GET in order to
reduce server load.
4. You get automatic support for OPTIONS requests. If a doGet
method exists, the standard service method answers OPTIONS
requests by returning an Allow header indicating that GET,
HEAD, OPTIONS, and TRACE are supported.
5. You get automatic support for TRACE requests. TRACE is a
request method used for client debugging: it just returns the
HTTP request headers back to the client.
15 years ago
Will try and answer a few ....Folks correct me in case i am wrong !

Have a few doubts regarding applet-servlet communication.Will some one pl help?

(1) Is there any advantage in using applet as front-end for communication with servlet over say JSP? If so what are they? and when should you use an applet/JSP?

(2) I am using an applet as front-end and has got two buttons ,"Register" and "Get Details". It sends a serialised object to the servlet.
(i) Now, in the servlet,how can i find out which button has been
clicked in the applet?(like getParameter("Register") method, using
request object, is there any way to determine which one has been
clicked in applet?)
(ii) How can you pass a parameter to the constructor when the object is
deserialised in the servlet?(because you will be using
ObjectInputStream and then casting it, to get back the object.)

(3) What is the difference between ServletOutputStream and PrintWriter?

(4) Can Hashtable and Vectors be serialised properly?

(5) Is is enough to have just one connection to database to cater to all the requests that comes to a servlet?ie. do you need one connection each for every request that ask for data from datatbase or only a single connection that the servlet may create in init()?

(6) Whats the difference between service(HttpServletRequest...) and doPost(HttpServletRequest.....)/doGet(HttpServletRequest.....)?When do you use them?

Thanks very much

1) When the gui is very rich - in the sense if there are multiple tabs and child tables in each of the tabs and you have very complex validations in the client side like if field 1 has a value make the child table 1 mandatory and tab 2 mandatory else tab 3 mandatory etc - then applet can be used.But at the same time think abt the speed and security aspects as well.

2) When you are using two buttons in the applet why not just add a value that would take the mode (set this value as 1 in case "Register" is pressed else 2 in case "Get Details" is pressed - which can be an int and this can be passed along with ur object which is serialised) and retrieve this int from the object in the servlet and do the processing ..

5) Why cant you use a connection pooling(DataSource) and open and close connection per request ? Depends on the load as well...

6) HTTPServlet overrides the service method and has implemented doPost,doget etc ...So in case your servlet extends HTTPServlet and you override service then obviously you cannot have support to doPost,doGet etc ...

May be it helps ...
[ February 10, 2005: Message edited by: Maybach Smith ]
15 years ago
This has been nicely explained in Mastering EJB2 by Ed Roman.Have you read that?
Yes you can...

Probably go through this - It may be useful
15 years ago
Arent there any need for handling some transactions ? Is it always read and display ?
In case there are transactions to be handled,go with Session facade.Also,Use SessionFacade Pattern to avoid direct client access to Entity beans thus reducing network calls...
If the system just retrieves and displays then you can just go with Composite Entity beans.
Just keep this in mind when you design -
The Composite Entity Pattern improves performance significantly by reducing number of entity beans in an application provided the relationships between the tables have been designed well to support the same.
Folks,please correct me in case i am wrong .. :roll:
[ January 31, 2005: Message edited by: Maybach Smith ]
JSP declarations do not have access to automatically defined variables like request, response etc.
Please go through this
for understanding this.
Also,check Ben has already pointed that you cannot access request in declaration.
[ January 28, 2005: Message edited by: Maybach Smith ]
15 years ago
JSP declarations do not have access to automatically defined variables like request, response etc.
Please go through this
for understanding this.
15 years ago
Have a look at this and see if this is useful -
15 years ago