Shankar Narayana

Ranch Hand
+ Follow
since Jan 08, 2003
Merit badge: grant badges
For More
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 Shankar Narayana

Hi,

Take this example


In the first case for 'nullStr', no String object is been created, whereas for 'emptyStr' a String object is created with value being empty.
16 years ago
Hi all,

I am bit confused..are all static methods synchronized by default?
[ October 11, 2006: Message edited by: Shankar Narayana ]
17 years ago
Hi,

You can create your own custom Exception classes and pass on the request, response objects to it.. so that it knows what to be sent back to the servlet as an error message.

Another way would be that all other classes will just throw the exceptions and it is caught at the servlet's doGet or doPost method.


shankar.
17 years ago
Probably you might be getting whole page soure in one line and the method indexOf("http://") finds the first occurence and gets out.

cheers,
shankar.
18 years ago
Hi,

Your manifest file should be something like this.


Main-Class: MyClass



and make sure that the text file(Manifest.txt) must end with a new line or carriage return. The last line will not be parsed properly if it does not end with a new line or carriage return

cheers,
Shankar.
18 years ago
It compiles without an error for me. When I execute the command java -version on my console I get this

java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

18 years ago
Hi All,

I am always having this doubt bouncing back into my mind everytime I read something about thread-safe issues. I have developed a web application which follows the MVC architecture although its not using Struts. I am just worried about my database program which performs database specific operations. This is my class...



My concern is that whether all the methods which does some execution (methods starting with execute) needs to be synchronized and static.


thanx.
shankar
Only one time..
18 years ago
Hi,

Can anyone give an example of why to use GenericServlet, I know if we want to use other protocol than Http we use GenericServlet, but an example application would be helpful in knowing what servlets can really do.

Thanks,
Shankar
18 years ago

Since you use the term request...

If you're in a Servlet environment things are different again.

The Servlet itself is always multithreaded per request, so every object
you instantiate might very well be overwritten by the other thread
from the other request - if you place its declaration in a servlet scope.

Please explain a bit how your environment looks.



I am indeed in the Servlet environment, what do you mean by overwritten by other thread, can you please provide with an example. My setup is almost similar to MVC architecture, each request sends 2 parameters (requestType and beanType) and depending upon these 2 parameters a new bean instance is created and I have a method in one of the beans which actually gets the next sequence number from the database, which is used as primary key. Now since the primary key generation should be unique, I should synchronize this method, it means it should be a static method or can it be instance method. If it is an instance method synchronization isn't really helpful right?.


Thanks,
Shankar.
Hi all,

I was studying regarding synchronization and i am bit confused about the terms Threads, processes, and instances. My confusion is we use synchronization when multiple threads try to access a method, now if the method is an instance method does it really need to be synchronized. I have a case where each request is creating a new object and that object has a method which is getting a unique value from the database, now do i need to synchronize this method or should i make that method static and then synchronize.

I hope you people are getting my point, I appreciate your responses very much.


Regards,
Shankar.
Hi all,

My application contains, Servlet, beans and jsp's , now for each request a requestType and beanType are passed as parameters and depending upon those parameters the servlet creates a new instance of the bean every time and i am making the bean object created to refer to NULL in the finally block. Does this sounds like a good approach?, any performance issues? what are the other procedures for a basic web application, I am not using any framework although its very much similar to Model 2 architecture.

Regards,
Shankar.
18 years ago
Hi,

What I do basically to get around with this type of problem is create a sequence table for ex: for table name 'abc', i have the corresponding sequence table 'abc_sequence',which contains a single field 'sequence_id' and before you update 'abc' table, u insert a record into 'abc_sequence' table and get the 'sequence_id' which will be the primary key for abc table.

This way you can work with any database.


Regards,
Shankar.
Hi,

What is the datatype for that column in the database, basically it shoudn't be a problem, try to refer to the column value where you are getting empty string, might be that column hasn't got any data in it.


Regards
Shankar.
Hi,

I am sure there will be some other way of achieving the thing with JSP which you believe ASPX does. Can you give an example of what you are trying to achieve?

Regards,
Shankar.
18 years ago
JSP