Qualtar Demix

+ Follow
since Mar 14, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Qualtar Demix

Hmm. So, looking at all the approaches it would be safe to say that no-matter-what (or how for that sake), one has to convert it to Set one way or the other. Hence, the worst cast time complexity will always be O(n). Guess i have to close in on O(n).
8 years ago
To check if a List has duplicate entries i convert it to HashSet and compare the size for any mismatch. Do you guys have any better approach???!!!
8 years ago
Problem resolved finally....
Instead of using port 8080 i used the port given in tomcat logs (8085 in my case)....
And no mapping is needed in web.xml. We can simply write the web.xml with headers and no mapping. It will not load any class but the first form page loads just fine.
Thanks Vinod,
I did the proper mapping in my web.xml and now the tomcat server is starting without any exception. But i don't understand. I haven't created corresponding class. Why do i need to write web.xml. All i want is to run my form.html on a browser. Shouldn't i use a simply blank web.xml.

Also my form.html is not opening. Browser says "Unable to connect".
I tried netstat -aon on my command prompt to see which pid is using port 8080 but the result shows that no service is using 8080.
URL i typed: http://localhost:8080/Coke-v1/form.html

When i start tomcat it gives the following log:

My directory structure is:

I know this question has been asked before, but that solution does not work in my case.
I added users in tomcat-users.xml, but to no avail. The issue persists.
My tomcat-users.xml looks like :

i am using apache-tomcat 7.0.26

**On a side note :
What effect would running apache have on this?
I have started and then stopped apache from taskbar. Still, no effect.
yes i am getting the values as well.

9 years ago
thank you Amit.............thanks a lot......i got the HTML/form page
it is working.............
9 years ago
My directory structure is:


and to deploy i simply (Run as->Run on server) on TestForm.java
9 years ago
Punit i am still getting 404 error on typing this url after running my servlet class


i did some more research and i found this:

The portion of the URL after the http://host:port +WebAppName is compared to the <url-pattern> by WebLogic Server

The url i am getting is : http://localhost:8080/Punit_Project/TestForm (Punit_Project being my "Dynamic Web Project")
Therefore if i don't give any WebAppName it takes the project name as the WebAppName.

In your url passValueProblem must be the WebAppName.

So, can i safely conclude that </display-name> attribute in web.xml defines the WebAppName ???
9 years ago
Thanks a lot for narrowing down the problem........

this is because there was no request!!

means that i am not able to send any request
I did my research and in one example i found this....

To debug a HTML form set its 'action' attribute to refernce the Servlet

So, in Punit's example

<form method="GET" action="TestForm">

action=Servlet reference (<servlet-name> in web.xml) ....

Still, after using the url: http://localhost:8080/passValueProblem/form1.html
i am getting 404 error....

9 years ago
Thanks Punit for uploading these files.
But i am still confused.

You haven't given the fully qualified name of your class in web.xml. On my machine it does not even loads the html created by my servlet.
However, when i give the fully qualified name of class it shows the same null output, again.

Also regarding the url that you have provided. It gives a 404 error on the browser. I have the same port and everything........
I don't understand how the url does not have any mention of the project name.

To be more elaborate....
I am creating "Dynamic Web Project"
A package in src -> com.sapient.rose -> New Class ("LoginServlet.java")
form1.html and web.xml in WEB_INF

Even i am using Eclipse (Version: Indigo Service Release 2)

And i haven't been able to access my form/html page yet.

Can you specify your project structure and how exactly do you run your code.
Please bear with me a little more........

9 years ago
Hi Punit, i wanna know how exactly are you reaching the form/html page . Are you running LoginServlet.java , simply as "Run as -> Run on server".
Please post the url you are getting for the form/html page.
I think i have something wrong with my web.xml
Can you show your web.xml as well

9 years ago

The output i get is :

Thanks Mr. null
Now you can see your password : null

And the url for the above output is:


Please help

9 years ago

this is my form/html :

9 years ago
On running the servlet as "Run as Run on server", i am getting the html designed by my servlet. However i cannot get the html form page (that i have manually created to take data) on browser. Please help....
Servlet : LoginServlet.java
Form : login.html

XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"> -->
<web-app xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

9 years ago