Please don`t send the same question more then once.......it creates different threads with the same topic
On Fri, Nov 28, 2008 at 9:43 AM, varu <[EMAIL PROTECTED]> wrote: > > hi > good morning to all anybody can help me out in this problem .... > here i am trying to send login username and password from our flex > to jsp to conform whether username and password are correct or not > *************login.mxml***************************** > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" applicationComplete="employees.send()"> > <mx:Script> > <![CDATA[ > import mx.events.ValidationResultEvent; > import mx.controls.Alert; > private function validateEmpName():void{ > if (empNameValidator.validate().type == ValidationResultEvent.VALID) > { > submitForm(); > } > > else > { > Alert.show("Username can not be blank"); > > } > } > > private function submitForm():void > { > employees.cancel(); > employees.send(employeeModel); > } > > private function onResult(event:Event):void > { > return; > } > > ]]> > </mx:Script> > <mx:Model id="employeeModel"> > <root> > <username>{username.text}</username> > <pwd>{pwd.text}</pwd> > <conform>{}</conform> > </root> > </mx:Model> > <mx:HTTPService id="employees" useProxy="false" method="POST" > url="employee.jsp"/> > <mx:DataGrid dataProvider="{employees.lastResult.people.person}" > width="50%" x="181" y="41"> > <mx:columns> > <mx:DataGridColumn dataField="username" headerText="User Name" /> > <mx:DataGridColumn dataField="pwd" headerText="Password"/> > <mx:DataGridColumn dataField="conform" headerText="Conformation"/> > </mx:columns> > </mx:DataGrid> > <!-- The Application class states property defines the view > states.--> > <mx:states> > <mx:State name="Register"> > <!-- Add a TextInput control to the form. --> > <mx:AddChild relativeTo="{loginForm}" > position="lastChild" > creationPolicy="all"> > <mx:FormItem id="confirm" label="Confirm:"> > <mx:TextInput id="cpwd"/> > </mx:FormItem> > </mx:AddChild> > <!-- Set properties on the Panel container and Button > control.--> > <mx:SetProperty target="{loginPanel}" > name="title" value="Register"/> > <mx:SetProperty target="{loginButton}" > name="label" value="Register"/> > <!-- Remove the existing LinkButton control.-- > > <mx:RemoveChild target="{registerLink}"/> > <!-- Add a new LinkButton control to change view state > back to the login form.--> > <mx:AddChild relativeTo="{spacer1}" position="before"> > <mx:LinkButton label="Return to Login" > click="currentState=''"/> > </mx:AddChild> > </mx:State> > > </mx:states> > <mx:StringValidator id="empNameValidator" source="{username}" > property="text" triggerEvent=""/> > <mx:Panel id="loginPanel" > title="Login" > horizontalScrollPolicy="off" > verticalScrollPolicy="off" x="181" y="182"> > <mx:Form id="loginForm"> > <mx:FormItem label="Username:" required="true"> > <mx:TextInput id="username"/> > </mx:FormItem> > <mx:FormItem label="Password:" required="true"> > <mx:TextInput id="pwd"/> > </mx:FormItem> > </mx:Form> > <mx:ControlBar> > <!-- Use the LinkButton to change to the Register view > state.--> > <mx:LinkButton id="registerLink" > label="Need to Register?" > click="currentState='Register'"/> > <mx:Spacer width="100%" id="spacer1"/> > <mx:Button label="Login" id="loginButton" > click="validateEmpName()"/> > </mx:ControlBar> > </mx:Panel> > </mx:Application> > > ******************************login.jsp************************************** > <[EMAIL PROTECTED] contentType="text/html"%> > <[EMAIL PROTECTED] pageEncoding="UTF-8"%> > <%-- > The taglib directive below imports the JSTL library. If you uncomment > it, > you must also add the JSTL library to the project. The Add Library... > action > on Libraries node in Projects view can be used to add the JSTL 1.1 > library. > --%> > <%-- > <[EMAIL PROTECTED] uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> > --%> > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <% > String username="username"; > String password="password"; > String uname=request.getParameter("uname"); > String pwd=request.getParameter("pwd"); > String employees="<?xml version=\'1.0\'encoding=\'UTF-8\'? > ><people><person><username>vardhan</username><conform>ok</conform></ > > person></people>"; > if(uname.equals(username)) > { > out.println(employees+"<people><person><username>"+(uname)+"</ > username><pwd>Conform</pwd></person></people>"); > } > else{ > out.println(employees"<people><person><username>"+(uname)+"</ > username><pwd>Rejected</pwd></person></people>"); > } > > %> > and one more i dont want to display the result in a data grid and i > want to diplay in a panal > > advanced appreciations > > thanks > > varu > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

