Expand my Community achievements bar.

IS THIS POSSIBLE IN FLEX.

Avatar

Level 1
Hi ,



TILL NOW ANY BODY HAS RUN APPLICATION ( calling flex
application in url) WHICH INVOKES A SERVLET PERFORMS
REQUEST/RESPONCE . IF YES PLEASE SOLVE MY CODE.



ELSE

PLEASE HELP ME WITH A SAMPLE CODE/Example.



currently i have a login.jsp in which i am calling
source="./login.mxml"

code for login.jsp

/**********************************/

<%@ taglib uri="FlexTagLib" prefix="mm" %>

<html>

<head>

<title>This is calling HelloServlet</title>

</head>

<body>

<form action=./HelloServlet method=POST>

<mm:mxml source="./Login.mxml">



</mm:mxml>

</form>

</body>

</html>

/*********************************/



and code in login.mxml

/*****************************************************/

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

<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" >

<mx:Panel width="382" height="315" layout="absolute"
horizontalCenter="4" verticalCenter="2.5" fontFamily="Verdana"
title="eCTDViewer-Login">



<mx:Label x="25" y="49" text="UserName "/>

<mx:TextInput x="115" y="47"/>

<mx:Text x="25" y="98" text="Password"/>

<mx:TextInput x="115" y="96" displayAsPassword="true"/>

<mx:Button label="Login" horizontalCenter="-80"
verticalCenter="42.5" textRollOverColor="#408080" />

<mx:Button x="186" y="169" label="Cancel"
textRollOverColor="#408080"/>

<mx:Label x="10" y="-26" text="eCTDViewer-Login"
width="310" height="23" enabled="true"/>

</mx:Panel>



</mx:Application>

/**************************************************************/



and in now i am calling login.jsp in IE 7.0 as url=
http://localhost:8080/flex/login.jsp



it is displaying login page exactly what i want, but after
entering username,password when i click submit button it should go
to HelloServlet, there in servlet i am just printing a message,

but it is not going to HelloServlet, Please guide me how to
do this. and what need s to be configured in web.xml,



/**********************HelloServlet**************/



import java.io.*;

import javax.servlet.*;

import javax.servlet.http.HttpServlet;



public class HelloServlet extends GenericServlet {



public void service(ServletRequest req, ServletResponse res)
throws ServletException, IOException

{

res.setContentType("text/html");

PrintWriter pw=res.getWriter();

System.out.println("I can into HelloServlet");

pw.println("<B>Hello!");

pw.println("<B>Hi!");

pw.close();

}



}



}

/**********************************************/

/***********************web.xml**************/



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

<web-app id="WebApp_ID" version="2.4" xmlns="
http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/j2ee

http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<servlet>

<servlet-name>login</servlet-name>

<servlet-class>HelloServlet</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>login</servlet-name>

<url-pattern>/login</url-pattern>

</servlet-mapping>

</web-app>

/******************************************/

waiting for reply.


1 Reply