java - Using JavaScript to send String to Servlet, and Results from servlet back to JavaScript -
first of all: sorry bad grammer. english isn't native language, try exlpain problem simple can.
i'm working on web-application, user can enter link. (question 1) link should send server/servlet , progressed other things. (question 2) after progression, servlet send json-array (?) javascript-part of app.
i'm completly new kind of stuff, important me, find out how works or better, how can make work. simple, used plenty of weeks , cant figure out.
the application using sap ui5-libs (question 3), know, if there possible way, parse json ui5 libs.
i hope, explain problem enough, can help. all!
the 'sending' of string server/servlet happen via ajax in either post or form. you.
i recommend use javascript plugin jquery (jquery ajax api) because regular ajax code bit messy.
as servlet/server communicating client simple writing page. in typical servlet context like
out.print("this message");
where ajax automatically returns content of entire page upon callback.
so in conclusion: consider test.jsp servlet. wish send "hi" client (being browser) via servlet , want servlet "hello" back.
i open ajax request of type url "test.jsp?param=hi". in servlet receive page request , process it. servlet discards parameter because not used , outputs "hello" page.
in client ajax have returned "hello" , can use put var or whatever , of happened while not refreshing , not navigating in original document did javascript.
another way using websockets use sockets in javascript send , receive kind of data.
also please check out possible duplicate question: how send string servlet javascript using xmlhttprequest
Comments
Post a Comment