Results 1 to 1 of 1
- 11-16-2007, 01:27 AM #1
Member
- Join Date
- Nov 2007
- Location
- Bay Area, CA
- Posts
- 13
- Rep Power
- 0
Probably a really simple question...
Hello,
I have an applet which POSTs data to a PHP page, and I think the code is ok. However, it doesn't redirect to that page. I need it to close the applet and redirect to posttest.php with the POST info. I did a stacktrace and nothing came up ... Here is my code:
Any help is appreciated!Java Code:if (f.exists()) { overallLayout.show(cardPanel, "3"); //show scanning files, please wait try { // Construct data String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8"); data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8"); // Send data URL url = new URL("posttest.php"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write(data); wr.flush(); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { // Process line... } wr.close(); rd.close(); } catch (Exception ex) { } } else { overallLayout.show(cardPanel, "2"); //show that it doesn't exist }
Thank you,
- JeffLast edited by ibanez270dx; 11-16-2007 at 01:45 AM. Reason: just did a stacktrace
Similar Threads
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
Simple Method Question
By Froz3n777 in forum New To JavaReplies: 2Last Post: 02-13-2008, 02:39 AM -
simple GUI
By dim_ath in forum New To JavaReplies: 3Last Post: 01-07-2008, 03:00 PM -
Simple append question
By Rageagainst20 in forum New To JavaReplies: 0Last Post: 12-20-2007, 11:40 PM -
Simple question of JTable
By carl in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 07:07 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks