• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet does not upload

 
Giovanni Montano
Ranch Hand
Posts: 224
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
just one day of tomcat learning.
I was not certain if had to publish on java beginners or here.

the Servlet does not upload although i save, clean and rebuild the project, once I insert data in the form it points
to a page that is not the one i am looking for
namely the link http://localhost:8080/SampleServlet2/inputform.html
goes to http://localhost:8080/SampleServlet2/ServletEcco?searchTerma%22=ciao
instead of http://localhost:8080/SampleServlet2/Servletecco?searchTerma=ciao

(this %22 should be a quote i guess, but I have not clue where it reads this the server)



and inputform.html



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File uploads don't work that way. You need to use a multi-part form, and the normal request getParameter() family of methods don't handle multi-part forms.

See the ServletsFaq for more information.

If you are trying to learn servlets, a file upload is not a good first exercise.
 
Giovanni Montano
Ranch Hand
Posts: 224
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:File uploads don't work that way. You need to use a multi-part form, and the normal request getParameter() family of methods don't handle multi-part forms.

See the ServletsFaq for more information.

If you are trying to learn servlets, a file upload is not a good first exercise.


Thanks Bear,
but you speak a language that is still esperanto to me. The strange thing is that I did the same and identical project in Eclipse and it works, but if i run this one not, so it is a setting that is wrong and i am just really curious to know what is( for me is a kind of sudoku, so it is fine if I did not grasp now).
I had a look to the FAQs you sent me, but I will proceed with the cursus I am doing and come back when I will understand what is wrong because int he FAQs there are a lot of animals i do not know the names, I am confident I will be successful although now backend is not a priority to me. See you soon Bear Bibeault
 
Dave Tolls
Ranch Hand
Posts: 1895
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The term "upload" is normally applied to uploading a file to a server, hence Bear's response.
I'm guessing this is not what you are doing here, looking at your form.

What, exactly, happens when you submit your form?
I'm having trouble seeing what your issue is.
 
Giovanni Montano
Ranch Hand
Posts: 224
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:The term "upload" is normally applied to uploading a file to a server, hence Bear's response.
I'm guessing this is not what you are doing here, looking at your form.

What, exactly, happens when you submit your form?
I'm having trouble seeing what your issue is.


Thank you Dave, I think the right term is refresh..
although I set for instance inside the inoutform.html the ( I guess) correct line

still when I run tomcat and press the button on the form I see http://localhost:8080/SampleServlet2/ServletEcco?searchTerma%22=ciao
 
Dave Tolls
Ranch Hand
Posts: 1895
14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I think I see now.
Open up the source html in your browser, before submitting.
It might be better to use the dev tools (usually F12 will open that up), but you should spot any issue in the base source.

It does seem to think there's an extra set of " marks there.
 
Giovanni Montano
Ranch Hand
Posts: 224
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:Ah, I think I see now.
Open up the source html in your browser, before submitting.
It might be better to use the dev tools (usually F12 will open that up), but you should spot any issue in the base source.

It does seem to think there's an extra set of " marks there.

Dave the point is that now is working, the reason why update? I am trying in a browser, because you asked me to use F12, so far I have always tried inside Eclipse with the virtual browser built inside, and there still does not update... in the browser(firefox,chrome,Iexplore) does.

thanks anyway
 
Dave Tolls
Ranch Hand
Posts: 1895
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have never ever tested web stuff using the IDE, other than by attaching the debugger to a running Tomcat server.
I really don't see the point.
 
Giovanni Montano
Ranch Hand
Posts: 224
4
Android Open BSD Slackware
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:I have never ever tested web stuff using the IDE, other than by attaching the debugger to a running Tomcat server.
I really don't see the point.

good to know, I will not use it anymore.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic