arduino yun connect to jsp
up vote
0
down vote
favorite
I use arduino yun. I want to integrate yun and jsp. However, I am having trouble passing data through curl. What I would like to do is send a String a = "a" to http: // localhost: 8181 / arduino / a.jsp via the post method
#include <Bridge.h>
#include <HttpClient.h>
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);
Serial.begin(9600);
while (!Serial);
}
void loop() {
String var = "";
var = "a=a";
Serial.println(var);
HttpClient client;
if (client.connect("192.168.43.38",8181))
{
Serial.println("Sending to Server: ");
client.println("POST /arduino/a.jsp
HTTP/1.1");
client.println("Host: 192.168.43.38");
client.println("Content-Type: application/x-
www-form-urlencoded");
client.println("Connection: close");
client.println("User-Agent: Arduino/1.0");
client.print("Content-Length: ");
client.println(var.length());
client.println();
client.print(var);
client.println();
}
if (client.read() == 1) {
Serial.println("OK");
} else {
Serial.println("Error");
}
Serial.flush();
delay(1000);
}
a.jsp
<%@ page language="java" contentType="text/html;
charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String a = request.getParameter("a");
%>
<%=a %>
</body>
</html>
I don't live in English.
So I ask you to understand if English is strange.
I unconditionally want to receive data via the post method via jsp.
jsp arduino
add a comment |
up vote
0
down vote
favorite
I use arduino yun. I want to integrate yun and jsp. However, I am having trouble passing data through curl. What I would like to do is send a String a = "a" to http: // localhost: 8181 / arduino / a.jsp via the post method
#include <Bridge.h>
#include <HttpClient.h>
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);
Serial.begin(9600);
while (!Serial);
}
void loop() {
String var = "";
var = "a=a";
Serial.println(var);
HttpClient client;
if (client.connect("192.168.43.38",8181))
{
Serial.println("Sending to Server: ");
client.println("POST /arduino/a.jsp
HTTP/1.1");
client.println("Host: 192.168.43.38");
client.println("Content-Type: application/x-
www-form-urlencoded");
client.println("Connection: close");
client.println("User-Agent: Arduino/1.0");
client.print("Content-Length: ");
client.println(var.length());
client.println();
client.print(var);
client.println();
}
if (client.read() == 1) {
Serial.println("OK");
} else {
Serial.println("Error");
}
Serial.flush();
delay(1000);
}
a.jsp
<%@ page language="java" contentType="text/html;
charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String a = request.getParameter("a");
%>
<%=a %>
</body>
</html>
I don't live in English.
So I ask you to understand if English is strange.
I unconditionally want to receive data via the post method via jsp.
jsp arduino
The JSP code looks okay. If a parameter 'a' is included in the request it should be output. I do not see that you send a parameter 'a' however. I don't anything about YUN or posting data from it but a simple GET (arather than POST) request should work i.e. GET /arduino/a.jsp?a=passedValue
– Alan Hay
Nov 22 at 9:22
thank u !! but i want to use post method. today i success post to jsp!
– 서제현
Nov 23 at 4:39
Now the problem is more than 100 SQL Connect. What should I do?
– 서제현
Nov 23 at 4:43
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I use arduino yun. I want to integrate yun and jsp. However, I am having trouble passing data through curl. What I would like to do is send a String a = "a" to http: // localhost: 8181 / arduino / a.jsp via the post method
#include <Bridge.h>
#include <HttpClient.h>
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);
Serial.begin(9600);
while (!Serial);
}
void loop() {
String var = "";
var = "a=a";
Serial.println(var);
HttpClient client;
if (client.connect("192.168.43.38",8181))
{
Serial.println("Sending to Server: ");
client.println("POST /arduino/a.jsp
HTTP/1.1");
client.println("Host: 192.168.43.38");
client.println("Content-Type: application/x-
www-form-urlencoded");
client.println("Connection: close");
client.println("User-Agent: Arduino/1.0");
client.print("Content-Length: ");
client.println(var.length());
client.println();
client.print(var);
client.println();
}
if (client.read() == 1) {
Serial.println("OK");
} else {
Serial.println("Error");
}
Serial.flush();
delay(1000);
}
a.jsp
<%@ page language="java" contentType="text/html;
charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String a = request.getParameter("a");
%>
<%=a %>
</body>
</html>
I don't live in English.
So I ask you to understand if English is strange.
I unconditionally want to receive data via the post method via jsp.
jsp arduino
I use arduino yun. I want to integrate yun and jsp. However, I am having trouble passing data through curl. What I would like to do is send a String a = "a" to http: // localhost: 8181 / arduino / a.jsp via the post method
#include <Bridge.h>
#include <HttpClient.h>
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
Bridge.begin();
digitalWrite(13, HIGH);
Serial.begin(9600);
while (!Serial);
}
void loop() {
String var = "";
var = "a=a";
Serial.println(var);
HttpClient client;
if (client.connect("192.168.43.38",8181))
{
Serial.println("Sending to Server: ");
client.println("POST /arduino/a.jsp
HTTP/1.1");
client.println("Host: 192.168.43.38");
client.println("Content-Type: application/x-
www-form-urlencoded");
client.println("Connection: close");
client.println("User-Agent: Arduino/1.0");
client.print("Content-Length: ");
client.println(var.length());
client.println();
client.print(var);
client.println();
}
if (client.read() == 1) {
Serial.println("OK");
} else {
Serial.println("Error");
}
Serial.flush();
delay(1000);
}
a.jsp
<%@ page language="java" contentType="text/html;
charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String a = request.getParameter("a");
%>
<%=a %>
</body>
</html>
I don't live in English.
So I ask you to understand if English is strange.
I unconditionally want to receive data via the post method via jsp.
jsp arduino
jsp arduino
asked Nov 22 at 3:36
서제현
41
41
The JSP code looks okay. If a parameter 'a' is included in the request it should be output. I do not see that you send a parameter 'a' however. I don't anything about YUN or posting data from it but a simple GET (arather than POST) request should work i.e. GET /arduino/a.jsp?a=passedValue
– Alan Hay
Nov 22 at 9:22
thank u !! but i want to use post method. today i success post to jsp!
– 서제현
Nov 23 at 4:39
Now the problem is more than 100 SQL Connect. What should I do?
– 서제현
Nov 23 at 4:43
add a comment |
The JSP code looks okay. If a parameter 'a' is included in the request it should be output. I do not see that you send a parameter 'a' however. I don't anything about YUN or posting data from it but a simple GET (arather than POST) request should work i.e. GET /arduino/a.jsp?a=passedValue
– Alan Hay
Nov 22 at 9:22
thank u !! but i want to use post method. today i success post to jsp!
– 서제현
Nov 23 at 4:39
Now the problem is more than 100 SQL Connect. What should I do?
– 서제현
Nov 23 at 4:43
The JSP code looks okay. If a parameter 'a' is included in the request it should be output. I do not see that you send a parameter 'a' however. I don't anything about YUN or posting data from it but a simple GET (arather than POST) request should work i.e. GET /arduino/a.jsp?a=passedValue
– Alan Hay
Nov 22 at 9:22
The JSP code looks okay. If a parameter 'a' is included in the request it should be output. I do not see that you send a parameter 'a' however. I don't anything about YUN or posting data from it but a simple GET (arather than POST) request should work i.e. GET /arduino/a.jsp?a=passedValue
– Alan Hay
Nov 22 at 9:22
thank u !! but i want to use post method. today i success post to jsp!
– 서제현
Nov 23 at 4:39
thank u !! but i want to use post method. today i success post to jsp!
– 서제현
Nov 23 at 4:39
Now the problem is more than 100 SQL Connect. What should I do?
– 서제현
Nov 23 at 4:43
Now the problem is more than 100 SQL Connect. What should I do?
– 서제현
Nov 23 at 4:43
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423518%2farduino-yun-connect-to-jsp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The JSP code looks okay. If a parameter 'a' is included in the request it should be output. I do not see that you send a parameter 'a' however. I don't anything about YUN or posting data from it but a simple GET (arather than POST) request should work i.e. GET /arduino/a.jsp?a=passedValue
– Alan Hay
Nov 22 at 9:22
thank u !! but i want to use post method. today i success post to jsp!
– 서제현
Nov 23 at 4:39
Now the problem is more than 100 SQL Connect. What should I do?
– 서제현
Nov 23 at 4:43