• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to call servlet parsing to phonegap  RSS feed

 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Normally i created one servlet page now how can i get the result in phone gap please suggest me
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
$.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!!");
}
},
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
 
revathi kurum
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I posted servlet and phone gap codes how i will get result in phonegap what type code i can add please help me


Thanks
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!