• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

www.webappcabaret.com

 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
Hey,
I have made a servlet and want to host it on webappcabaret.com site. I am placing the file in /web-inf/classes directory, and keeping the .html file which calls this servlet in the main context directory. It is not working. The servlet is not called by the html file. Can somebody tell me what should I type in the action attribute of the html files form tag. I am at the moment typing it as:
<form method=post action="/servlet/myServlet">
But this is not working. what should I do?
Bye,
Tualha Khan
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using /projectName/myServlet. Where projectName is the name of your project.
Hope this helps.
David
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am also facing similar problems.
1) First servlet programm was running (HelloWorld.java) perfectly.But when I added one more servlet DispalyData into same directory neither of them executes.I also updated web.xml file as
<servlet>
<servlet-name>
test.HelloWorldServlet
</servlet-name>
<servlet-class>
test.HelloWorldServlet
</servlet-class>
<load-on-startup>
-454677
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
test.HelloWorldServlet
</servlet-name>
<url-pattern>
/test/HelloWorldServlet
</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>
test.DisplayData
</servlet-name>
<servlet-class>
test.DisplayData
</servlet-class>
<load-on-startup>
-454677
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
test.DisplayData
</servlet-name>
<url-pattern>
/test/DisplayData
</url-pattern>
</servlet-mapping>
Rest all part is same.Where am I wroung ??
2) I am trying to redirect to servlet page after submittimg form.But it's not working, though I have given complete url of servlet in action . But redirecting from html to html is working .
Need some urgent help.
Thanks
padmashree
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I also have account on webappcabaret. I have just uploaded
my web app (unfinished yet), the pickiest part seems to
adjust all links.
Although my guestbook servlet with usage of MySQL DB started
straight away correctly, here's how I did that
I think /servlet/myServlet is wrong invocation, since this should be default mapping (they use Tomcat, I do not know which server
you have chosen). I have Tomcat on my home PC, so I played a
bit with it. This should work if you would place your servlet code into default root directory, I assume you place into your
context, so this is why it is not working. You have to download WEB-INF/web.xml file and edit accordingly:
<servlet>
<servlet-name>name_your_servlet_here</servlet-name>
<servlet-class>actual_class_file_name</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>servlet_name_of_above</servlet-name>
<url-pattern>/invocation_path</url-pattern>
</servlet-mapping>
name_your_servlet means that you can put any name here, like
myCoolServlet
actual_class_file - put exact class name
servlet_name_of_above - whatever you named it above
/invocation_path - this is how you will link to your servlet,
eg. your context is /my_context, then to invoke servlet you
put link in your html page /my_context/invocation_path
invocation_path can be anything, not related with actual
servlet name etc.
mail me if any questions, I spent whole day while trying to
make it work on my home PC.
The last. If this works, give me a favour, go to http://www.webappcabaret.com/theyap/code4.htm
and sign my guestbook (you can freely get Guestbook1 package
there, Guestbook2 not ready yet)
hope this helps.
 
Tualha Khan
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
Hey,
I think I got the catch. Following are the steps:
1) Upload the .class file to /web-inf/classes directory
2) Edit the web.xml file ( try to look at the example given by webappcabaret.com people in there tutorial to get up and running)
3) In your HTML Form based page, you action attribute should NOT be "/servlet/myServlet". INSTEAD it SHOULD BE
"/<your context name>/servlet/myServlet"
4) Keep your HTML Forms page in the main directory of your context
5) Now close your context by clicking on the context link in the above tool bar. After closing it, again switch it on. This is done to activate the new web.xml file (just a guess).
6) Finally, try the url in a browser.
Bye,
Tualha Khan
PS: See me @ http://www.webappcabaret.com/tualha/servlet/index
Bye
 
padmshree Patil
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am still not able to get it.
only my html page rurring.
Uploaded HelloServlet.class file in /contexname/web_inf/class dir and also in /contexname/web_inf/class/test dir..
I followed the tutuorial for running servelt and edited web.xml accordingly. Still no change !!!
Today strange thing is happening when I click on test url http://www.webappcabaret.com/osaproject/
Page not found Err !! and when I refresh it nothing is there on that page
I also tried as, http://www.webappcabaret.com/osaproject/test/HelloWorldServlet http://www.webappcabaret.com/osaproject/HelloWorldServlet
http://www.webappcabaret.com/osaproject/servlet/HelloWorldServlet
(as given in readme.txt file )
http://www.webappcabaret.com/osaproject/first1.jsp
but no change.I don't know what's wroung.
If u want I can give u login and password to check my files .
Please help me out in this.
thanks
padmashree

