• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to merge two forms in a single jsp

 
Ravi Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a jsp which is having two forms as below

<form name="frm2" method="post" action="../servlet/com.infy.cis.ui.marketing.CampaignSave">
<Input type="text" name="test1" value=">
<Input type="text" name="test2" value=">
</form>

<form name="attachmentForm" method="post" enctype="multipart/form-data" action="../servlet/com.infy.cis.ui.common.CampaignAttachmentWriter">
<input class="BrowseFile" name="filename" onchange="addAttachment();" onkeypress="return uploadAttachmentOnEnter()" type="file">
</input>
</form>

Now i need to merge these two forms to make my code work properly. If iam combining this code in one form and enctype="multipart/form-data" for the form it is not getting the values of text fields. If i removed the enctype it is not getting the file contens of the data.

Please help me how to resolve the issue as i need to merge these two forms into single form.

Thanks
Ravi
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The sexiest way would be using the Struts 2.0 framework. It does all the parsing and data transfer automatically to keep you away from these details.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using a multipart form then you have to deal with the request: most people use some form of a multipart request wrapper (like the one in Apache commons, but I'm sure there are a million others). Many/most webapp frameworks hide this complexity from you--are you using straight servlets?

You're not using the invoker, are you? That's bad, IMO.
 
Ravi Kumar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Iam working in a company where they have product from past 15 years and they have designed like this and i need to merge this forms using jsp, servlets,js. Is there any way to resolve the above problem?

Please help me.

Thanks
Ravi
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ on file uploading.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic