I'm new to Java Web Services and I'm trying to write a method in my JSP page that would edit a database entry based on an id
that is provided by clicking a button. However, I seem to be unable to use the method argument for the id
as the JAX-WS code does not recognize the variable (I get the "cannot find symbol" error message in NetBeans). How do I access the id
in the JAX-WS code?
Any help would be much appreciated!
Thank you in advance
Method call:
<button onclick=\"editWS(" + id +")\">Edit</button>
EditWS(id) call/JAX-WS code in the JSP:
function editWS(id) {
<%-- start web service invocation --%>
<%
try {
proj.beans.service_client.MessageWS_Service service = new
proj.beans.service_client.MessageWS_Service();
proj.beans.service_client.MessageWS port = service.getMessageWSPort();
// TODO initialize WS operation arguments here
proj.beans.service_client.Message entity = port.find(id); //Error: cannot find symbol 'id'
port.edit(entity);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>
<%-- end web service invocation --%>
}