Toogit Social Post

Pratik

8 months ago
Need help on Javascript code:

I have a problem with passing a value from javascript to Java class. Below is the code. Your help is really appreciated.

<script type="text/javascript">
function displayModal(buttonClicked, waitMessage) {
$.ajax({
//url:'xxrsv.oracle.apps.ibe.tcav2.EndCustomer',
data:{value123: document.querySelector('#csu').value},
type:'post',
cache:false,
success:function(){
console.log('success');
otherTransactionSubmit (buttonClicked);
},
error:function(){
console.log('error');
}
}
);
}
</script>
<%@ page import="xxrsv.oracle.apps.ibe.tcav2.EndCustomer" %>

Class:

public class EndCustomer extends HttpServlet{
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String id = request.getParameter("value123");
EndCustomer.setEndCustomer(id);
}

Please let me know if you need additional details.
6 Likes
1 comments, 3 Followers

<%@ page import="xxrsv.oracle.apps.ibe.tcav2.EndCustomer" %>

As far as I can tell this is a server side import declaration
Javascript runs in the client AFTER the page has been rendered.

The only way to interact with your class file is to make a request back to the server - using a URL - the script at the end of the URL will then have to load / import the class you need to process the request.

by Swapnil 8 months ago