PNS Subramanian

Ranch Hand
+ Follow
since Jul 13, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by PNS Subramanian

Have a question here - i specify my <url-pattern> as "asdf" and i do not have any such folder in my file system. In this case how do we include <url-pattern> as a part of the full path ?



The full path of the servlet is
\webapps\ROOT\WEB-INF\src\com\servlet\TestServlet.java

The declaration in DD is
<servlet-mapping>
<servlet-name>Test1</servlet-name>
<url-pattern>/asdf</url-pattern>
</servlet-mapping>



I am not very sure if <url-pattern> would be a part of the full path.
Yes we do place it inside WEB-INF or a sub-directory within that. But then, we would have to specify that explicitly in the JSP file such as /WEB-INF/<tld dir> etc... That would set it right.


My understanding is that most servers will pass a doHead() request through to doGet()



This is what i observed when i tried setting action="HEAD" in my JSP page calling a servlet with doGet and doPost implemented. Infact, all calls except the one with action="POST" were directed to doGet() method.

This raises a question - how/where do we use doHead() method then ?
The following works


<%@ taglib uri="testEL.tld" prefix="classic" %>



Need to ensure that the "tld" file is in web application context root folder.

Env : Tomcat 5.0.30/Win XP.
This is about code that gets called from POJO. There is no EJB involved here. Its a Java to backend SP call.
Appreciate your detailed reply.

Here i am actually talking about temporary tables - whose life time is typically the life time of the connection object.


"Two different client threads could access the same table through two different connections. ."


Theoretically, i suppose the above should not happen since each Connection object (each session) would have its own temp tables.


Every call to this method will try create/override the existing temp tables.


Won't the temp tables be dropped when the connection object is closed at the end of the method ?



Every call to this method will try create/override the existing temp tables.


Arent these temporary tables created in different sessions (connection objects) ?

As stated earlier the temp table gets created after the connection object - i.e scope is restricted to that of the life time of a connection object. Due to some reason we find multiple temp tables getting created after the request gets processed i.e control comes out of the method, which i feel shouldn't be happening considering that the connection object is closed within a finally block. The issue here is one of temp tables not getting dropped.

I hope i've been able to make the problem more explicit.
I am not sure if this is the right forum, but since it falls within the perview of J2EE application i've posted it here.Please re-direct if otherwise.

In a web-based application, when we create a connection object inside a static method, what are the implications. For instance if the method does the following


1) Create connection
2) Create temp table
3) Insert into temp table
4) Call SP
5) Return from SP
6) Close connection


Is this code fool-proof against synchronization - are there chances of 2 threads using the same connection object and hence the same temp tables ? Is there a possibility of multiple temp tables being created ?
Edmund,

Try placing AddressBean inside a package for instance WEB-INF\classes\com\bean\AddressBean.class.
My understanding is as follows


What ever is mentioned in the <http-method> </http-method> tag is CONSTRAINED since it is within the <security-constraint> tag.

<security-constraint>
<web-resource-collection>
<web-resource-name> <web-resource-name>
<url-pattern> </url-pattern>
<http-method> </http-method>
</web-resource-collection>
</security-constraint>



Any other views on this ?
This is from API documentation


setHeader
public void setHeader(String name,
String value)
Sets a response header with the given name and value. If the header had already been set, the new value overwrites the previous one. The containsHeader method can be used to test for the presence of a header before setting its value.



Hope this helps.
A couple of things here

1) Isnt it request.getRequestDispatcher ?
2) I tried simulating the same - i did not get any exception when calling the second servlet without a doGet() method. The second servlet however, did get initialized.
3) When i included a doGet() method in the second servlet it(doGet() method) was called.

Env : Tomcat 5.0.30/Win XP
A similar one


_________ pattern provides a layer between clients and subsystems of a complex system; shields clients from subsystem components, making the subsystems easier to use
Singleton
Facade
Business Delegate
Template Method



Can anyone take a shot at this one ? Would the exam have such questions ?

My answer was Business Delegate while the answer given is Facade !!!
http://java.about.com/gi/dynamic/offsite.htm?zi=1/XJ&sdn=java&zu=http%3A%2F%2Fwww.podar.net%2Fscwcd%2Fstartexam.htm
Hi Shiva,

Agreed with what you have said about Facade. When you consider a work flow like system(a facade calling mulitple EJB's) would not the Session Facade be reducing the number of network calls i.e network traffic ? If a session facade is not available won't the client have to make multiple method calls to the EJB tier to accomplish the same task ?

I've come across in Wrox J2EE programming(Volume II) that reducing the network traffic/number of calls is one of the advantages of Facade pattern.
This is from one of the Enthuware mock tests


Which of the following design patterns is normally used to reduce the number of remote calls made by the clients to the server?
Business Delegate
Model View Controller
Facade
Factory
Value Objects



The answer given is Value Object. Why not Facade - doesn't a Facade reduce the number of method calls ?
We use Sybase Adaptive enterprise server.


Is there any limit on the number of sql queries that can be executed using a batch statement ? Would there be a performance hit if the number of queries exceeds a certain value ?