dcsimg
Ajax calling servlet through in spring frame work.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Hemanth_Sumanth
Posted On:   Wednesday, October 11, 2006 12:25 PM

Simple Spring Portlet var portletReq; // Generic AJAX function function asynchGet(updateURL){ alert(updateURL); if (window.XMLHttpRequest) { portletReq = new XMLHttpRequest(); } else if (window.ActiveXObject) { portletReq = new ActiveXObject("Microsoft.XMLHTTP"); } if(portletReq){ portletReq.onreadystatechange = processReqChange; portletReq.open("GET", updateURL, true); portletReq.send(); }else{ alert("Not going inside"); } } // Generic AJAX function // process the response when available function processReqChange() { if (portletReq.readyState == 4) { if (portletReq.status == 200) { // process response displayInvoice(); } } } function selectInvoice() { var funNme = docu   More>>
Simple Spring Portlet

Hi,
I devoloped one small spring portlet where i am using Ajax to dispaly some information upon onBlur(). In my trail i am able to go till the servlet and i am not able to send back the information from the servlet to JSP from where i called. Please help me to solve the problem






			<?xml version="1.0" encoding="UTF-8"?>
			

"http://java.sun.com/dtd/web-app_2_3.dtd">



org.springframework.web.context.ContextLoaderListener



ViewRendererServlet
org.springframework.web.servlet.TomcatViewRendererServlet
1



AjaxController
com.cts.pack.AjaxController



ViewRendererServlet
/WEB-INF/servlet/view



AjaxController
/AjaxController




/spring
/WEB-INF/tld/spring.tld




display.jsp


			<%@ include file="/WEB-INF/jsp/include.jsp"%>
			
<%@ taglib prefix="spring" uri="/spring" %>
<%@ taglib prefix="portlet" uri="/WEB-INF/tld/portlet.tld"%>







Welcome to Sample Spring Portlet :


Note the time you deployed the portlet


">

cellpadding="5">







Name:












Servlet class


			package com.cts.pack;
			

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import com.sun.portal.jspportlet.JspPortlet;

public class AjaxController extends HttpServlet {

public AjaxController() {

}

protected void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {

res.setContentType("text/html");
PrintWriter out = res.getWriter();
String s = req.getParameter("invoice");
System.out.println("Inside Ajax Controller " + s);
if (s == null) {
throw new ServletException("Parameter 'invoice' missing.");
} else {
String suc = "sucess";

}
}

}


Any help will be greatly appreciated.

Thanks in advance.
hemanth    <<Less
About | Sitemap | Contact