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
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
Tim Cooke
Ron McLeod
paul wheaton
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Himai Minh
Bartenders:
Forum:
Struts
Struts 2 and Java ME (HttpConnection)
Rafael F. Oliveira
Greenhorn
Posts: 12
posted 16 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?
Don't get me started about those stupid
light bulbs
.
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...