arduino yun connect to jsp












0















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.










share|improve this question























  • 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 '18 at 9:22













  • thank u !! but i want to use post method. today i success post to jsp!

    – 서제현
    Nov 23 '18 at 4:39











  • Now the problem is more than 100 SQL Connect. What should I do?

    – 서제현
    Nov 23 '18 at 4:43
















0















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.










share|improve this question























  • 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 '18 at 9:22













  • thank u !! but i want to use post method. today i success post to jsp!

    – 서제현
    Nov 23 '18 at 4:39











  • Now the problem is more than 100 SQL Connect. What should I do?

    – 서제현
    Nov 23 '18 at 4:43














0












0








0








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.










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 3:36









서제현서제현

43




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 '18 at 9:22













  • thank u !! but i want to use post method. today i success post to jsp!

    – 서제현
    Nov 23 '18 at 4:39











  • Now the problem is more than 100 SQL Connect. What should I do?

    – 서제현
    Nov 23 '18 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 '18 at 9:22













  • thank u !! but i want to use post method. today i success post to jsp!

    – 서제현
    Nov 23 '18 at 4:39











  • Now the problem is more than 100 SQL Connect. What should I do?

    – 서제현
    Nov 23 '18 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 '18 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 '18 at 9:22















thank u !! but i want to use post method. today i success post to jsp!

– 서제현
Nov 23 '18 at 4:39





thank u !! but i want to use post method. today i success post to jsp!

– 서제현
Nov 23 '18 at 4:39













Now the problem is more than 100 SQL Connect. What should I do?

– 서제현
Nov 23 '18 at 4:43





Now the problem is more than 100 SQL Connect. What should I do?

– 서제현
Nov 23 '18 at 4:43












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy