Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Ted Dong

Greenhorn
+ Follow
since May 16, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ted Dong

Thanks Dave!
That does help a lot.
21 years ago
Dave,
Thanks for the response.
No, it is not essential to use response.sendRedirect(). That just happens to be the method I am using. I am not familiar with how to include or forward the request. Do you have any examples?
Also, the code that I have on the jsp page that is receiving the parameters looks like:
Enumeration parmEnum = request.getParameterNames();
String parmName;
while ( parmEnum.hasMoreElements())
{
parmName = (String)parmEnum.nextElement();
JSString += "cybCRAddLaunchParameter(\"" + parmName + "\",\"" + request.getParameter(parmName) + "\");\n";
}
Would I need to change this code if I were to include or forward the response?
Many thanks.
-td
21 years ago
Hi,
I have two jsp pages and I want to pass parameters from one to another. I was using response.sendRedirect("myjsp.jsp?Parameters") and this works fine. However... if the length of the parameter is very long (ie, thousands of characters) this method does not work. Is there another way of passing parameters that can handle large sizes of data?
Thanks.
-td
21 years ago
What does response.getOutputStream() return?
I want to capture the reponse that is sent back to the browser (ie, the html that the jsp page produces) and save it as a file on the server.
Does anyone have any examples?
Thanks in advance.
21 years ago
Thanks for the reply.
So, since I want my output (html) to be written to a file do I have to print the following:
pw.println{"<HTML><HEAD></HEAD><BODY>");
pw.println("the rest of the html....");
Or is the output stored in the buffer somewhere and could I just send the buffer contents to the printwriter?
Thanks.
21 years ago
Have you tried just putting in some System.out.println() in your bean?
21 years ago
Hi,
I want to send the output of a jsp file (ie, the html that the jsp page creates) to a file on the server.
Basically, I want to have the html that the user sees when they do view source from the browser, saved to a file on the server.
I know I can use FileOutputStream to create files on the server but I don't know what to pass into the write() method to write the output of the jsp page.
Thanks in advance.
21 years ago
Thank you Peter and Mike.
I was able to get it to work.
21 years ago
Thanks Peter.
I think I understand what you are saying. In my jsp page what would I need to do to set the result?
Can you give me an example of jsp code to set the return value?
Many Thanks.
21 years ago
Oops. Nevermind my last post. I made a typo in my original post. It should have read:
<form action=mypage.jsp target=_blank>
21 years ago
Thanks for the response but I don't quite understand what you mean by 'target='?
Can you elaborate?
21 years ago
I know how to pass a variable value from javascript to jsp. But how can I set a javascript value from a jsp page?
For example, I have an html page which contains a javascript variable.
<script language=javascript>
var myvar = "";
</script>
This page contains a form whose target is a jsp page
<form target=mypage.jsp target=_blank>
<input>....
</form>
When this form is submitted the jsp does some processing on the server. I want to set a result from the processing back into my javascipt variable myvar.
Does anyone know how to do this?
Thanks in advance.
21 years ago
Hi,
I have a jsp page that is creating an xml file on the server. The server has a process that takes this xml and creates a word document on the server. My jsp page basically waits to see if the word document is on the server then it will redirect the user to the word doc. While it is waiting the browser just shows a blank screen. What do I need to do to add some indicator for the user to see so that they know that the server is processing the request like a "Please wait" message.
Here is my code:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<%@ page import="java.util.Enumeration" %>
<BODY>
<%
String xmlData = request.getParameter("XMLData");
String ID = request.getParameter("ID");
String serverPath = request.getPathTranslated();
String xmlPath = serverPath.substring(0, serverPath.lastIndexOf("\\") - 3 ) + "ProposalXML" + "\\";
String proposalPath = serverPath.substring(0, serverPath.lastIndexOf("\\") - 3 ) + "Proposals" + "\\";
String xmlDataFile = xmlPath + ID + ".xml";
String xmlFileCheck = proposalPath + ID + ".xml";
String endFile = proposalPath + ID + ".end";
String absUrl = ("http://"; + request.getHeader("host") + request.getRequestURI());
String docUrl = absUrl.substring(0, absUrl.lastIndexOf("/") - 3) + "Proposals/" + ID + ".doc";
try
{
File fileCheck = new File(xmlFileCheck);
if (!fileCheck.exists())
{
FileOutputStream oStream = new FileOutputStream(xmlDataFile);
java.io.PrintWriter outstream = new PrintWriter(oStream);
outstream.print(xmlData);
outstream.flush();
outstream.close();
}
File fEnd = new File(endFile);
int counter = 0;
Thread Sleep_Obj = new Thread();
while (!(fEnd.exists()) && (counter <= 60))
{
Sleep_Obj.sleep(1000);
counter += 1;
}
if (fEnd.exists())
{
%><%response.sendRedirect(docUrl);%><%
}
else
{
%><center><font face="Arial,Verdana" size=+2>Document could not be generated, contact your local System Administrator</font></center><p><%
}
}
catch (IOException e)
{
}
%>
</BODY>
</HTML>
21 years ago
Ajith, thanks for the reply.
That method would work for me because I am a programmer... but for a normal user that won't work. I need to find a way to programatically do this so that the user does not have to.
Any more ideas?
I'm fairly new to XML/XSL. I am trying to use XML/XSL to create an HTML file. I'm using IE5.5 to save the HTML file on my local drive as HTML. When I try to open it in MS Word it shows up fine but if there are images in the HTML the images are not inserted into the word doc but are pointers to the locations where the image is located. So, if I am not connected to the net the image will not show up. How do I get Word to download the image into the document when I first open it up in Word?
Thanks for your help.