Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Struts
Search Coderanch
Advance search
Google search
Register / Login
Help coderanch get a
new server
by contributing to the
fundraiser
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Devaka Cooray
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
paul wheaton
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Lou Hamers
Piet Souris
Frits Walraven
Forum:
Struts
Struts 2 and Java ME (HttpConnection)
Rafael F. Oliveira
Greenhorn
Posts: 12
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi...
im using HttpConnection for to send a
string
into server, in following:
public void sendPostRequest(String nmea) { HttpConnection hc = null; DataOutputStream dos = null; try { hc = (HttpConnection) Connector.open(defaultURL, Connector.READ_WRITE); hc.setRequestMethod(HttpConnection.POST); hc.setRequestProperty("User-Agent","Profile/MIDP-2.0 Configuration/CLDC-1.0"); hc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); // Send the string entered by user byte by byte dos = hc.openDataOutputStream(); byte[] request_body = nmea.getBytes(); for (int i = 0; i < request_body.length; i++) { dos.writeByte(request_body[i]); } dos.flush(); dos.close(); } catch (IOException ioe) { } finally { // Free up i/o streams and http connection try { if (hc != null) hc.close(); } catch (IOException ignored) {} try { if (dos != null) dos.close(); } catch (IOException ignored) {} } }
how to get this string in the Strus 2 Action?
With a little knowledge, a
cast iron skillet
is non-stick and lasts a lifetime.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Error Initializing http tunnel connection.
Problem using http post over j2me
help on closing streams
checking for internet connectivity
HTTP connection thread problem to SERVLET on APACHE
More...