Shridhar Raghavan

Ranch Hand
+ Follow
since May 27, 2010
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 Shridhar Raghavan

Hi,

So any suggestions of what i could do? I would want to write both HTML and binary output back to the user. Preferably not design another action for getting the excel.
8 years ago
JSP
From the servlet, can i send back both the html and the excel binary at the same time?
8 years ago
JSP





The first snippet is the jsp code. I basically want to display both the html content and send across an excel representation of the html content. The second code basically generates an excel and writes that excel to the response. Now how do i accomplish sending across both html and excel. I am presently getting a "getWriter() has already been called" ie IllegalStateException error. The control comes to the JSP after a forward from a servlet. The third code snippet is the forwarding.
8 years ago
JSP




Hi,

The first code just is a form which acts a filter. On submit, i make an AJAX call to a servlet which gives me some html code. The data in the call back is like this "<table><tr><th>Col1</th>........". When i try to set this data to the div "txthnt", the table briefly appears but then disappears. Is there something about the div i am not aware about. How do i display this html code?
Basically i didnt like redirecting to a new page and losing the form elements. I needed the resulset to be displayed alongwith the filters in the same page. And i was wondering whether there was a cleaner way of achieving this than making an AJAX call to a servlet which writes to a response (response.getWriter.write("the response html tables would go here")) and we set the response in some div in this same html page? I dont like the idea of building html code in a servlet
8 years ago



Hi,

So the first snippet is my html page which calls the servlet and submits the parameters. The second code is the servlet class whose duty is somewhat like a shopping cart. Maintain a list of records, and on the final submit button persist, the list. The problem i have right now is i do not show the list in the same page but in the servlet page. I would want to be able to show the list in the same page. Is this possible? I'm thinking AJAX, but is it possible in any other way and without the use of frameworks. It's a relatively small req?

8 years ago
My JSP code is something like
<>

The ajax code in the callback ie the function that receives the response from the server does something like this



When i inspect the response in the browser, the response also contains some html code at the fag end after my payload.
When i looked at the servlet code in the work directory, the servlet code compiled adds some "<head><html>" code to the output stream.

I however have not added such code. Any reasons?
8 years ago
JSP
Hi,

Through an ajax call to a JSP i wish to send across information. In the JSP, i invoke reponse.getWriter().write(someCommaDelimitedString).

However when i try to access the data in the call back in ajax through xmlHttp.responseText, the responseText contains some <html> code which i did not include. How do i access only my data or send across data in an easy format to retrieve.
8 years ago
JSP
Hi,

I get the following exception when i request the same JSP after a long time has elapsed. Restarting the server resolves the issue. I wanted to know when can this occur.
The duration between two requests is usually around 24 hours. Does that have anything to do with it? Or is it a memory issue?


HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:498)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

java.lang.NullPointerException
org.apache.jsp.index_jsp._jspService(index_jsp.java:169)
8 years ago
JSP
Pretty neat reply! Could you tell me where could I get a high level view of the mysql database implementation. Somewhere besides the manual. Also if someone could explain how jdbc works with mysql with respect ,to if a thread executed a cReate,upadte,delete operation on a table at the same time as another does something similar, would it fail or go through? If it fails is there a way around this? Finally, how do maxConnections variable operate. Can it be visualized as max client requests to server?
Hi,

I wanted to understand in what scenarios can db updates throw a table lock exception. I want to design an app which supports concurrency to it's full extent. It would be helpful if someone could tell me "when" table locks could create problems and "how to code keeping in mind such scenarios." For instance is it possible for two threads to simultaneously update and delete the same table or "operate" on the same table. What actually happens when i invoke an "executeQuery and executeUpdate" from my java program.From the terms of database operations when dealing with transactions ie. the lock is a db concept for dealing with concurrency. Any other concepts like the maximum number of concurrent "connection" to a database. What is the rationale behind that?
Hi,

First i desire to persist a long row id in the database and not an object identifier. Secondly, at present i do not foresee requiring the id to be unique across machines. But rather than exploit sequences by the databases i would like to write a unique id generation algorithm. So i was searching for mechanisms to achieve that using present tools.
8 years ago
Hi,

Could someone clarify the doubts I raised.
8 years ago

Any modern computer can generate millions of objects in a millisecond. So System.currentTimeMillis() is too slow.

While speed in this context is an issue i can work around this by creating a large enough set of row ids before catering to any request right?

If your program is multi-threaded and you have a multi-core CPU, then different cores might be creating objects at the same time

Can i work around this using thread synchronisation and separate the row id generation routines from being thread aware? I mean when a new thread is spawned, each thread does not create a new row id, but rather fetches a row id from a collection of possible values. This fetching can be thread safe and the creation process of row ids can be separated.

If the system clock is adjusted

This is problematic. Will think on this. Any comments on the above?


8 years ago
Hi,

I wanted to explore various patterns to generate a unique long value. I had a few queries regarding currentTimeMilllis with this regard. First what exactly does the api mean when it says the actual granularity of the return value is OS dependent. Do they mean to say my Mac does not time 1ms as the standard 1ms and instead evaluates 1-2 ms in real time as it's 1ms. Or are they suggesting that it isnt precise?

Now with this mind, what are the limitations of unique currentTimeMillis as a standlone unique id generator? Should i club it with somthing more unique like a mac address or something. Any other suggestions?
8 years ago