Two form/ invoke 2 seperate urls?
Hi All,
I have following Jsp page:
My requirement is: Page has a single submit button and two <FORM> tags. Each form tag has a Url to invoke on Submit button pressed.
Meaning if usedr selects SIT1 radio button and presses Submit then the browser should display indexBM.jsp page
If user selects SIT2 radio button and presses Submit, then browser should display indexComp.jsp page.
Following is not working. What changes I need to do to achieve above?
thanks
<%@ include file="header.jsp" %>
<html>
<body>
<tr><td><b><center>BEST MATCH and CRES(Customer Related Enterprise Services)</td></tr>
<form>
<form method="post" action="indexBM.jsp">
<table width="700" Align="center">
<!--DWLayoutTable-->
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td><B><I>Service Type</I></B></td>
<td><input type="radio" name="env_Type" value="SIT1" >Best Match</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</form>
<form method="post" action="indexComp.jsp">
<table width="700" Align="center">
<tr>
<td></td>
<td></td>
<td><input type="radio" name="env_Type" value="SIT2" >CRES(Customer Related Enterprise Services)</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</form>
<tr>
<BR>
<P></P>
</tr>
<tr>
<td width="40"></td>
<td></td>
<td colspan=3>
<input type="submit" name="submit" value="SUBMIT">
</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>
ok so what changes do i need to do in my existing code.. I cannot keep two buttons in that Jsp page. I can keep only one button, two radio buttons for selection, and then depending on radio button selection a forward to appropriate Jsp page either indexBM.jsp OR indexComp.jsp.
thanks
Similar Messages
-
Hi All,
I have following Jsp page:
My requirement is: Page has a single submit button and two <FORM> tags. Each form tag has a Url to invoke on Submit button pressed.
Meaning if usedr selects SIT1 radio button and presses Submit then the browser should display indexBM.jsp page
If user selects SIT2 radio button and presses Submit, then browser should display indexComp.jsp page.
Following is not working. What changes I need to do to achieve above?
thanks
<%@ include file="header.jsp" %>
<html>
<body>
<tr><td><b><center>BEST MATCH and CRES(Customer Related Enterprise Services)</td></tr>
<form>
<form method="post" action="indexBM.jsp">
<table width="700" Align="center">
<!--DWLayoutTable-->
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td></td>
<td><B><I>Service Type</I></B></td>
<td><input type="radio" name="env_Type" value="SIT1" >Best Match</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</form>
<form method="post" action="indexComp.jsp">
<table width="700" Align="center">
<tr>
<td></td>
<td></td>
<td><input type="radio" name="env_Type" value="SIT2" >CRES(Customer Related Enterprise Services)</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</form>
<tr>
<BR>
<P></P>
</tr>
<tr>
<td width="40"></td>
<td></td>
<td colspan=3>
<input type="submit" name="submit" value="SUBMIT">
</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>ok so what changes do i need to do in my existing code.. I cannot keep two buttons in that Jsp page. I can keep only one button, two radio buttons for selection, and then depending on radio button selection a forward to appropriate Jsp page either indexBM.jsp OR indexComp.jsp.
thanks -
Problems with file uploading servlet, the form action doesnt capture url
Hi, i have one problem. I am working on a project , i have created a servlet that takes uploaded files and processses them and links them back to user to download. The servlet works perfectly from my computer, I am using apache-tomcat-6.0.16 and java 1.6 , I have two forms called encrypt.html and decrypt.html, I will post both of them, now the problem is when somebody access it on the internet while i am running apache, they get a connection was reset on a firefox browser and same stuff on Internet Explorer.
i have checked my server logs and saw nothing unusual there, So please if you can help me, it is my project.
I am pasting html file and error message that other users where getting remotely.
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>Stego Form</title>
<link rel='STYLESHEET' type='text/css' href='encrypt.css'>
</head>
<body>
<center>
<form name='encrypt' enctype='multipart/form-data' method='POST' action='http://localhost:8080/examples/temp2
' accept-charset='UTF-8'>
<input type='hidden' name='sfm_form_submitted' value='yes'>
</input>
<input type='hidden' name='eord' value='e'>
<select name='encryption' size='1'>
<option value='Select an encryption' selected>
Select an encryption
</option>
<option value='DES'>
DES
</option>
<option value='Tripple DES'>
Tripple DES
</option>
</select>
<input type='file' name='overt' size='20'>
<input type='file' name='covert' size='20'>
<input type='submit' name='submit' value='Submit'>
</form>
</center>
</body>
</html>so it works for me even if i access the page with my ip , but for others it doesnt work,
now the user got this xhtml page that i will show, i cant find attach button so i am pasting here.
here is the servlet coding
import java.io.*;
import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class temp2 extends HttpServlet
FileInputStream fin;
String filenames[] = new String[2],fieldname,fieldval;
String keyfile,IVfile;
String names[] = new String[2];
public temp2()
super();
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
doPost(request, response);
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
String eord="";
List lst = null;
boolean isMultiPart = ServletFileUpload.isMultipartContent(request);
if (!isMultiPart) // check whether the post request is actually multipart
System.out.println("ERROR NOT MULTIPART");
System.exit(0);
DiskFileItemFactory fif = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(fif);
sfu.setSizeMax(10000000);
try { lst = sfu.parseRequest(request); }
catch (FileUploadException ex)
{ System.out.println("ERROR IN PARSING FILES" + ex); System.exit(0); }
if(lst.isEmpty()) // check whether request is empty
System.out.println("ERROR LIST SIZE NOT GOOD : " + lst.size());
System.exit(0);
Iterator x = lst.iterator();
int i = 0;
FileItem f = (FileItem)x.next();
f = (FileItem)x.next();
System.out.println(f.getFieldName());
if(f.getFieldName().equalsIgnoreCase("eord")) // check hidden field to know the case : encrypt or decrypt
eord = f.getString();
System.out.println(f.getString());
else // if it is not first field exit
System.out.println("Invalid FORM");
System.exit(0);
f = (FileItem)x.next(); // next field
if(f.getFieldName().equalsIgnoreCase("encryption")) // type of encryption des / tdes
fieldname = f.getFieldName();
fieldval = f.getString();
System.out.println(f.getString());
if(eord.equalsIgnoreCase("e")) // if it is encryption form only file required
while(x.hasNext())
f = (FileItem)x.next();
if(!f.isFormField())
int check = f.getName().lastIndexOf(File.separator);
System.out.println(File.separator);
if(check==-1)
System.out.println(f.getName());
System.out.println("Unsupported browser : " + check);
System.exit(0);
File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
names[i] = ff.getName(); // original file names
try
f.write(ff);
filenames[i] = ff.getAbsolutePath();
// renamed
ff.deleteOnExit();
}catch(Exception e) {System.out.println("Error writing file"+ ff.getAbsolutePath()); System.exit(0);}
i++;
try { System.in.read(); } catch(Exception e) {}
}// endwhile
if(fieldval.equalsIgnoreCase("DES"))
System.out.println("DES 1"+filenames[1]);
javades o = new javades(filenames[1]); // the file to be encrypted
filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
System.out.println("should be original" + filenames[1]);
else if(fieldval.equalsIgnoreCase("Tripple DES"))
javatdes o = new javatdes(filenames[1]);
filenames[1] = "e:\\apache\\webapps\\temp\\files\\" + names[1];
System.out.println(filenames[1]);
System.out.println("Calling stego");
filenames[0] = "e:\\apache\\webapps\\temp\\" + names[0];
System.out.println("file 1 "+ filenames[0]);
System.out.println("file 2"+ filenames[1]);
try { System.in.read(); } catch(Exception e) {}
stego s = new stego(filenames[0],filenames[1]);
System.out.println("mainext " + s.mainext);
// encryption done, and new files are loaded, now lets hide
if(s.mainext.equalsIgnoreCase("wav"))
s.encodewav();
System.out.println("Encoded wave");
else if(s.mainext.equalsIgnoreCase("bmp"))
System.out.println("Encoded bmp");
s.encodebmp();
System.out.println("done !");
PrintWriter pr = response.getWriter();
pr.println("Greetings , Your work is done and saved, now download the following files");
pr.println("The secret key file is needed for getting back your hidden file, so download that too");
pr.write("<a href=\"/temp/files/IV.txt\">click here</a>");
pr.write("<br/><a href=\"/temp/files/key.txt\">click here</a>");
pr.write("<br/><a href=\"/temp/files/"+names[0]+"\">click here</a>");
return;
// if it is decryption case
else if(eord.equalsIgnoreCase("d"))
while(x.hasNext())
f = (FileItem)x.next();
if(!f.isFormField())
int check = f.getName().lastIndexOf(File.separator);
System.out.println(File.separator);
if(check==-1)
System.out.println(f.getName());
System.out.println("Unsupported browser : " + check);
System.exit(0);
File ff = new File("e:\\apache\\webapps\\temp\\"+f.getName().substring(check));
// else if ladder to store paths of stegofile keyfile and IVfile
if(f.getFieldName().equalsIgnoreCase("stegofile"))
filenames[0] = ff.getAbsolutePath();
else if(f.getFieldName().equalsIgnoreCase("keyfile"))
keyfile = ff.getAbsolutePath();
else if(f.getFieldName().equalsIgnoreCase("IVfile"))
IVfile = ff.getAbsolutePath();
try
f.write(ff); // writes whole file at once
}catch(Exception e) {System.out.println("Error writing file"); System.exit(0);}
}// endwhile
System.out.println("Calling stego");
System.out.println("file 1 "+ filenames[0]);
stego s = new stego(filenames[0]);
System.out.println("mainext " + s.mainext);
if(s.mainext.equalsIgnoreCase("wav"))
s.decodewav();
System.out.println("Encoded wave");
else if(s.mainext.equalsIgnoreCase("bmp"))
s.decodebmp();
System.out.println("Encoded bmp");
System.out.println("done !");
////// hidden file has been retrieved , now lets decrypt it
System.out.println("ext " + s.ext);
filenames[0] = "e:\\apache\\webapps\\temp\\"+s.filename;
System.out.println(filenames[0]);
System.out.println(keyfile);
System.out.println(IVfile);
if(fieldval.equalsIgnoreCase("DES"))
javades o = new javades(filenames[0],keyfile,IVfile); // the file to be encrypted
filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
System.out.println("should be original" + filenames[0]);
else if(fieldval.equalsIgnoreCase("Tripple DES"))
javatdes o = new javatdes(filenames[0],keyfile,IVfile);
filenames[0] = "e:\\apache\\webapps\\temp\\" + ( new File(filenames[0]).getName());
System.out.println(filenames[0]);
PrintWriter pr = response.getWriter();
pr.write("Greetings, you have successfully retrieved your hidden file, now download it from here <br>");
pr.write("<a href=\"http://localhost:8080/temp/files/" + (new File(filenames[0]).getName())+"\">Click here</a>");
}and here is the xhtml file the user receives, whe he clicks the submit button,
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html [
<!ENTITY % htmlDTD
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % netErrorDTD
SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!ENTITY loadError.label "Problem loading page">
<!ENTITY retry.label "Try Again">
<!-- Specific error messages -->
<!ENTITY connectionFailure.title "Unable to connect">
<!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
<!ENTITY deniedPortAccess.title "This address is restricted">
<!ENTITY deniedPortAccess.longDesc "">
<!ENTITY dnsNotFound.title "Server not found">
<!ENTITY dnsNotFound.longDesc "
<ul>
<li>Check the address for typing errors such as
<strong>ww</strong>.example.com instead of
<strong>www</strong>.example.com</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY fileNotFound.title "File not found">
<!ENTITY fileNotFound.longDesc "
<ul>
<li>Check the file name for capitalization or other typing errors.</li>
<li>Check to see if the file was moved, renamed or deleted.</li>
</ul>
">
<!ENTITY generic.title "Oops.">
<!ENTITY generic.longDesc "
<p>&brandShortName; can't load this page for some reason.</p>
">
<!ENTITY malformedURI.title "The address isn't valid">
<!ENTITY malformedURI.longDesc "
<ul>
<li>Web addresses are usually written like
<strong>http://www.example.com/</strong></li>
<li>Make sure that you're using forward slashes (i.e.
<strong>/</strong>).</li>
</ul>
">
<!ENTITY netInterrupt.title "The connection was interrupted">
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.longDesc "
<ul>
<li>Uncheck "Work Offline" in the File menu, then try again.</li>
</ul>
">
<!ENTITY netReset.title "The connection was reset">
<!ENTITY netReset.longDesc "&sharedLongDesc;">
<!ENTITY netTimeout.title "The connection has timed out">
<!ENTITY netTimeout.longDesc "&sharedLongDesc;">
<!ENTITY protocolNotFound.title "The address wasn't understood">
<!ENTITY protocolNotFound.longDesc "
<ul>
<li>You might need to install other software to open this address.</li>
</ul>
">
<!ENTITY proxyConnectFailure.title "The proxy server is refusing connections">
<!ENTITY proxyConnectFailure.longDesc "
<ul>
<li>Check the proxy settings to make sure that they are correct.</li>
<li>Contact your network administrator to make sure the proxy server is
working.</li>
</ul>
">
<!ENTITY proxyResolveFailure.title "Unable to find the proxy server">
<!ENTITY proxyResolveFailure.longDesc "
<ul>
<li>Check the proxy settings to make sure that they are correct.</li>
<li>Check to make sure your computer has a working network connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY redirectLoop.title "The page isn't redirecting properly">
<!ENTITY redirectLoop.longDesc "
<ul>
<li>This problem can sometimes be caused by disabling or refusing to accept
cookies.</li>
</ul>
">
<!ENTITY unknownSocketType.title "Unexpected response from server">
<!ENTITY unknownSocketType.longDesc "
<ul>
<li>Check to make sure your system has the Personal Security Manager
installed.</li>
<li>This might be due to a non-standard configuration on the server.</li>
</ul>
">
<!ENTITY sharedLongDesc "
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
</ul>
">
<!ENTITY % globalDTD
SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
]>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
- The Original Code is mozilla.org code.
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1998
- the Initial Developer. All Rights Reserved.
- Contributor(s):
- Adam Lock <[email protected]>
- William R. Price <[email protected]>
- Henrik Skupin <[email protected]>
- Jeff Walden <[email protected]>
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK ***** -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Problem loading page</title>
<link rel="stylesheet" href="temp2_files/netError.css" type="text/css" media="all"/>
<!-- XXX this needs to be themeable -->
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAANbY1E9YMgAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAICSURBVHjaYvz//z8DJQAggJhwiDPvnmlzc2aR0O+JGezt+AwACCCsBhxfYhn59N41FWtXIxZOLu70niRGXVwGAAQQNgNYHj96O8HaWYdJW5ubwd4/mI2Ng7sblwEAAYRhwMm1URk/vn4SUNWVYGD8+YZBXZOZm5OLzRjoCmNsBgAEEKoBN82Y7l851GLrqMjM8Oc7A8O/3wwMP54wuAQFCXNycUzGZgBAAKEYcOaKZO2/f//5FbUVgBrfMoRVcgHpNwyKGjKMXDwCan0prFboBgAEELIBzDcvXyy2cVZhYPj9GWj7H4jo/38MDJ9OMDj7O/KzsjH3oxsAEEBwA/bNNipiZf7FI6cqwcDw8x2qqp8fGORUpVn4BEXlgGHhhCwFEEAwA9gfP3hdZ+Oizcjw+wvCdjgAuuLrFQbXIH9hTm7uqcgyAAEENuD4ctcebm5mbikFYRTbV7V/Q6j88Z5BSuY7q4CQgAjQFR4wYYAAAhtw89L5ZFsnRaDtn4CW/YXrAQcisit+PGVwDgrnZ2NnnwATBQggpsNLvGYLCAmxi8tLARWg+h3FBVBXSEj/ZZWQkRcCuiIQJAQQQCyvnj5KMDTkZ2JgYmRg4FchnHv+vmEwttLmeXT3VjKQtx4ggFgk5TXebV63UfT3ijOMxOZAVlZWdiB1EMQGCCBGSrMzQIABAFR3kRM3KggZAAAAAElFTkSuQmCC"/>
<script type="application/x-javascript"><![CDATA[
// Error url MUST be formatted like this:
// moz-neterror:page?e=error&u=url&d=desc
// Note that this file uses document.documentURI to get
// the URL (with the format from above). This is because
// document.location.href gets the current URI off the docshell,
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.
function getErrorCode()
var url = document.documentURI;
var error = url.search(/e\=/);
var duffUrl = url.search(/\&u\=/);
return decodeURIComponent(url.slice(error + 2, duffUrl));
function getDescription()
var url = document.documentURI;
var desc = url.search(/d\=/);
// desc == -1 if not found; if so, return an empty string
// instead of what would turn out to be portions of the URI
if (desc == -1) return "";
return decodeURIComponent(url.slice(desc + 2));
function retryThis()
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call
// reload(), which will also repost POST data correctly.
try {
location.reload();
} catch (e) {
// We probably tried to reload a URI that caused an exception to
// occur; e.g. a non-existent file.
function initPage()
var err = getErrorCode();
// if it's an unknown error or there's no title or description
// defined, get the generic message
var errTitle = document.getElementById("et_" + err);
var errDesc = document.getElementById("ed_" + err);
if (!errTitle || !errDesc)
errTitle = document.getElementById("et_generic");
errDesc = document.getElementById("ed_generic");
var title = document.getElementById("errorTitleText");
if (title)
title.parentNode.replaceChild(errTitle, title);
// change id to the replaced child's id so styling works
errTitle.id = "errorTitleText";
var sd = document.getElementById("errorShortDescText");
if (sd)
sd.textContent = getDescription();
var ld = document.getElementById("errorLongDesc");
if (ld)
ld.parentNode.replaceChild(errDesc, ld);
// change id to the replaced child's id so styling works
errDesc.id = "errorLongDesc";
// remove undisplayed errors to avoid bug 39098
var errContainer = document.getElementById("errorContainer");
errContainer.parentNode.removeChild(errContainer);
]]></script>
</head>
<body dir="ltr">
<!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
<!-- PAGE CONTAINER (for styling purposes only) -->
<div id="errorPageContainer">
<!-- Error Title -->
<div id="errorTitle">
<h1 id="errorTitleText">The connection was reset</h1>
</div>
<!-- LONG CONTENT (the section most likely to require scrolling) -->
<div id="errorLongContent">
<!-- Short Description -->
<div id="errorShortDesc">
<p id="errorShortDescText">The connection to the server was reset while the page was loading.</p>
</div>
<!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
<div id="errorLongDesc">
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
<li>If you are unable to load any pages, check your computer's network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that Firefox is permitted to access the Web.</li>
</ul>
</div>
</div>
<!-- Retry Button -->
<xul:button xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="errorTryAgain" label="Try Again" oncommand="retryThis();"/>
</div>
<!--
- Note: It is important to run the script this way, instead of using
- an onload handler. This is because error pages are loaded as
- LOAD_BACKGROUND, which means that onload handlers will not be executed.
-->
<script type="application/x-javascript">initPage();</script>
</body>
</html>thank you for your prompt reply in advance,
Regards,
Mihir PandyaHi, thank you for your replies, I found out few things about my servlet, and its portability
and i have few questions, although i marked this topic as answered i guess its ok to post
I am using javax.servlet.context.tempdir to store my files in that servletcontext temporary directory. But i dont know how to give hyperlink
of the modified files to the user for them to download the modified files.
What i am using to get the tempdir i will paste
File baseurl = (File)this.getServletContext().getAttribute("javax.servlet.context.tempdir");
System.out.println(baseurl);
baseurl = new File(baseurl.getAbsolutePath()+File.separator+"temp"+File.separator+"files");
baseurl.mkdirs();so i am storing my files in that temp/files folder and the servlet processes them and modifies them, then how to present them as
links to the user for download ?
and as the servlet is multithreaded by nature, if my servlet gets 2 different requests with same file names, i guess one of them will be overwritten
And i want to create unique directory for each request made to the servlet , so file names dont clash.
one another thing is that i want my servlet to be executed by my <form action> only, I dont want the user to simply type url and trigger the servlet
Reply A.S.A.P. please..
Thanks and regards,
Mihir Pandya -
How to submit two forms once in one jsp page?
hello all,
My jsp page includes two forms: one form's action is a File Upload servlet, which process file uploading; another is a general servlet to collect user inputs, such as user name, age, etc.
Because the file upload servlet is a legacy component, and it was used in many applications. we could not meger it into our business components.
the system requires the file upload and information collection are submitted once. so we have to submit two forms in one 'Submit' action, at the same time, the information collection servlet need get the information from file upload servlet, such as the uploaded file's url.
I have tried two methods, but all failed
1. Upload form has no a 'Submit' button, when user click the 'submit' button of the information collection form, we use a javascript to submit upload form first, then submit information collection form. Failed at: the second submit dose wait for upload finishing, then the second submit interrupt the upload
2. the javascript only submit upload form, and set HTML body's onUnload event to another javascript that submit information collection form. this time, the file upload sucess, and information collection form sucess at most time. But fail when user click the 'refresh' or 'back' or any navigator buttons of the browser. these action will trigger the page 'unload' event too, but the submit if invalid!
Please tell me how to.chain the both requests!
- build one mutlitpart request and send it to a servlet that can handle that multipart request (think of using oreilly MultiPartParser).
- check the input (all requiered fields and files there)
- if yes store the user fields and create a socket connection from your servlet to the legacy file upload servlet and post the file this way.
- like this you have full control over the users input and can make sure the file and the fields are just save if all requiered elements are availble. -
How to pass Parameters between two forms
im trying to do this but i could not find any way for this.
can any one help me how can i pass parameters between two forms
in forms4.5. any help will be appreciated
thanks.
nullGlobal variables can be used, but you can do what the online help
says ...
Parameters are passed to called forms by means of a parameter
list. A parameter list is a named programmatic construct that is
simply a list of parameter names (called keys) and their values.
You can pass parameter values to forms invoked by the built-in
subprograms CALL_FORM, OPEN_FORM, and NEW_FORM. In addition, you
can pass parameter values to other Oracle tools with the
RUN_PRODUCT procedure.
A parameter you include in a parameter list can be either a text
parameter or a data parameter. The parameter type determines how
its value is interpreted.
Text Parameters The value of a text parameter being passed to a
called product is a CHAR string that can represent the following:
n a user-defined form parameter defined in a form invoked
by the CALL_FORM, OPEN_FORM, or NEW_FORM built-in subprograms
n a command line or user-defined parameter for a product
invoked with the RUN_PRODUCT built-in subprogram
Data Parameters The value of a data parameter being passed to a
called product is always the name of a record group defined in
the current form. (A record group is a data structure that
stores records derived from a query or through programmatic
assignment.) Data parameters are used to pass data to products
invoked with the RUN_PRODUCT built-in subprogram. You cannot
pass data parameters to forms.
The following table shows the structure of a parameter list that
contains four parameters:
Key Paramtype Value
CITY Text_Parameter 'BOGOTA'
CATEGORY Text_Parameter 'EXPORTS'
MULTIPLIER Text_Parameter '.0275'
NEW_DATA Data_Parameter 'RECORD_GROUP8'
arun reddy (guest) wrote:
: im trying to do this but i could not find any way for this.
: can any one help me how can i pass parameters between two forms
: in forms4.5. any help will be appreciated
: thanks.
null -
hello again. i did a search and found a thread where someone
else asked if it was possible to have two form actions, but the
person who responded didn't say it was impossible, just that they
didn't need to.
i think i need to have two actions, unless someone can tell
me how to tell my formmail to also send the results to an ASP form
processor on a different website.
basically, my company started using a web-based lead
management program, and they want the results to go there as well
as the emails we get now. the website uses ASP to process the form,
and they provide the url you need to post to, plus hidden fields
you have to put in the form that tell it which account to post to.
it seems like the easiest solution would be to have two
actions on the form, but so far that doesn't appear to be possible,
and i'm just wondering if anyone has done it before and can tell me
how it's done.
thanks!Would it be out of consideration to hire someone to do this
for you?
If not, then you would have to modify the formmail script to
POST the form's
data, including the additional values required, to the data
processing
script. On reflection, I'm not quite sure what would be the
best way to do
that - perhaps use the incoming POSTed data to populate form
fields and then
submit the populated form onload.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"n h c" <[email protected]> wrote in message
news:f4kc9k$dpv$[email protected]..
> i'm sorry, i should have elaborated a little more.
>
> we currently use a formmail.php (the one from
www.boaddrink.com), and i
> can
> definitely edit that (except i don't know enough php to
figure this out on
> my
> own, obviously). but we recently started using a
web-based lead management
> program called Top Producer, and that's where the asp
comes in. we want to
> keep
> receiving the email results as we do now, but we also
want the results to
> go to
> Top Producer. so yes, the ideal solution would be to
tell the formmail.php
> to
> also send the results to the Top Producer form
processor.
>
> the url they give for the action is:
> https://www.topproduceronline.com/LeadToolkit.asp, and
we also have to add
> some
> hidden fields to the form that tell the asp which
account to post the
> results
> to.
>
> i hope that helps you understand what i'm trying to do.
if i need to post
> anymore info, just let me know. i really appreciate the
help!
> -
How to get HttpServletRequest parameters from two forms in a JSP
I have this JSP with two forms calling the same servlet. Problem is, when I use a submit button in the second form, I am unable to retrieve the request parameters from the form through the servlet. I am wondering if anybody could give me some info on how to get the request parameters from the second form. I tried to see all the parameter names in the request by calling request.getParameterNames(). But the parameters in the second form are not even seen in the request although I am clicking the submit button in this form!
First, two forms works fine in one jsp so no need to argue about that.
Second, did you put the form actions and type ("multipart/formdata " ?) explicit in every form header ? Did you supply different form names ?
Try to call the submit function through javascript - document.forms[0].submit() for your first, and document.forms[1].submit() for your second form...
Did you forget to close the form tag by chance ? -
How to pass a form value as a url parameter??
I have following form and I want to pass the selected value of the drop down choice in as one of the parameter in the URL. How can I do that ??
something like proposalid that I have done in the url, I want to pass the selected value of the variable doc_id, when I click the Link button
<form name = "link" method="POST" enctype="multipart/form-data" action="<%= request.getScheme() %>://<%= request.getServerName() %>/webAppCore/common/add_doc.jsp">
<table>
<tr> <td class="tableContent"> Doc Identifier: </td>
<td class="tableContent"> <SELECT name="doc_id">
<%
Vector v = iddata.getDocumentIdList(tabName);
//out.println(v);
if (v != null && v.size() > 0) {
for (int i = 0; i < v.size(); i++) {
Hashtable hash = (Hashtable) v.elementAt(i);
%>
<OPTION selected name="id " value="<%=(String)hash.get("DOCUMENT_ID")%>"> <%=(String)hash.get("DOCUMENT_NAME")%></OPTION>
<% } } else {%>
<OPTION selected name="id " value="test"> No DocIDs</OPTION>
<%}%>
<tr> <td colspan = "2">
<table border="1" width="200">
<tr> <td> <input type="text" name="link_file" size="30" value=""/></td><td> <INPUT TYPE=button VALUE="Link..." onClick="window.open('<%= request.getScheme() %>://<%= request.getServerName() %>/webAppCore/common/link.jsp?proposalid=<%=proposalID>','mywindow','toolbar=no,location=no,directories=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300,left=20,top=20');"></td> </tr>
<tr> <td colspan = "2">
To Create Links: <br>
* Select Doc Identifier
* Click on Link...to select file within eFile. <br>
* Click Add to create the Link <br>
</td> </tr>
</table>
</tr>if - in your form declaration - you change your method to GET from POST, it will append the form data onto the URL string instead of putting it in the request header. For instance, if you have a form with an input called THE_INPUT, and you submit to a servlet (or script of some kind or whatever) when the value of that text box is "foo", the URL will be:
http://www.yourdomain.com/yourservlet?THE_INPUT=foo
But, if you use the POST method, the URL will just be:
http://www.yourdomain.com/yourservlet
Is that what you meant? -
How can I share data between two forms on different lists
Using a custom content type, I created two lists that I want to share the same data - one is a calendar. Our employees complete a form from the "Out of Office Request" list that has workflow functionality that sends an email to that person's
manager. If the manager approves the request, the item automatically populates the "Out of Office Calendar." The problem is that the only information from the request list that populates the calendar is the Title field and date/time fields.
I need the manager name in order to create a view for each manager.
How can I connect the other information in the request list to the calendar list. It seems to me that if the title and date fields carry over the information, there should be a way to connect the other information. I'm using Designer.
I've tried to connect the two lists' webparts with the wizard, but when I get to the page that maps the two lists, there are no column names and the "Next >" button is grayed out. This seems like the logical place to connect the two lists,
but it isn't working.Hi,
According to your post, my understanding is that you wanted share data between two forms on different lists.
To show external information on the calendar event, there are two methods: Calculated column, workflow. You can refer to:
A Simple Guide to Show More Information on a Calendar Event
I recommend to use workflow to achieve what you want. But you need to create a people column to display the manager.
You can create a workflow associated to the "Out of Office Request" list, add action to Start Approve Process. If the manager approves the request, you can create a item in the calendar, and then update the people column and the title column.
Then the calendar will display the Title, date/time and the manager.
To create a view for each manager, you need to modify the Filter. You can use the people column is equal to the manager name or the Title contains the manager name.
Thank you for your understanding.
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Two forms on same page..save state of one form while submitting other.
Hi....
I have 2 form on same page....
first is form on table....
nd another is tabular form.....
now if I make an entry in both table ,,,,and after entering data in tabular form if click on submit button of tabular for the data of tabular form get submitted,,but the data I have been enter in first form get erased.....
now my question is how can I save state of my first form even after clicking on submit button...........
pls,help.Hi Shirish,
in your scenario you can write manual process for one form in your both forms, using this way you can achieve you functionality.
do the above and for that manual process keep the button name as your second form button means, for two forms saving with only one button.
i am not sure in this, but you can try something.
Thanks
Chandran
Edited by: Chandran on Nov 28, 2011 2:21 AM -
What do I have to write when in compilation form they ask about url website?
I am trying to complete the compilation form create a sell books account. I can't go on because I don't know what do I have to write when in compilation form they ask about url website (in Physical Address and Contact Information section).
Sorry for my english
Thank youJust as the message says, she can't search places in Canada.
Unfortunately, location based Siri searches are only supported in the U.S. for right now. They are coming to other places such as Canada but we don't know when. -
Trying to join two forms in application express
i imported the timesheet package on OTN & like i understand it's a colllection so certain things won't be found in the db or in the tables because some things are in memory,
but i need to create another form on the same page as the timesheet form but the two forms should somehow be joined so when i select the next button it should take both of the two forms info to the next page, how do i get that right?Apex Collection is a table like any other. It is accessed using a package since it contains session related data. To see how to work with collections, you may want to have a look at this example:
http://apex.oracle.com/pls/otn/f?p=31517:30
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Two forms that update differrent tables on the same page?
I tried to add two forms that update different tables on to one page.
Problem is when I do that the forms gives me an error saying the field does not exist. It's like it is trying to update one table with the other tables fields.
As an example Say I have one forms that is for people table and another one that is the Jobs table.
When I go to update the people table, it sends the data for the jobs fields too I get an error like the field job description does not exist.
I have two different forms for these and everything.
I would hope it is possible to have two forms that update different tables on the same page.I was trying the exact same thing, but i managed to work round it by setting the steps to hide one region, so the user would enter the form see one region submit the region then direct back to the same page with the different region visible and the original hidden.
I don't know if this would be acceptable for you... -
'Unable to find operation: null' Error When I invoke Composite Wsdl Url
Hi ,
I have created one composite application which consists one BPEL process.That BPEL process takes input from other application.
But When I invoke that Wsdl Url to push the data from my application to that Wsdl Url,It is giving below error(System fault):
'Unable to find operation: null' .
I am getting below message in enterprise manager console (http://ipaddress:port/em):
'Composite instances are not generated for rejected messages. Click the error message for details'.
Note: When u click on 'unable to find operation: null' link it is showing the soap request that we submitted to composite URL.
Instance ID is also not created.
Can anybody help me regarding this issue?As you are able to test the Composite in the EM console and the correct operation, everything looks fine from SOA side.
Now whatever application from which you are trying to push the data, make sure while configuring the WSDL of the Composite, please check whether you can select the operation of the SOA Composite over there. I think you are leaving the default option which is null or not selecting the required operation over there.
Hope this helps
N -
Struts : Validating two forms in a single page , on a single submit
In my JSP page, i have two forms, with modifiable feilds. I'm using submit button of the 2nd form to submit both forms (ie. <form action="someAction2.do" onsubmit="return firstForm.submit();"> )
Two forms have different actions which is specified in structs-config.xml. Validation(server-side) is done using validation.xml file.On success/failure, both these actions are mapped to the same (input) JSP page.
Problem is that, validation errors in second form only is displayed. This is because, as soon as 1st form returns validation errors, the second form gets submitted. How can i specify that 2nd form should be submitted only if the 1st form doesnot return any validation errors. I know its possible using javascript at client side, but i want this validation on server-side.
Can any one please help me out. ThanksOff hand I dont know the answer to your question. But since no one answered your question, here are my 2 cents worth:
I suggest all your JSP pages have one and only one form tag. Re write your JSP page. Make sure all your variables your submitting have unique names. (no duplicate names). As far as I know, having multiple forms on a JSP page is not normallly done and makes it difficult to alter by another programmer after you leave the company.
Maybe you are looking for
-
Photos do not Appear in "Photo Settings" Preview
I am currently creating a "photo essay" (just a fancy name for slideshow) using iMovie. As this project contains no video, it is important that I use the "Ken Burns Effect"to make the slideshow interesting. However, after selecting a clip to edit, ch
-
I have detached audio from clips which explains what I am doing in the video clips (they are muted). I also have a song that I want to play at normal volume in the background when there isn't an audio clip in which I am talking and to reduce volume w
-
I have an ipad 2 WiFi. I was in the hospital having surgery and forgot my password. I tried several times but couldn't get it. I ended up disabling my ipad. There are important pics n notes in there that I need. How can I get back into it without usi
-
Kgefec:fatal error0; OCI-21503:program terminated by fatal error; OCI-04030
Hi expert, I've hit the following errors when I tried to start my application using the corbaloc call:- Would appreciate your expertise adv and helps, please~! dlys_storage_prep_srvr -ename INT -pname DLYS_PREP_SRVR -ORBInitRef NameService=corbaloc:i
-
Reinstalling Acrobat 9 after upgrading my x86 computer from Win XP Pro to Win 8 Pro on a metered isp
I am trying to reinstall Acrobat 9 after upgrading my x86 computer from Win XP Pro SP3 to Win 8 Pro. I used the CD to install the original Acrobat 9, then began the process of applying all the updates that have been issued since. The update from 9.0