Piyush Mangal

Ranch Hand
+ Follow
since Jan 22, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
24
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 Piyush Mangal

Tim Moores wrote:Even if the requests are sent simultaneously -assuming that's the question, I'm not sure- it's unlikely that they would arrive simultaneously at the server after traveling over the network. And even if they arrive simultaneously, it's not a given that they will be processed concurrently.



If they arrive simultaneously, then chances are very high that they will run concurrently unless server is experiencing thread starvation.
11 years ago
I will go for Head First Servlet and JSP.
11 years ago
How are you setting the classpath?
11 years ago

suppose if any websites (web application which is hosted in internet) and if it gets multiple requests at a time will the container creates multiple instances to the servlet component ?(if that web applcaition is developed using servlets as web resource program
). for example just assume xxx bank site getting lots of requests at a time..?



That is where clustering and load balancing comes into picture. You deploy multiple instances of web server and load balancer manages the load by dispatching the request to the appropriate server.
Even databases are also clustered to achieve the desired scalability.
11 years ago

@Piyush Mangal : Can you please what needs to be done in order to have this css file link added to response ?


Well that depends on how you are outputting the other HTML part as of now.
11 years ago
There would be two requests from your browser to your server. This 2 requests will be processed concurrently by 2 threads and they both will be executing the service method at the same time.
11 years ago
Well you should not be generating HTML response directly in the servlet, rather should hand over the responsibility to a JSP page. To your question, yes you can inject css tag in servlet response but that does not mean you should.
11 years ago
You will have to fire a request to server no other option. Putting database access in JSP would not be a good idea so you will have to live with Servlet only.
11 years ago
JSP

Palak Mathur wrote:

Piyush Mangal wrote:There can only be a single instance of a servlet at any given point of time. All concurrent requests are processed by a sever by having multiple threads executing on a single instance of a servlet. So in a way, your servlet is already singleton.



Are you sure? Is it multiple thread on single instance or the servlet container creates a pool of instances for a servlet to handle concurrent responses?



Yes, We are talking about Servlet not StatelessSessionBean here. Moreover A container might load or unload a given servlet based on the load on the server but there would be only single instance of the servlet.
11 years ago
All the resources under WEB-INF are secure and can not be publicly available. Ideally all the secured resources are put in WEB-INF folder. Only servlets and JSPs can access these resource under WEB-INF. As browser sends another request to load image as it encounters the same in an HTML page, that is why you are not able to see an image on screen.
11 years ago
There can only be a single instance of a servlet at any given point of time. All concurrent requests are processed by a sever by having multiple threads executing on a single instance of a servlet. So in a way, your servlet is already singleton.
11 years ago

String lastdepo = (String)session.getAttribute("sesiDepo");



Are you setting sesiDepo in session anywhere? All other fields are requet parameter.
11 years ago
JSP
You can use single sign on.
11 years ago
JSP
Why do you want to reinvent the wheel. You already have them implemented for you http://java-source.net/open-source/connection-pools
11 years ago
JSP
Please do not put this code in your JSP. Have a servlet do this calculation and then forward the request to jsp.
11 years ago
JSP