Forums Register Login

How to call servlet parsing to phonegap

+Pie Number of slices to send: Send
Hi

Normally i created one servlet page now how can i get the result in phone gap please suggest me
+Pie Number of slices to send: Send
I've read this several times, but it's not clear to me what you're asking (e.g., what a "servlet page" is, or what you mean by "servlet parsing"). Can you rephrase the question while also providing more details about the problem?
+Pie Number of slices to send: Send
$.ajax({
type : 'POST',
url : 'http://10.0.2.2:7070/server/Jdbc', // Servlet URL
data:{
uname:uname,
pwd:pwd,
},
success : function(data) {
if("SUCCESS"==data){
alert("Login Success!!");
} else {
alert("Invalid Login!!");
}
},
+Pie Number of slices to send: Send
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
String location = request.getParameter("textLocation");
String keyword = request.getParameter("textKeyword");

String typeofurl = request.getParameter("typeofurl");


if(typeofurl.equalsIgnoreCase("careerbuilder")){
System.out.println("career builder");
URL url = new URL("http://api.careerbuilder.com/v1/jobsearch?DeveloperKey=WDH36716NGKGL3VVCDN8&keyword="+keyword+"&PerPage=10&Location="+location);
InputStream i = url.openStream();
DataInputStream d = new DataInputStream(new BufferedInputStream(i));
String s =null;
boolean flag = true;
while((s = dis.readLine())!= null){
if(flag){
pw.println("<table width=300 border=0>");
flag = false;
}
if(s.contains("<Company>")){
pw.println("<tr><td><h2><br/>"+getXMLValueFromTag(s)+"</h2></td></tr>");
}else if(s.contains("<EmploymentType>")){
pw.println("<tr><td>"+getXMLValueFromTag(s)+"</br>");
}else if(s.contains("<Location>")){
pw.println(getXMLValueFromTag(s)+"</br>");
}else if(s.contains("<JobTitle>")){
pw.println(getXMLValueFromTag(s)+"</br></td></tr>");
}
}
pw.println("</table>");
is.close();
+Pie Number of slices to send: Send
I posted servlet and phone gap codes how i will get result in phonegap what type code i can add please help me


Thanks
+Pie Number of slices to send: Send
I'm not sure how PhoneGap figures into it -it looks like jQuery code to me-, but that's maybe not important. You didn't say what happens when you run this code, and how the expected behavior deviates from the actual behavior, but at first glance I notice that a) the jQuery code does a POST, whereas the servlet handles a GET, and 2) the jQuery form submission is missing several parameters the servlet expects.
bacon. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1252 times.
Similar Threads
Randomly generate a string of number?
Servlets And Jsp
Servlet using SAAJ and HTTP Authorization Header
deploying a servlet
using javascripts in servlet?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:03:46.