on 11-08-2012 8:07 PM
I'm using the following jsp to upload a document and call a bls transaction
<%
boolean isMultipart = DiskFileUpload.isMultipartContent(request);
DefaultFileItemFactory factory = new DefaultFileItemFactory();
DiskFileUpload upload = new DiskFileUpload(factory);
List /* FileItem */ items = upload.parseRequest(request);
Iterator iter = items.iterator();
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (!item.isFormField()) {
String fileName = item.getName();
String contentType = item.getContentType();
File uploadedFile = new File("\\\\Livadmmdvci1\\MII_Backups\\Upload\\" + fileName.substring(fileName.lastIndexOf("\\") + 1));
item.write(uploadedFile);
String site = new String("/XMII/Runner?Transaction=CustomerComplaintTracking/UploadFile-b&FILETYPE=" + contentType + "&FILENAME=" + (fileName.substring(fileName.lastIndexOf("\\") + 1)));
response.sendRedirect(site);
}
}
%>
However the response.sendDirect(site) line is routing my application to a page displaying the output xml from my bls. I'm wondering if there is a way to call my transaction via the runner without using the response.sendDirect? I would like to upload the document and call the transaction and than direct the application back to the original screen. Any help is appreciated. Thanks
Hello Scott, you can achieve what to want to do with a post to an iframe located in your page.
Then on the reply from the server, you can even put a small javascript which would call a function from the source page to let the page know that the files have been uploaded (or not).
Cheers,
Arnaud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response. I changed the target of my form to my iframe and was successfully able to upload the document without leaving my original page.
However when the jsp executes the following line
response.sendRedirect(site);
it's redirecting the iframe page to my xml output, and I can't perform any javascript. How do I go about performing the BLS execution
/XMII/Runner?Transaction=CustomerComplaintTracking/UploadFile-b&FILETYPE=" + contentType + "&FILENAME=" + (fileName.substring(fileName.lastIndexOf("\\") + 1))
without using the response.sendRedirect(site) line?
Thanks
Hello, you need to complete the url of the transaction posting the file
/XMII/Runner?Transaction=CustomerComplaintTracking/UploadFile-b&FILETYPE=" + contentType + "&FILENAME=" + (fileName.substring(fileName.lastIndexOf("\\") + 1))
and the transction.
Add a string output parameter to the transaction, let's say OutputString (Type Output), define your html content inside, and set the outputtype of the trantion to Text/HTML
which means that you have to add "&OutputParameter=OutputString&Content-Type=Text/HTML" with the proper escaping to you site variable.
then in the transaction and OutputSting, if you put something like:
<html>
<script>alert('Hello')</script>
</html>
it should work.
Cheers,
Arnaud
Just a small comment, it's that you are using a jsp which is able to take care of several documents but which would in fact redirect you on the first document while keeping processing and posting the documents to the Transactions, not probably the desired effect, but it should work with one document, if it is provided, if nothing is provided, nothing is returned...
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.