• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

form data not passing to servlet file

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried to create a html form to submit a value to a servlet.

Html file : threeparamform.html (code below)




servlet file : threeparam.java (code below)



both "form-data" & "WEB-INF" are in same root directory , html file is in form-data directory , java file in WEB-INF directory.

my problem is on clicking submit button data is not submitted ..why so ??
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What actually happens?

Is your servlet code in a package?

Are there any relevant messages in the server log files>

Bill
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What actually happens?



the page does not chages , which means data not submitted

Is your servlet code in a package?



no it is not in a package

Are there any relevant messages in the server log files



here are those :


i put all the log here as i cannot understand which part to copy ...


 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you need to add the entry of the servlet to your web.xml .

<servlet>
<servlet-name>threeparam</servlet-name>
<servlet-class>Threeparam</servlet-class>
</servlet>

<servlet-class> - fully qualified class name. No package is mentioned as you said your servlet does not reside in any package.I feel you should add your servlet to a package and add the full package name to this parameter. Keeping your servlets in WEB-INF is not a good practise.

you then need to have a servlet mapping , similar to the one given below.
.
.
<servlet-mapping>
<servlet-name>threeparam</servlet-name>
<url-pattern>/threeparam</url-pattern>
</servlet-mapping>

<url-pattern> - This is what the html file should refer to .

You also need to make a change to you html file. Please change ACTION="/servlet/threeparam" to ACTION="threeparam" .

tks

 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

andy asd wrote:
<servlet-mapping>
<servlet-name>threeparam</servlet-name>
<url-pattern>/threeparam</url-pattern>
</servlet-mapping>

<url-pattern> - This is what the html file should refer to .
You also need to make a change to you html file. Please change ACTION="/servlet/threeparam" to ACTION="threeparam" .



i have changed accordingly , in the url pattern i have given full pathname , but the values are not passed , previously nothing was happening now after following your instructions threeparam.java is displayed but the values of first,second , third parameter are null. the values are not getting passed . so where lies the problem..

which web.xml file should i change the one in "WEB-INF" or the one in "conf"

 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you have two web.xml files?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

tushar panda wrote:which web.xml file should i change the one in "WEB-INF" or the one in "conf"


?! You should change the one for your webapp--the one in <tt>WEB-INF</tt>.
 
tushar panda
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Why do you have two web.xml files?



the first "web.xml" is inside conf but another one automatically got created and is in WEB-INF .

contents of the second one :
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The one in conf is superfluous. Only the one in WEB-INF matters.
 
Why is the word "abbreviation" so long? And this ad is so short?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic