Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Have two forms, want one of them to be displayed as if it was inside the other

 
Jhon Salchichon
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello greenhorns!


The title might be confusing... the problem is the following:

I'm making a register page for a web site, so i have the usual things like nick, email, name, surname, date of birth, profile image, etc.
As far as i know it's not possible to make only one form to handle files(profile image) and text at the same time, so i had to make two forms, one of them has the profile image and the other form has the rest(all the fields and a button to complete the registration). The problem is that i want the profile image form to be displayed between the date of birth and the finish button(which are both in the other form...).

Is there any way to accomplish this?

Thanks!
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jhon Salchichon wrote:As far as i know it's not possible to make only one form to handle files(profile image) and text at the same time...


I don't quite understand this. What do you mean by a "form to handle files"?
 
Jhon Salchichon
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:
Jhon Salchichon wrote:As far as i know it's not possible to make only one form to handle files(profile image) and text at the same time...


I don't quite understand this. What do you mean by a "form to handle files"?



As far as I know it is not possible to make a form to upload files and text at the same time..
If it's possible please guide me!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64842
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jhon Salchichon wrote:As far as i know it's not possible to make only one form to handle files(profile image) and text at the same time

This is not correct.

A single form with an encoding type of multi-part must be used when uploading files, and the form can contain any other input elements.

See the JspFaq for info on handling such forms.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, a file upload form? Sure, it can contain more fields than just the file. But what kind of guidance are you looking for? You already know how to make a file upload form, you already know how to make a form with several input fields, so it should be easy enough to make a file upload form with several input fields.
 
Jhon Salchichon
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with this is that in the servlet i do: request.getParameter("someParameter") and it returns null(for my text parameters)... that's because of the enctype="multipart/form-data", if i delete that line all works fine...
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's true. In this particular case you don't get the parameters like that.

Instead, you get them exactly the same way you get the file upload. All of the parameters should be accessed in the same way.

I have always used the Apache FileUpload product to handle this sort of thing. Unfortunately the only examples I have of it personally are in my work computer and I won't be looking at that until Monday. But at any rate start with the plan of getting the string parameters in the same way as you're already getting the file upload parameter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic