Vikas Bhatia

Greenhorn
+ Follow
since Mar 22, 2005
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 Vikas Bhatia

Originally posted by Ritu Kapoor:
I've found a following question in a mock exam. Pls tell me which is the correct answer.

Code:
------------------------------------------
Which of the following classes would provide the most efficient implementation of a First In First Out queue?

a. ArrayList
b. LinkedHashMap
c. LinkedHashSet
d. LinkedList
e. HashMap
f. HashSet
g. Hashtable
h. TreeMap
i. TreeSet
j. Vector
k. None of the above
--------------------------------------------------
Should not it be LinkedHashMap, LinkedHashSet and LinkedList

But the correct answer is LinkedList.



Look at it from Data structure point of view.

LinkedList - Simple inserts, one after the other, no sorting, no overhead.
LinkedHasSet - Before making any inserts, verify if there are any duplicates.
LinkedHashMap - Key-Map scenario, essentially lookup if a key exists and then take corrective action.

So LinkedList is something that has only the intelligence of either adding towards the end of the last node [again cud be diff if using a SLL or a DLL]

Originally posted by Ahmed Shaikh:
There is admin page(jsp file) which contains different links like's UserManagement etc Inside this UserManagement there will be some links like create User,delete User,Assign Role etc.
what i want to do is when admin clicks userManagement then it has to show all the links related with user(Create User,Delete User etc) in tree structure.
it should work as JTree in Java Swing or we can say like windows tree.




So pretty much like a navigation pane. Ok, think you will have to resort to some client side scripting. You can use javascript to generate the tree and use JSP or a servlet to provide the data for the tree. I dont have a code piece handy rite now, but will see if can quickly write something up.

Originally posted by subrahm puvvada:
i have one situation.
in jsp when u check items and click submit button the checked values are sumitted to the database.that i have done it
if u don't check any one and click submit button then server500 error is comming.
how to handle this situation



It means that you are trying to refer to a value of a parameter, the object for which does not exist.
18 years ago
JSP

Originally posted by Ahmed Shaikh:
Hi All,
plz help me(with example) in implementing tree structure in jsp.

Thanx in advance.



Could you be more specific? purpose etc?

Originally posted by t raju:
How to generate pie charts through jsp
Please give any hints or links to downolad stuff

[ September 20, 2005: Message edited by: Bear Bibeault ]



One way you could use is to use SVG. It does require the SVG plugin to be installed though.

Originally posted by Michael Ernest:
This looks to be more appropriate in Sockets and Internet Protocols. I'll move it there.



It looks more to be a DNS issue than a proxy issue. If the proxy was not letting you go through, then you should have seen a different error message like, "connection refused". Please check your DNS server to see if it can resolve the desired address or not.

Originally posted by Luke Shannon:
Is it not possible to get params from the query string using a doPost?

I have the following URL:



I am not able to get any of the parameters in my servlet. I don't know why.

Here is the doPost:



Any ideas?

Thanks,

Luke




You already might have tried it but have to tried to add the following line to your doget?

doPost(request,response);
I think the default behavior of the containter is to see a request as a get, the moment it sees some parameter being passed back to the servlet. Worth a try??
18 years ago

Originally posted by Sripathi Krishnamurthy:
WSAD (Websphere studio Application Developer) is the best



You can use Eclipse with MyEclipse plugin!
18 years ago
JSP

Originally posted by cocomo organic:
hello, i'm doing the final project now, i'm making a java program that can detect clients in wireless network area and identify them. but i have problems on how can we detecting ip address of a client which connect or in the area of a wireless network with java ? can we do that ? i think we can do that because there's software can do that, but i want to make my own with java and i dont know how .. ??
help me please...

thank you




You can use the java.net package and classes like inetaddress etc to do your magic!

Originally posted by Krish Vasu:
Hi,

Thanks for the update.

We are sending the email content in the text format by writing to a Socket.

What should be ideal charset the client needs to configure in their email client.

I have been informed by the user that they are using Lotus Notes as their emial client.

Pls, advice. Thanks...



Bad idea!!!

Socket connections, although appear to work in a standard way, are notorious when it comes to SMTP server side implementation. For example, not long ago we had a situation, where if the application was sending email via Sendmail server, by doing socket communication on port 25, the body of the email disappeared, but the same code when it ran against Domino mail server ran fine!!!

turned out, that the exact format that u need to send the SMTP commands varies with the SMTP implementation:

for sendmail it is
helo
mail from:
rctp to:

data

subject:

<actual body>

.

With domino, it was
helo
mail from:
rctp to:


data


subject:


<actual body>
.

The number of CR-LF that you put between SMTP commands is different!!!

I would suggest that you resort to using Java mail api as it will take care of all the various permutation/combinations that exist for various SMTP implementations, not to mention it keeps the code clean
18 years ago

Originally posted by David O'Meara:
Here, I'll save you the trouble:

'3' means redirect in 3 seconds. Then have a semicolon and the link that will be redirected to.

Dave



Here is some sample code, that uses 3 files: 2 JSPs and 1 servlet.

index.jsp


TestServletv1


result.jsp


HTH!!!

cheers!

Vikas
18 years ago

Originally posted by Ahmed Shaikh:
Thanx for your reply.
As we are using this forum in it when we post any Question or we reply to any one then after post it took us to a new page and on that page it shows message "please wait we are redirecting to forum".
I want do the same in my application.
plz help ...



You can do the following [pretty sure there are cleaner ways to do this]:

when you are outputting ur message, pass it as a parameter to a JSP which will show that message, plus also will do a timer based redirect to a page that again can be passed as a parameter. Makes sense?

cheers
Vikas
18 years ago

Originally posted by Sheetal Patil:
Hi

Actually I am getting data from Bean which I displays on my JSP Page. I want to export that bean data to excel. I am using poi api to create excel file in JSP. I am able to create that. But the problem is I have one lonk to export data which should open that excel file. But I can't open that file.

Thanks
Sheetal




It almost looks like that the content-type is not being set properly? Would you mind sharing the code?
18 years ago
JSP

Originally posted by saikrishna cinux:
hi,
can anyone please tell me how to get the version of jsp and also servlets?

please tell me the easiest way to do

thanx in advance


cinux



For JSP you can use the JspFactory class to return a JspEngine object

<html>
<body>

<%= JspFactory.getDefaultFactory().getEngineInfo()

</body>
</html>

cheers,

Vikas
18 years ago
JSP

Originally posted by Megha Jain:
Hi,

Thanks for that one................ but still some confusions........ The project in which i am working......... in that we had hardly used servlets.. and we have provided authentications, authorizations..etc using jsp .... if i can do all these things using jsp when why servlet.

because if i have tyo make any changes in files..... i can make that changes very easily in jsp and save........ whereas in case of servlets i have to recomplile them and than again redeploy....

So plz tell.....



1. When you are saving the JSP, you are in essence recompiling the back end servlet.
2. JSP are primarily meant to act as a presentation layer, but can be used for doing "java stuff".
3. I am not sure about your application design, maybe you do not need servlets, but consider a scenario that you are navigating from one page to the other, but in between you need to carry out some business logic, or do something like: send a message, execute a database lookup, write to a log etc., you will find that your JSPs will be cluttered with java code, something that really does not belong in there.

I would say that uptil now, you have not encountered a situation which would demand the decoupling of your business logic from presentation, hence the core of the doubt.

cheers
18 years ago
JSP