Problem in setHeader method
i am using the following servlet code to invoke download dialog.how can i get response of the user from the dialog window.(i.e the user pressed the OK or CANCEL button in the dialog by the user)
response.setContentType("application/x-filler");
response.setHeader("Content-Disposition", "attachment; filename=\"" + f.getName() + "\";");
ServletOutputStream stream = response.getOutputStream();
BufferedInputStream fif = new BufferedInputStream(new FileInputStream(F));
int data;
while((data = fif.read()) != -1) {
stream.write(data);
fif.close();
stream.close();
What sort of dialog are you refering to?
Similar Messages
-
I have problem with pay method
I have problem with pay method. My card declined. I change card and I have the same problem. What can i do? Why declined my card again?
Contact iTunes store support: https://ssl.apple.com/emea/support/itunes/contact.html.
-
Hi, I am having this problem:
I made a CustomItem, a TextField, now I overloaded the traverse method, so if the keycode is Canvas.UP or Canvas.DOWN then return false else return true.
The problem is that when I press the left or rigth button it also returns false and not true.
and there is another problem with traverse, before returning false or true I set a boolean and call to repaint to draw it on some way if its selected or not, the paint method is being called but it just dont draw as desired.
protected void paint(Graphics g, int ancho, int alto) {
System.out.println ("Dentro del paint, seleccionado="+seleccionado);
try {
g.drawString(label, 0, 0, Graphics.TOP|Graphics.LEFT);
if (!seleccionado) {
g.setColor(120, 120, 120);
g.drawRect(0, 4, tama�oTexto+8, 25);
if (seleccionado) {
g.setColor(255, 255, 255);
g.fillRect(1, 5, (tama�oTexto+8-1), 23);
g.setColor(0, 0, 0);
if (!seleccionado) {
g.setColor(80, 80, 80);
g.drawString(texto, 4, 7, Graphics.TOP|Graphics.LEFT);
if (seleccionado) {
int cursorX=Font.getDefaultFont().charsWidth((texto.substring(0, idLetraActual)).toCharArray(), 0, texto.substring(0, idLetraActual).length())+4;
g.drawChar('|', cursorX, 7, Graphics.TOP|Graphics.LEFT);
} catch (Exception E){
E.printStackTrace();
}the traverse method set the seleccionado variable and calls to repaint but instead of being false the paint method is drawing it as true (most of times).I have a problem with findByxxx() method.. in
Container managed bean.
i have
Collection collection =
home.findByOwnerName("fieldValue");
specified in my Client Program, where ownerName is the
cmp fieldname..
and
public Collection findByOwnerName(String ownerName)
throws RemoteException, FinderException
defined in my home interface.
i have not mentioned the findBy() method anywhere else
(Bean class). You have to describe the query in the deployment descriptor.
>
Even if i have a same "fieldValue" in the database
(Oracle), which i specified in findBy() method, iam a
result of owner Not found, which is not the case as i
have that owner name.
for the same application if i use findByPrimaryKey(),
it is working..
Can any one please post me the solution. -
Problem with Vector method addElement
I am new to Java. I am using JDK 1.3. I am writing a program that will convert a text file to a binary file that stores a Vector object. I have narrowed my problem to the method that reads the text file and creates my vector. Each element in my vector stores an integer and a string variable. The reading of the text file works find and the creation of my record works find. It seems that the storing of the record in the vector is not working. When I print the first 10 elements of the vector, it have the same record(the last record of my text file). What is wrong with the method below? I am also appending the result of running my program.
private static void readTextFile(File f) {
try {
FileReader fileIn = new FileReader(f);
BufferedReader in = new BufferedReader(fileIn);
String line;
int i;
SsnLocationRecord recordIn = new SsnLocationRecord();
int ctr = 0;
while (true) {
line = in.readLine();
if (line == null)
break;
ctr += 1;
i = line.indexOf(" ");
recordIn.putAreaNumber(Integer.parseInt(line.substring(0,i).trim()));
recordIn.putLocation(line.substring(i+1).trim());
records.addElement(recordIn);
if (ctr < 11)
System.out.println(recordIn);
in.close();
} catch (IOException e) {
System.out.println ("Error reading file");
System.exit(0);
for (int i = 0; i < 11; i++)
System.out.println((SsnLocationRecord) records.elementAt(i));
RESULTS:
C:\Training\Java>java ConvertTextFileToObjectFile data\ssn.dat
0 null
3 New Hampshire
7 Maine
9 Vermont
34 Massachusetts
39 Rhode Island
49 Connecticut
134 New York
158 New Jersey
211 Pennsylvania
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
680 Nevada
C:\Training\Java>First of all it would be better if you did a priming read and then checked line == null in the while statement instead of the way you have it.
ctr++ will also accomplish what ctr +=1 is doing.
you need to create a new instance of SsnLocationRecord for each line read. What you are doing is overlaying the objects data each time you execute the .putxxxx methods. The reference to the object is placed in the vector. The actual object is still being updated by the .putxxx methods (NOTE : THIS IS THE ANSWER TO YOUR MAIN QUESTION).
you close should be in a finally statement.
To process through all the elements of a Vector create an Enumeration and then use the nextElement() method instead of the elementAt is probably better. (Some will argue with me on this I am sure).
Also, on a catch do not call System.exit(0). This will end your JVM normally. Instead throw an Exception (Runtime or Error level if you want an abnormal end). -
Hi,
I have a problem with the method prerender. A month ago, I started to develop a web project using Sun Studio Creator and a few page beans that i used extended the Abstract Page Bean, so I overrided the prerender and customized it.
The problem is that, now i'm using eclipse and the configuration files of the project has changed and the prerender method never execute.
I want to know why it is happening. Maybe the project is "bad-configurated"?
ThanksThe code of java bean doesn't change, the only thing that has changed is the configuration files (faces-config.xml, web.xml, etc).
I put a breakpoint in the prerender method but the lifecycle doesn�t execute this method.
After serveral changes, I wrote this code in the method prerender :
int i=0;
i = 1;
And the prerender method doesn't execute.
I'm a bit lost,
thanks -
Problem with affinetransformOp method...
I have a serious problem with filter method
I Want to make a image flipping or some other filtering by using
AffineTransformOp
but it printouts an erro like this
cannot resolve symbol
op.filter (img, flipped)
(the error pointer shows ".after the op")
a code from my one of the filters
BufferedImage flipped = new BufferedImage(img.getHeight(), img.getWidth(),BufferedImage.TYPE_INT_RGB);
AffineTransform trans = new AffineTransform(0, 1, 1, 0, 0, 0);
AffineTransformOp op = new AffineTransformOp(trans, AffineTransformOp.TYPE_NEAREST_NEIGHBOR);
op.filter(img, flipped); //img is my buffered image source
I used some other ways like (img, null) but always give out error.
thanks..Did you declare "img" as BufferedImage or something else?
What is the full error message? -
Problem with WindowClosing() method
Hello everyone,
I have some problem with WindowClosing() method, in which I gave options
to quit or not. Quit is working fine but in case of Cancel, its not returning to
the frame. Can anyone help me ....Here is my code
import javax.swing.*;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
public class TestFrame extends JPanel
public static void main(String[] args)
JFrame frame = new JFrame("Frame3");
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
int button = JOptionPane.showConfirmDialog(null,"OK to Quit","",JOptionPane.YES_NO_OPTION, -1);
if(button == 0) {
System.exit(0);
else
return;
frame.addWindowListener(l);
frame.setSize(1200,950);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}Maybe try
int button = JOptionPane.showConfirmDialog(yourframe,"OK to
Quit","",JOptionPane.YES_NO_OPTION, -1); -
Problems using GET method in JSP
Hi,
I had some problems using GET method in JSP.
I'm using Apache web server 1.3 and Tomcat 3.3.1 in windows 2000.
And I'm using language English and Korean.
When I send messages using POST method, all is good
But when I send message using GET method, English is good, but Korean is not good.
I tried to encode using
URLEncode.encode(str, "UTF-8")
and decoding it using
URLDecode.decode(request.getParameter(tag), "UTF-8")
but it didn't work.
How can I receive request including Korean using GET method in JSP?
If anyone have solutions, please let me know.
thanks.Hi,
I had some problems using GET method in JSP.
I'm using Apache web server 1.3 and Tomcat 3.3.1 in
windows 2000.
And I'm using language English and Korean.
When I send messages using POST method, all is good
But when I send message using GET method, English is
good, but Korean is not good.
I tried to encode using
URLEncode.encode(str, "UTF-8")
and decoding it using
URLDecode.decode(request.getParameter(tag), "UTF-8")
but it didn't work.
How can I receive request including Korean using GET
method in JSP?
If anyone have solutions, please let me know.
thanks.This problem appears, when one use UTF-16 encoding in JSP - am I right?
If so there are two solutions:
1) Temporary: Use "UTF-8" - or any other 8 bit encoding scheme and
encode Korean symbols with "&1234;" kind of escapes - though it
may not work
2) Absolute: get my piece of code, which I have managed to write
just a month ago resolving absolutely similar problem with UTF-16
in code using Chinese/Russian/English encodings
But I wouldn't say that it's costs 10 DDs :) - it's much more
expensive... So try 1st variant if it wouldn't help - let me know.
I'll figure :)
Paul -
Screen Resolution Problem in Session Method
Hi
I want to use session method in BDC. How to resolve screen resolution problem in Session Method?
Please give me the code or steps regarding this.
Thanks & Regards
venkateswararaoHi
U can only run the session with the option Dynpro Standard Size setted.
In this way the system should be use the same resolution for every situation.
Max -
Problems w my method payment
Go to settings/itunes & app store tap on ID then view ID then tap payment information and see whether paypal is a payment option for you. If it is not then you will need to check from one of the available payment options
-
When we use setHeader() method??
hi,
when we use setHeader() method??Hello,
I need to place some parameters in a header and send the others as
a body. However when i try to place some in a header i get error.
This is the code of the CLIENT:
Header header=new Header();
Vector params = new Vector ();
params.addElement (new Parameter("UserName", String.class,
"xxx", Constants.NS_URI_SOAP_ENC));
(...) <-- other params (similar as the one above)
header.setHeaderEntries(params);
// build the call.
Call call = new Call();
call.setSOAPTransport(st);
call.setSOAPMappingRegistry (smr);
//"urn:xmethods-Temperature" (below--> for the temperature thing
call.setTargetObjectURI("https://www.creditinform.no/creditinform
.standardwebservice.ws2005207/InfoXML");
call.setMethodName("HitListPerson");
call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encodin
g/");
call.setHeader(header);
And i get the following error:
java.lang.ClassCastException: org.apache.soap.rpc.Parameter
at org.apache.soap.Header.marshall(Header.java:134)
at org.apache.soap.Envelope.marshall(Envelope.java:197)
at org.apache.soap.Envelope.marshall(Envelope.java:162)
at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnect
ion.java:354)
at org.apache.soap.rpc.Call.invoke(Call.java:261)
Any sugestion could be helpfull.
Thank you for your time,
C.E. -
I have problem verifying payment method by my pre-paid visa credit card
I have a problem verifying payment method by my pre-paid visa credit card ???
Apple does not accept pre paid cards > iTunes Store: Accepted forms of payment
Purchase an iTunes gift card that you can redeem and use to purchase iTunes and App Store content.
http://www.apple.com/itunes/gifts/?cid=wwa-us-kwg-music-itu -
I am trying to install free apps but I always get billing problem? Payment Method!!?
Likely because you are trying to create a Mac App Store account with an existing Apple ID. The None option often is not available in that case. If you create a new Apple ID and iTunes/Mac App Store account following these instructions carefully, you will be successful in getting free apps without a payment method.
Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card -
http://support.apple.com/kb/HT2534 -
Problem in calling method with object in another class
Hi All,
Please tell me the solution, I have problem in calling a method I am posting the code also
First Program:-
import java.io.*;
public class One
public One()
System.out.println("One:Object created");
public void display()
System.out.println("One:executing the display method");
static
System.out.println("One:executing the static block");
Second Program:-
import java.io.*;
public class Two
public Two()
System.out.println("Two:Object created");
public static void main(String arg[])throws Exception
System.out.println("Two:executing the main method");
System.out.println("Two:loading the class and creating the object::One");
Object o=Class.forName("One").newInstance();
System.out.println(o);
o.display(); //displaying error here in compile time.
static
System.out.println("Two:executing the static block");
waiting for your answer,
thanks in advance,bye.Hi All,
Please tell me the solution, I have problem in
calling a method I am posting the code also
First Program:-
import java.io.*;
public class One
public One()
System.out.println("One:Object created");
public void display()
System.out.println("One:executing the display
method");
static
System.out.println("One:executing the static
block");
Second Program:-
import java.io.*;
public class Two
public Two()
System.out.println("Two:Object created");
public static void main(String arg[])throws
Exception
System.out.println("Two:executing the main
method");
System.out.println("Two:loading the class and
creating the object::One");
Object o=Class.forName("One").newInstance();
System.out.println(o);
o.display(); //displaying error here in compile
time.
static
System.out.println("Two:executing the static
block");
waiting for your answer,
hanks in advance,bye.the line
o.display()
could be written as
((One)o).display(); -
Problem with doubleValue() method and hashtable
Hi,
I made a type double variable named tempNumber.
and I used this to put that number in a hashtable
CODE 1 : hash.put(key, new Double(tempNumber));
Then I wrote this code to retrieve it.
CODE 2: (hash.get(st.sval)).doubleValue();
Note: I am using streamtokenizer to get the nexttoken, so st.sval is a string representation of the token.
Now my problem is when I compile CODE 2, I get an error message saying that "method doubleValue() not found in java.lang.Object". Whats going on here??
I am using java 1.1 by the way.
Thanks in advance...Hash table stored and returns objects. You have to typecast the return value of get() method to Double and then call doubleValue() on it.
Its something as follows
((Double)hash.get(key)).doubleValue()
Maybe you are looking for
-
I use the Microsoft Outlook Web App for work email. I receive files with a .RXML extension. This has always worked just fine until the latest version of Firefox came out (I was using FF 7 until this weekend). Now FF changes the extension to .ashx whe
-
How can i view monthly calendar entries in OS7 like in OS6?
I just purchased an iPhone 5S with OS7;I had been using a 4S with OS6. I cannot figure out how to change view of calendar. On my 4S I could see entries when I looked at the whole month calendar. On the 5S, I only see a dot for an event; I have to
-
I want to sync my music library of my Ipad to my Iphone.I am travelling overseas and do not have access to my synced Mac. My iphone had to be reset and I lost my library with I rest to use a new sim card. I have a PC with me which has Itunes but it d
-
Connecting my MP3 Player to a Ste
I want to connect my mp3 player to my "CX-CD375 Coby Micro Stereo System" but the only jack it has is a headphone jack. So I can't connect it. Or unless there's another way. I already tried a 3.5 mm to 3.5 mm cable but it didn't work. <IMG height=49
-
Issues with eclipse plugin WCS11G_BP1
We're just upgrading to 11G from 7.5.5 which is great, but I am having some issues working with a remote instance using Eclipse. Whenever I save a file in Eclipse, an exception is thrown on the server: [2013-02-11 14:03:28,635 CET] [ERROR] [.kernel.D