<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 27.10.2022 13:13, Simon Besenbäck
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGVfHQ6YyWOXo=ZA7RcGFvb04_R=0sgzTfB5jaw+D1Pg0GroiQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">I am using Apache Tomcat 10.0.23 and nashorn 15.4
in an eclipse ide in order to develop JSP's.
<div>I want to send data (user input in a form) via the POST
method to another JSP.</div>
<div>However I do not know how I can get the sent data. In Java
I guess I would be using request.getParameter().</div>
<div>Is there a similar way to get the input using Nashorn?</div>
<div>I tried to play around with fetch() but I didn`t came to a
solution.</div>
</div>
</blockquote>
<p>You should be able to directly access the JSP implicit objects,
e.g. cf. <a class="moz-txt-link-rfc2396E" href="https://www.w3schools.in/jsp/implicit-objects"><https://www.w3schools.in/jsp/implicit-objects></a>, if
using the ScriptTagLibs library [1], and all of their methods. <br>
</p>
<p>Therefore you should be able to do something like this:</p>
<blockquote>
<pre><%@ taglib uri=<a class="moz-txt-link-rfc2396E" href="http://rexxla.org/taglibs/jsr223">"http://rexxla.org/taglibs/jsr223"</a> prefix="s" %>
<!DOCTYPE html>
<html>
<head>
<style>
body { background-color: ivory; }
</style>
<title>40_helloworld_use_request.jsp: Sample Application JSP Page Using JavaScript Via JSR-223 (Title)</title>
</head>
<body>
<s:script type="javascript">
out.println("<h1>Hello, world (JSP with Nashorn/JavaScript)</h1>"); // implicit JSP object 'out'
print("<p>This JSP was executed, because of the following URL:" ,
"<ul><li>URL <em>request.getRequestURL()</em>: <br><code>" , // implicit JSP object 'request'
request.getRequestURL(), "</code>");
print("<li>its URI being <em>request.getRequestURI()</em>: <br><code>" , // implicit JSP object 'request'
request.getRequestURI(), "</code></ul></p>");
</s:script>
</body>
</html>
</pre>
</blockquote>
<p>HTH</p>
<p>---rony</p>
<p>[1]:
<a class="moz-txt-link-rfc2396E" href="https://sourceforge.net/projects/bsf4oorexx/files/Sandbox/rgf/taglibs/ga/"><https://sourceforge.net/projects/bsf4oorexx/files/Sandbox/rgf/taglibs/ga/></a><br>
</p>
</body>
</html>