[This message has been edited by padmshree Patil (edited March 13, 2001).]
 
Tualha Khan
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try one thing.
Compile the class file with out considering a package heirarchy. Try compiling the class file with out the 'test' package. Also remove all your files from the server (those relevent to this application, but do not delete the web.xml file). Then upload your new .class file in the /web-inf/classes directory, edi tthe web.xml file and restart your context. Now try the url.
If this does not work. Then do the following:
Finally a litmus test. Make a servlet which takes a get request from the browser and prints nothing but simple text on the browser like 'Hello All'. Then after uploading, editing of web.xml, retarting the context. Point you browser straight to your servlet like below:
http://www.webappcabaret.com/tualha/servlet/index
See if it works?
If nothing works up even now, then I will try it from my place. OK.
GoodLuck!!!
Bye,
Tualha Khan
 
raimondas zemaitis
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
almost none of those links work (I haven't followed 'em all)
I think what you do wrong is linking.
If you correctly edit web.xml file, be sure to link
servlet according to what you have put in there, i.e.
if your servlet invocation path is set as here
<servlet-mapping> <servlet-name>servlet_name_of_above</servlet-name>
<url-pattern>/invocation_path</url-pattern>
</servlet-mapping>
you have to link it /context/invocation_path
not /context/servlet etc
you can even do it so
<servlet-mapping> <servlet-name>servlet_name_of_above</servlet-name>
<url-pattern>/invocation_extension</url-pattern>
</servlet-mapping>
invocation_extension could be as simple as *.go
then you link servlet like this /context/coolServlet.go
and it should go
hope this helps
 
padmshree Patil
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
Thanks a lot for ur quick response .Really appreciate ur help.
As u said I deleted all other files and started everything from scrach.
uploaded HelloWorldServlet.java and HelloWorldServlet.class files into osaproject/web_inf/classes dir
then edited the web.xml file as
(Wanted to confirm abt <url-pattern> /HelloWorldServlet </url-pattern> tag )

<servlet>
<servlet-name>
HelloWorldServlet
</servlet-name>
<servlet-class>
HelloWorldServlet
</servlet-class>
<load-on-startup>
-454677
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
HelloWorldServlet
</servlet-name>
<url-pattern>
/HelloWorldServlet
</url-pattern>
</servlet-mapping>
Then changed the servlet context status to OFF then again ON .
clicked on test url : http://www.webappcabaret.com/osaproject/
Guess what !!! Page can't be displayed Err

I also tried with simple servlet which get request parameter as u said.
but no use .
One more thing , when I open website www.webappcabater.com and enter context name It is not asking for userid and password .it's directly takeing me to file manager page. I thought may this is problem but I can invoke html pages.

thanks
padmashree


[This message has been edited by padmshree Patil (edited March 13, 2001).]
 
Tualha Khan
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In that case, I would like to visit your file manager by using your login and password. And Secondly and most importantly suggest you try registering a fresh context
Bye,
Tualha Khan
 
padmshree Patil
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have mailed usedid and pwd to your emailID:[email protected]
I willl create another context and try that also.
thanks for all ur help.
Sorry for taking ur valuable time.
thanks
padmshree
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Tulaha,
You need not edit web.xml file for this problem. Just make sure that you have your .java file in classes directory alongwith the .class file. This should solve the problem.
------------------
 
Tualha Khan
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know, once I tried it without edition web.xml file. It did not work, so I had a dekko at their servlet/jsp tutorial. After editing the web.xml file It did work.
But one more thing, I did not upload my .java file at any time. So are you suggesting that I should upload my .java file as well, if i am not editing the web.xml file? Please elaborate a bit more.
Bye,
Tualha Khan
 
There are 10 kinds of people in this world. Those that understand binary get this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic