• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Passed from MultiPart Form or from Hyperlink?

I have a page that can be opened either by the submission of an "enctype=multipart/form-data" form or by the click of a hyperlink.
When I get to the page from the form, I want to use the oReilly MultipartRequest, but when I get to the page through the hyperlink, then there has been no form submission, and I need to NOT use the oReilly MultipartRequest.

So how can I know at the top of the page if I am getting there through a form submission or a hyperlink?
Is there a variable that I can read in that will tell me if there was a form submitted?

Thanks in advance,
1 Solution
you can do this by putting a hidden field in your form, eg:
<form name="myform" action="wherever" method="post">
<input type="hidden" value="Form" name="Form">

//other form things

<input type="Submit" value="submit" name="submit">

then, in your next page, you can check if there is a parameter called "Form":
String isForm = request.getParameter("Form");
if ( isForm.equals("") ) {
    //not a form
} else {
    //is a form

hope this helps
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now