473,387 Members | 3,684 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Applet-Servlet Problem(Please Help)......

When I click the Button in Applet , I want it open a Dialog asking for
the excel to open/save etc... It doesnt happen why...

Now it doesnt create the excel file Why....
My Applet code is
------------------------------------------------------------------------------
URL url =new URL("http://localhost:8080/portal/servlet/com.kbs.framework.client.gui.ReportServlet");

HttpURLConnection servletConnection =
(HttpURLConnection)url.openConnection();
servletConnection.setDoInput(true);
servletConnection.setDoOutput(true);

servletConnection.setUseCaches(false);
servletConnection.setDefaultUseCaches(false);
servletConnection.setRequestMethod("POST");
servletConnection.setRequestProperty("Content-type","application/octet-stream");

ObjectOutputStream outStream =
new ObjectOutputStream(servletConnection.getOutputStre am());
outStream.writeObject(command);
outStream.flush();
outStream.close();

System.out.println("MY RESULT IN APPLET");
InputStream instr = servletConnection.getInputStream();
ObjectInputStream inputFromServlet = new ObjectInputStream(instr);
String result = (String) inputFromServlet.readObject();
inputFromServlet.close();
instr.close();
------------------------------------------------------------------

SERVLET CODE
--------------------------------------------------------------------
public void performTask(javax.servlet.http.HttpServletRequest
request,javax.servlet.http.HttpServletResponse response)
{
response.setContentType("application/vnd.ms-excel");
PrintWriter out = response.getWriter();
String fileName = "temp" + Long.toString(System.currentTimeMillis())
+ ".xls";
response.addHeader("Content-Disposition", "inline; filename=\"" +
fileName
+ "\"");
InputStream in = request.getInputStream();
ObjectInputStream inputFromApplet = new ObjectInputStream(in);
String command = (String) inputFromApplet.readObject();
String result = submitQuery(command);
System.out.println("RESULT" + result);
out.println(command);
out.close();
----------------------------------------------------------------------------
Jul 17 '05 #1
0 1714

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Invisible | last post by:
I recently got a News Ticker Java Script from: http://javascript.internet.com/. I've copied the appropriate Java Script code into my html code on the index page and class files into the same...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
0
by: John Shepardson | last post by:
I want to serve a web page using a Java applet called jmol that models molecules in three dimensions. You can see it at http://jmol.sourceforge.net/ itıs really cool I downloaded the...
2
by: Mark Richards | last post by:
An applet on one of my pages uses a big picture as background. I want to load it before the applet and the rest of the html source. By doing this I want to avoid that the pane of the applet is...
0
by: totoro | last post by:
I am a beginner in Java Applet. I am doing a homework that I don't know how to solve it. I am supposed to write an applet that has a textfield and a textarea, and it will show the number of...
4
by: rajesh | last post by:
here is my coding can any one help me to communicate b\w applet and jsp,... "appleeet.jsp" ------------ <%@ page language="java" %> <jsp:plugin type="applet" code="sample2.class"
0
by: sreenulanka | last post by:
when i am clicking the browse button image not opened in my applet please help me. // browse button, generate browse event when it clicks if (e.getSource()==browse) { ...
4
by: tudyfruity18 | last post by:
I'm suppose to write an applet that contains two buttons Investment calculator and Loan Calculator. When the Investment Calculator button is clicked, a frame appears in a new window for calculating...
3
by: pinkrose2105 | last post by:
I have to do the C applet but I actually don't know much about this.so please help me do this.if you have any website about the code of C applet,please show me as soon as possible!!!or any example of...
1
by: surajhs | last post by:
i need to convert image to binary data and create xml file in applet, Please send samples links
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.