dcsimg
Ajax Programming code
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   amit_jain
Posted On:   Tuesday, May 9, 2006 11:13 PM


Hi Please suggest any generated code for Ajax programming.

Re: Ajax Programming code

Posted By:   Anonymous  
Posted On:   Tuesday, May 23, 2006 02:15 AM

Here i am sending the code
1) One is HTML file
2) Other one is servlet file

Deploy in any server, it will be executing. I had did it with WEBLOGIC, jboss. By creating the .war file

------------------------------HTML File---------------------






Enter the user name


Enter the password






-----------------------Servlet File-------------------------

import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.*;

public class ValidateServlet extends HttpServlet
{

private ServletContext context;
private HashMap users = new HashMap();

public void init(ServletConfig config) throws ServletException
{
this.context = config.getServletContext();
users.put("greg","account data");
users.put("duke","account data");
}

public void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException
{

String targetId = request.getParameter("id");

if ((targetId != null) && !users.containsKey(targetId.trim()))
{
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("valid");
}
else
{
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("invalid");
}
}
}

Re: Ajax Programming code

Posted By:   Christopher_Koenigsberg  
Posted On:   Sunday, May 14, 2006 10:34 AM

how about a "select", with specific "option" tags inside it. That's always useful to generate from Ajax, if that's what you're asking.
About | Sitemap | Contact