Suka Hati

Ranch Hand
+ Follow
since Oct 28, 2004
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 Suka Hati

Hi there,
I have a question.
In a servlet if we want to call a jar file we should import it.
Eg. import test.*;

if we want to use a class in that jar file, the way we call it is :

Try try = new Try();

and calling method in that class:

try.callSentence();

What if we want to initialize it. How to do this?Is the below code right?

Try try = new Try(1,2);
17 years ago
Hi....
I have a servlet that will call a java application to execute.
Java application will produce an output which is wave file.
If I try to run the java file itself (stand-alone)and if it fails to produced an output an error message will appear at the dos windows.

The problem is how to transform that : System.out.println("error message")
to html ?
17 years ago
Hi,
I use servlet to send input from jsp to my java program. Later, java program will creat a wav file as the ouput. i will embed the wav file in html page. the problem is, when i want to key in new input, it will go through the same process but when i want to play the wav file, i will listen to the previous wav file even in server the wav file have been overwrite with new wav output. When i clear user cache before key in new input, I will get the latest output. Is there anyway for the servlet to clear user cache before send new input to java application?
17 years ago
i've put that coding(bgsound and embed) in my pages. but when i try to f\browse it using netscape 7.0, i got a blank page. why this happen? it runs well in IE
can anybody tell me how to embed an audio in webpage. foe example to make it as a bckground sound?
error(continue)

root cause

java.lang.NoClassDefFoundError
17 years ago
I am using tomcat on linux machine

when i run my page, i got thies error
javax.servlet.ServletException: Error instantiating servlet class Try5
my directory is :

webapps/try/demo.jsp
webapps/try/WEB-INF/web.xml
webapps/try/WEB-INF/classes/Try5.cla�ss

My WEB.XML file is:
------------------------------�------------------------------�-------
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<servlet>
<servlet-name>Try5</servlet-name>
<servlet-class>Try5</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Try5</servlet-name>
<url-pattern>/Try5/*</url-pattern>
</servlet-mapping>
</web-app>

it seems like it doesnt found my servlet.
how to solve this error
17 years ago
what i means from my previous reply is that even when i change attachment to inline, user still can save the file. what i want to do is it will not prompt the pop-up menu but it open it automatically for user. am i able to do that? if not, is there any other way or can i dumb the save button which mean that it just a button but if user click on it, nothing happen. or can i take out the save button
17 years ago
i've tried to change it to inline as u said...but it still prompt the pop-up windows. is there any other way to solve this problem
17 years ago
hi there....
a have a servlet where it will download a wav for user. a pop-up windows will appear and user can choose whether they want it to open or save.the coding :

public void download(HttpServletRequest req, HttpServletResponse resp)throws IOException {

PrintWriter out=resp.getWriter();

String filePath;

String fileNameNew="temp.wav";
filePath="/bin/"+fileNameNew;
resp.setContentType("audio/x-wav");

resp.addHeader("Content-Disposition", "attachment; filename="+fileNameNew);
try{
File uFile= new File("temp.wav");
int fSize=(int)uFile.length();
FileInputStream fis = new FileInputStream(uFile);
PrintWriter pw = resp.getWriter();
int c=-1;

while ((c = fis.read()) != -1){
pw.print((char)c);
}
// Close output and input resources.
fis.close();
pw.flush();
pw=null;
//response.sendRedirect("borangtest.jsp");
}catch(Exception e){
}
}

despite pop-up windows, is there any way to do so that there will be no pop-up window but it will automaticly open the wav file using user's audio player.

the idea is i dont want to give privillage for user to save that file. they can only open it.

plz help me
17 years ago
hi there!!!
i have one problem....
i have a string which actually an integer...because it was selected from a string...
eg : i buy 2 cakes
the selected substring is 2(name as select)

i need to compare it...if select is less then 0....then it will instantiate to 0....where it will the gives the output as

i buy 0 cake...

the problem is....i cant do the comparison because 2 is not an integer...its a string.....
can anybody help me solve this problem
17 years ago
i have below coding

outputDuration.addElement(cubaan);

cubaan is integer. outputDuration is a vector. when i tried to compile this coding i got error

addElement(java.lang.Object) in java.util.Vector cannot be applied to (int)
outputDuration.addElement(cubaan);

how to solve this error???can anybody help me
17 years ago
hehe...yeah...sukahati means happy....
back to my question......

i have a string array[5].examples i have first element like this; you-and-i.
for each element in the array...i want to delete the '-'and change it with and '' character...
this mean that the examples will be youandi.....how to do this???

i want to delete all '-' in every element of that array....i try to to a looping, in every looping....the element involve....i use indexOf to get where the '-' is and then use deleteCharAt...like below cooding

StringBuffer cTest = new StringBuffer(outputPos[finaltest]);
int tryElement;
tryElement=(outputPos[finaltest]).indexOf("-");
cTest=cTest.deleteCharAt(tryElement);

but tryElement send a negetif value....how to solve this problem
17 years ago
hi...
i have a string array.examples i have first element like this; you-and-i.
for each element in the array...i want to delete the '-'and change it with and '' character...
this mean that the examples will be youandi.....how to do this???
17 years ago
thanks everybody....i manage to solve my problem....thanks to ben and david...i really appreciate the help from both of u...
17 years ago