Mix different enctypes and use one single request type?

J

Jimi Hullegård

I have a servlet that is responsible for all links/input on a site. That is,
all links and forms point to that servlet. Do tell what action to take, I
use parameters, like this:
<a href="/controller?action=showLoginPage">Login</a>
and:
<form method="post" action="/controller">
<input type="hidden" name="action" value="sendMessage">...

All that works perfect. But now I want to add the possibillity to upload a
image as an attachment to the message. I found a good tutorial on
TheServerSide
(http://www.theserverside.com/articles/article.tss?l=HttpClient_FileUpload)
that worked. But when I try to use this with my own servlet, it fails. The
thing is that I want to mix regular text inputs with that file input, in the
same form. And also, I want to handle that request the same way (being able
to do request.getParameter("someParameterName") in the servlet. But when I
use enctype="multipart/form-data" in the form, the
request.getParameter("action") returns null.

Is there a solution to this?

Regards
/Jimi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top