Kop Ite

Greenhorn
+ Follow
since Aug 06, 2001
Merit badge: grant badges
For More
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 Kop Ite

Hi,
How do I split a string such as "D,FG,ER,SDS,Q" in PL/SQL Oracle 8i?
I cannot find the function that would do this and put into an Array?
Cheers!
20 years ago
Hi
I have two objects one a java.sql.Date object and the other java.util.Date object.
I want to know the number of days between the two dates? How do I do this ?
If that is not possible, how do I convert the java.sql.Date object to a java.util.Date object ?
Please suggest.
Thanks

Hi
I am trying to convert a java.util.Date into java.sql.Date as below:
java.util.Date aDate
(java.sql.Date) aDate
< where aDate = Mon Nov 11 00:00:00 GMT 2002 >
I am getting exception:
java.lang.ClassCastException: java.util.Date
How do I sort this out so it will work remembering that aDate value is set in stone, so nothing can be done with that, must be converted into java.sql.Date.
Help !!
thanks
21 years ago
found the answer:
HttpServletRequest.getRealPath("/")
this gives the full path.
22 years ago
Hi,
What is the code that will establish the UNC (i.e. \\host\dir\servlet) address of the servlet that is running ?
thanks
22 years ago
Hi,
My Servlet code downloads a csv into Excel as required BUT it also attempts to download the JSP file (that calls the servlet) and the Servlet file as well.... How do I ensure that only the csv file is downloaded. I am using the following code.
<servlet code>
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
ServletOutputStream out = res.getOutputStream ();
res.setContentType( "application/vnd.ms-excel" );
String report = req.getParameter("report");
filename = report + user_id + ".csv";
String fileURL = the url;
res.setHeader("Cache-Control", "no-cache");
res.setHeader("Content-disposition",
"attachment; filename=" +
report + ".csv" );
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try
{
URL url = new URL ( fileURL );
bis = new BufferedInputStream(url.openStream());
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
{
bos.write(buff, 0, bytesRead);
}
}
catch(final MalformedURLException e)
{
System.out.println ( "MalformedURLException." );
throw e;
}
catch(final IOException e)
{
System.out.println ( "IOException." );
throw e;
}
finally
{
if (bis != null)
bis.close();
if (bos != null)
bos.close();
}
}
</servlet code>
thanks in advance
22 years ago
Is it possible to call a script on another UNIX box from the one which the Servlet is running? I thought security violations were where you're attempting to connect with another box from an applet. I am not sure whether Servlet disallows my requirement. If so that is a shame - for me - but what if the script existed on the same machine or called a script on the same machine which then pointed at another script on another machine ???
22 years ago
Hi,
How do I code my servlet such that it can call a script ( Korn, Perl etc) on another Unix box (e.g. dsn123) ?
I guess that i'd need to be using Runtime.getRuntime().exec ??
.... Runtime.getRuntime().exec(" ../host/home/third/script.pl")
cheers
22 years ago