Hi,
I think it's only possible to get the "GET" parameters with external javascript.
"getParameterFromUrl" : function(Parameter) {
var url_string = window.location.href;
var url = new URL(url_string);
Parameter = url.searchParams.get(Parameter);
return Parameter;
}
The input "Parameter" of the function "getParameterFromUrl" is the parameter name and the return value ist the parameter value.
If you don't want the user can see the parameter you can remove them after parsing.
"delParameterFromUrl" : function() {
// get full URL
var currURL = window.location.href; // get current
// address
// Get the URL between what's after '/' and befor '?'
// 1- get URL after'/'
var afterDomain = currURL.substring(currURL
.indexOf('/') + 1);
// 2- get the part before '?'
var beforeQueryString = afterDomain.split("?")[0];
window.history.replaceState({}, document.title, "/"
+ beforeQueryString);
}
Kind Regards!
------------------------------
Marcel Dreyer
------------------------------
Original Message:
Sent: Mon March 28, 2022 03:45 AM
From: Marcel Beekman
Subject: How to process a post request on the client side
Hi,
Sorry for the double posts.
I didn't got a confirmation.
Regards,
Marcel
------------------------------
Marcel Beekman
Original Message:
Sent: Fri March 25, 2022 06:51 AM
From: Marcel Beekman
Subject: How to process a post request on the client side
I'm trying to figure out how to process a post request on the client (RichUI) side.
So far I tried to get the post request in the index.jsp file.
Then read the post parameters with java and then set localStorage parameters or cookies with javascript.
May be the index.jsp is the wrong file?
Regards,
Marcel
<%@ page import="java.util.Locale"%><%@ page pageEncoding="UTF-8"%><% Locale locale = request.getLocale(); Enumeration enumeration = request.getParameterNames(); String params = ""; while(enumeration.hasMoreElements()){ String parameterName = enumeration.nextElement(); params += parameterName + "=" + request.getParameter(parameterName) + "&"; }%><script> //window.localStorage.setItem('postParams', '<%=params%>'); document.cookie='postParams=<%=params%>';</script><html> <% if ("fr".contains(locale.getLanguage())) { %> <jsp:forward page="Start-fr_FR.html"> </jsp:forward> <% } else { %> <jsp:forward page="Start-nl_NL.html"> </jsp:forward> <% } %></html>
------------------------------
Marcel Beekman
------------------------------