FLex Login
Hi,
I am using logout in my flex project.At the time of login i
am creating one token.When i click logout i am deleting the
token.If i relogin with the same username and password old values
are not coming.
Hi,
I am using HTTP Services for login.I am creating one token
for authentication(token is present date).So,Everytime when user
logged in it ll generate a token with present time, an i am storing
that token in cache object.Once user logged in successfully ,if i
click logout button i am deleting the token.Up to this working
fine.If i relogin with the same username and password,I am able to
login successfuly now if i try to update some values ,this time
token is not generatded i.e its not calling login Service in .NET.
In mozilla everything is working fine.I am testing in
IE7.0.Its not working in IE 7
Did u understand my problem.
Similar Messages
-
Flex login issues with http service
I need help.
I have a process that i have written to login. It runs C code
and verifies login and password on a unix server.
[RPC Fault faultString="HTTP request error"
faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent
type="ioError" bubbles=false cancelable=false eventPhase=2
text="Error #2032: Stream Error. URL:
http://genesis.dvrdns.org/flex/cgi-bin/login.cgi"
URL:
http://genesis.dvrdns.org/flex/cgi-bin/login.cgi"
at mx.rpc::AbstractInvoker/
http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.1.0\frameworks\project s\rpc\src\mx\rpc\AbstractInvoker.as:218
at
mx.rpc::Responder/fault()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:53 ]
at
mx.rpc::AsyncRequest/fault()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest .as:103]
at
DirectHTTPMessageResponder/errorHandler()[E:\dev\3.1.0\frameworks\projects\rpc\src\mx\mes saging\channels\DirectHTTPChannel.as:343]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()
i get this error.. when running SNOOP i see
172.16.1.7 -> ult10 HTTP GET /flex/cgi-bin/login.cgi
HTTP/1.1
ult10 -> 172.16.1.7 HTTP R port=52106
ult10 -> 172.16.1.7 HTTP HTTP/1.1 500 Internal Server
Error
172.16.1.7 -> ult10 HTTP C port=52106
my code shows clearly i am calling post.. I am really new to
this stuff and only now am i starting to get a feel, so please make
any info in as simple terms as you can..
returned code will look like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <login>
<login_msg>Please Wait</login_msg> <<
simple message while data updates.
<login_valid>1</login_valid> << if the
login was good or not...
<login_data>153512</login_data> << this is
a file name reference for holding data.. needs to be public.
</login>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
private function handleLogin(event:ResultEvent):void {
]]>
</mx:Script>
<mx:HTTPService id="getlogin" url="
http://somedomain/flex/cgi-bin/login.cgi"
method="POST" resultFormat="xml"
result="handleLogin(event)" />
<mx:ViewStack x="145.5" y="36" id="viewstack1"
width="339" height="306">
<mx:Canvas id="login_data" width="100%" height="100%">
<mx:Panel width="284" height="276" layout="absolute"
title=" Genesis"
horizontalAlign="center" verticalAlign="middle"
horizontalCenter="0" verticalCenter="-5">
<mx:Text x="42" y="23" text="Login:" height="18"/>
<mx:TextInput id="login" x="90" y="21"/>
<mx:Text x="20" y="49" text="Password:" width="62"/>
<mx:TextInput id="passwd" displayAsPassword="true" x="90"
y="47" />
<mx:Text x="29" y="75" text="Domain:"/>
<mx:TextInput x="90" y="73"/>
<mx:Button x="90" y="112" label="Button"
click="getlogin.send()"/>
</mx:Panel>
</mx:Canvas>
</mx:ViewStack>
</mx:Application>i have..
I will keep trying this stuff isn't cheap :)
I have tried about everything.. and can come up with zero..
This is why i have basically posted everything... even the
url of the data is shown...
What i really don't understand is why.. no matter what you do
the request_method always shows GET..
This is the current C source code...
It will just print out the env that the apache server is
getting..
#include <stdio.h>
int main(void)
printf("Content-type: text/plain\n\n");
char **envp;
/* print key=value pairs */
while (*envp != NULL) {
printf("%s\n", *envp++);
To view the data.. make a httpservice and set your debug to
stop once it catches the data...
Right now i have:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var loginData:ArrayCollection;
private function handleLogin(event:ResultEvent):void {
]]>
</mx:Script>
<mx:HTTPService id="getlogin" url="
http://genesis.dvrdns.org/flex/cgi-bin/login.cgi"
result="handleLogin(event)" resultFormat="text"
showBusyCursor="true" method="GET" />
<mx:ViewStack x="145.5" y="36" id="viewstack1"
width="339" height="306">
<mx:Canvas id="login_data" width="100%" height="100%">
<mx:Panel width="284" height="276" layout="absolute"
title=" Genesis"
horizontalAlign="center" verticalAlign="middle"
horizontalCenter="0" verticalCenter="-5">
<mx:Form width="272" height="259" x="-8" y="0">
<mx:Text x="42" y="23" text="Login:" height="18"/>
<mx:TextInput id="login"/>
<mx:Text x="20" y="49" text="Password:" width="62"/>
<mx:TextInput id="passwd" displayAsPassword="true" x="90"
y="47" />
<mx:Text x="29" y="75" text="Domain:"/>
<mx:TextInput x="90" y="73"/>
<mx:Button x="90" y="112" label="Button"
click="getlogin.send()"/>
</mx:Form>
</mx:Panel>
</mx:Canvas>
</mx:ViewStack>
</mx:Application>
my breakpoint is set to line 13 of this code...
at the end of this function:
private function handleLogin(event:ResultEvent):void {
I use the debugger to look at the results...
when you run this.. aginst that C code.. the debugger will
show the environment of what has been called:
GATEWAY_INTERFACE=CGI/1.1
SERVER_PROTOCOL=HTTP/1.1
REQUEST_METHOD=GET
QUERY_STRING=
REQUEST_URI=/flex/cgi-bin/login.cgi
SCRIPT_NAME=/flex/cgi-bin/login.cgi
Notice the REQUEST_METOD is get...
If it is a get method the QUERY string should have some data
in it...
If you go to
http://genesis.dvrdns.org/flex/index.html
and type some junk on that screen you see different output...
GATEWAY_INTERFACE=CGI/1.1
SERVER_PROTOCOL=HTTP/1.1
REQUEST_METHOD=GET
QUERY_STRING=login=dfgsdgf&password=sdfgd&domain=asdf
REQUEST_URI=/flex/cgi-bin/login.cgi?login=dfgsdgf&password=sdfgd&domain=asdf
SCRIPT_NAME=/flex/cgi-bin/login.cgi
notice the query string.. and the REQUEST_METHOD
now if i change the HTML
to POST my "C" source code has to read from standard input...
and my Method should change to post...
but in this case.. since i am just printing the env values..
the POST in my html will have CGI print..
MET=post and QUERY_STRING will be empty..
Exmaple:
Here going to change
<form action="cgi-bin/login.cgi" method="GET">
Login: <input type="login" name="login"
size="10"><br>
Password: <input type="password" name="password"
size="10"><br>
GET to POST
<form action="cgi-bin/login.cgi" method="POST">
Login: <input type="login" name="login"
size="10"><br>
Password: <input type="password" name="password"
size="10"><br>
"index.html" 51 lines, 2700 characters
I am going to run the SAME app in debugger and via the html..
the html code will display the method as post and
query_string as empty which means data should come from standard
input..
html is as i expect:
SERVER_PROTOCOL=HTTP/1.1
REQUEST_METHOD=POST
QUERY_STRING=
REQUEST_URI=/flex/cgi-bin/login.cgi
SCRIPT_NAME=/flex/cgi-bin/login.cgi
Now going to set up debugger to run.. The REQUEST_METOD
should show POST and query string should be zero
REQUEST_METHOD=GET
QUERY_STRING=
REQUEST_URI=/flex/cgi-bin/login.cgi
SCRIPT_NAME=/flex/cgi-bin/login.cgi
as you see the METHOD from the debugger has not CHANGED
my network sniffer even shows my computer sending a request
of GET and not POST.. which is fine.. i can work with get...
but just the same.. the software isn't posting the data
correctly... if at all...
In my origional source code i use the get method in several
ways.....
printf(" <a
href="url://cgi.script?value&value&value">linkdata</a>
", value, value, value);
the cgi.script has to be a GET method for it to work in this
way..
but it isn't working.. the url request sent by this software
isn't sending it right for some reason...
I am really stuck until that works.. -
Looking for a Flex module to do Login, Registration, and License management
I'm looking for an open-source or commercial Adobe Flex module to do user Login, Registration, and License management. The back-end can be either on my site (PHP and MySQL) or secure 3'rd party site.
User Interface would have the following:
Register (new user)
Log-in (registered user)
Purchase a new license (logged-in user)
Apply the license to enable Flex app features (logged-in user)
Any suggestions are appreciated,
OutputLogicI've seen Flex login components out there, but I'm pretty sure you'd end up customizing the heck out of them to work with your app and back-end server. It may be faster to look at some examples and roll your own to suit.
"purchasing a license" ... Take a look at PayPal's site for instructions on how to use their payment gateway in your app. It is pretty straightforward.
"enable Flex app features"... I would store the license information on the server, along with the user's account information. Then when they load the Flex app, a simple license check (during login) could enable certain protected views within the app. -
Best way to handle login screen, transition to app
I've got a working app in flex (I'm an "advanced beginner")...and now want to add a login screen ahead of the app. My question is what is the best way to do so? My options I see are:
1. Login via HTTP screen: The is quick (no app load time), but not as pretty and harder to send parameters to the flex app.
2. Flex login screen using viewstates/stack: I could create a login page and upon successful authorization, I could switch the currentstate (view) or use a viewstack to show the application. This doesn't feel right - having the entire app in a viewstack or view state seems wrong somehow...
3. Flex login app which launches my main flex app: I have no idea if this is possible, but feel right. Quick load time to login, and no need to keep login app/screen in memory during main app execution.
Can someone share a "best practice" ?? ThanksI'm not sure if it is best practice, but we are doing it as you described in #2. Our app isn't all that huge ( about 700k) and we decided we'd rather have the wait time while the app loads prior to login, rather than have them wait a long time after they submit their login. It is also nice for us to keep it all in one Flex project. Just thought I'd share what we are doing.
-
IS THIS POSSIBLE IN FLEX.
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.Please note the answer in the flexbbuilder 2 forum:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=582&threadid =1291004&enterthread=y -
How to integrating php with flex
hi
iam new to flex i want to check the username and password from database using php
and i have written that but iam getting this error
[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://localhost/flex/login.php"]. URL: http://localhost/flex/login.php"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:216]
at mx.rpc::Responder/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\Respo nder.as:49]
at mx.rpc::AsyncRequest/fault()[E:\dev\3.0.x\frameworks\projects\rpc\src\mx\rpc\As yncRequest.as:103]
at DirectHTTPMessageResponder/errorHandler()[E:\dev\3.0.x\frameworks\projects\rpc\ src\mx\messaging\channels\DirectHTTPChannel.as:343]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/redirectEvent()
can any one say wt that error iam attaching that code alsoLooking at the error, it seems like you are not able to access the php file on the server.
Could you please try accessing the php from your browser directly and let us know if you are able to access it.
Thanks,
Sudhir -
hi,
my name is sandeep. please help me to solve this issue,
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>
Please give me an example/code if possible
waiting for reply.
your sandeep.
[email protected]Hi kcell,
i dont no you are Mr Mrs.
finally i did here my code goes, my be helpfull to others
dude,
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:HTTPService id="myService" url="
http://localhost:8080/Sample/HelloServlet"
useProxy="false">
<mx:request>
<username>
{user.text}
</username>
<password>
{pwd.text}
</password>
</mx:request>
</mx:HTTPService>
<mx:Script>
<![CDATA[
import mx.messaging.messages.HTTPRequestMessage;
import mx.controls.Alert;
public function submitForm(f:Form):void
myService.cancel();
myService.method = "POST";
// var params:Object = new Object();
// params.uName = user.text;
//params.pWord =pwd.text;
myService.send();
]]>
</mx:Script>
<mx:Panel x="97.5" y="74" width="403" height="372"
layout="absolute">
<mx:Form x="10" y="10" width="363" height="208"
id="form1">
<mx:Grid width="293" height="171">
<mx:GridRow width="100%" height="32">
<mx:GridItem width="84" height="20">
<mx:Label text="User Name" width="73"/>
</mx:GridItem>
<mx:GridItem width="100%" height="22">
<mx:TextInput width="193" id="user"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow width="100%" height="29">
<mx:GridItem width="78" height="100%">
<mx:Label text="Pass word" width="84"/>
</mx:GridItem>
<mx:GridItem width="199" height="100%">
<mx:TextInput width="195" displayAsPassword="true"
editable="true" id="pwd"/>
</mx:GridItem>
</mx:GridRow>
<mx:GridRow width="100%" height="37">
<mx:GridItem width="74" height="100%">
</mx:GridItem>
<mx:GridItem width="199" height="29">
<mx:Button label="Submit" labelPlacement="left"
enabled="true" width="104" click="submitForm(form1)"/>
<mx:Button label="Cancel" labelPlacement="right"
width="84"/>
</mx:GridItem>
</mx:GridRow>
</mx:Grid>
</mx:Form>
</mx:Panel>
</mx:Application>
and in HelloServlet i am just displaying it , thats it ,
thanks for your reply,
with regards
sandeep. -
I'm trying to use J2EE Servlet form based authentication by
posting to the well-known url j_security_check. In my web.xml file
I specify FORM authentication and my custom Flex login page. Upon
accessing a protected resource, I am redirected to my login page as
expected. Upon successful login the server sends an HTTP redirect
back to the protected resource, but I can't figure out how to
capture this redirect. My fault method will get called if I use the
wrong password, however the result method does not get called,
probably because it is a redirect. The server is actually
authenticating the user, because if I access the protected resource
again in the same session it works fine.
How can I get the HTTPService to follow a redirect, or at
least how can I get notification that the call has completed?
I'm using Tomcat in JBoss and the following code demonstrates
the problem, even without configuring web.xml.
Thanks,
Brian
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
defaultButton="{login}"
>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function onResult(event:ResultEvent):void {
// Never reached
trace(event);
private function onFault(event:FaultEvent):void {
// Called after unsuccessful login
trace(event);
]]>
</mx:Script>
<mx:HTTPService id="loginService" url="j_security_check"
method="POST" result="onResult(event)" fault="onFault(event)">
<mx:request>
<j_username>{username.text}</j_username>
<j_password>{password.text}</j_password>
</mx:request>
</mx:HTTPService>
<mx:Panel id="panel" title="Login">
<mx:Form id="form">
<mx:Label id="directions" text="Please Login:"/>
<mx:FormItem label="Username">
<mx:TextInput id="username"/>
</mx:FormItem>
<mx:FormItem label="Password">
<mx:TextInput id="password" displayAsPassword="true"/>
</mx:FormItem>
<mx:FormItem id="passwordConfirmItem" label="Confirm:"
visible="false">
<mx:TextInput id="passwordConfirm"
displayAsPassword="true"/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar>
<mx:Spacer width="100%" id="spacer1"/>
<mx:Button label="Login" id="login"
click="loginService.send();"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>Bump
I am facing the same problem right now, and I can't seem to find a solution. -
fx:Declarations binding problem
Hi.
In Flex 4 I am getting an error "Data binding will not be able to detect assignments to "w_url", when I try to bind a variable in the declarations tag. I also tried with two-way binding @{w_url}, but doesn't work either.
Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
[BINDABLE] private var w_url:String="https://localhost/flex/login.xml";
protected function MyLoginService_resultHandler(error:String):void
Alert.show(error);
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<s:HTTPService id="MyLoginService"
useProxy="false"
url="{w_url}"
result="MyLoginService_resultHandler(MyLoginService.lastResult.error_text)"
/>
</fx:Declarations>
</s:Application>Pretty much everything in ActionScript and MXML is case-sensistive.
Gordon Smith
Adobe Flex SDK Team -
CAN ANY BODY SOLVE THIS.
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.there is already reply to your request in FlexBulder
category(even though not sure what flex builder has to do with it )
anyways, you cant get servlet to run unless you invoke it and you
are definitely not invoking it from flex .look at reply in
flexbuilder category.
it gives good example. -
How to create a login session in flex?
Hi there,
I have a flex application with two states. One is a "login" state which is a screen with username and password. The other state is "loggedIn" state which is a screen with a small application. As soon as the user credentials are checked from the back end, based on it's success, I'm changing the state to "loggedIn", else there is a message to the user about login failure in "login" state itself.
My problem is if I'm in "loggedIn" state and if I hit refresh button of the webpage(F5), it goes back to the login screen i.e., it just restarts the application..
How can I control this? Is there something like login session which can do the trick?
Appreciate your help...
-DeepakFlex code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="getSession.send()">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
public function getSessionStuff(evt:ResultEvent):void
saveInfo.text = evt.result.info;
]]>
</mx:Script>
<mx:HTTPService id="startSession" showBusyCursor="true" method="POST" url="http://localhost/startSession.php">
<mx:request xmlns="">
<stuffToSave>
{saveInfo.text}
</stuffToSave>
</mx:request>
</mx:HTTPService>
<mx:HTTPService id="getSession" result="getSessionStuff(event)" showBusyCursor="true" method="POST" url="http://localhost/getSession.php"/>
<mx:Button x="602" y="323" label="Start Session" enabled="{saveInfo.text != ''}" click="startSession.send()"/>
<mx:TextInput id="saveInfo" x="563" y="293"/>
</mx:Application>
setSession.php code;
<?php
session_start();
$_SESSION['loggedIn'] = $_POST["stuffToSave"];
?>
getSession.php code;
<?php
session_start();
if($_SESSION['loggedIn'])
echo "<info>".$_SESSION['loggedIn']."</info>";
else
echo "<info>nothing has been saved</info>";
?>
ta daa -
Hello,
I found, what seems to be a nice login application for Flex.
However, something is wrong and it is not working. I have check,
and recheck the code over and over again and I can't seem to find
what is wrong. I am using Flex 3.0, PHP and a MySQL database.
Everything appears good with the PHP script, however, the web page
just looks at me and does not change to the page that it should.
There is a message in the browser that it is transfering data from
the database, but it doesn't display. The "Alert" message doesn't
show either if I put in the wrong username and password.
Can someone help me with this?
Thanks,
(See Code Below)Hi,
Please check if the result event is getting fired. Add a
break point in the checkLogin function and debug the result object.
Or just add a else block in the checkLogin function, my guess is
that the if conditions are failing and so you are not seeing any
changes. To be on the safe side, do add a handler for the fault
event of the HTTPService.
Hope this helps. -
Login security in flex with Java
Hi ,
I am looking for login secruity with session in flex.
Thanks,
AlokIf you want to use Java as the back end, you have BlazeDS and
LiveCycle Data services to make your programming simpler. BlazeDS
and LCDS will allow you to invoke the Java classes from the Flex
application. For more details on BlazeDS and LCDS visit the URLs
below.
http://www.adobe.com/products/livecycle/dataservices/
http://opensource.adobe.com/wiki/display/blazeds/BlazeDS
Hope this helps. -
I am new on flex, and i would like to create a simple login + password using amfphp
Hi all,
I try to make a simple login password using mysql and amfphp, i have a little quesiton, i dont' know how to get back my response from php. Thanks in advance if anyone could help me.
Best regards
i would like to tell to the label <mx:Label x="380" y="10" id="lResponse"/> the response from php
I juste want to take back response from php.
Here is my mxml :
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768">
<fx:Script>
<![CDATA[
import mx.controls.dataGridClasses.DataGridColumn;
import flash.net.Responder;
import mx.events.DataGridEvent;
import org.corlan.VOAuthor;
private function checkpassword():void {
var newauthor:VOAuthor=new VOAuthor();
newauthor.lname_aut = nom.text;
newauthor.fname_aut = prenom.text;
myRemote.validate(newauthor);
private function checkInput():void
if(nom.text == "" || prenom.text == "")
lResponse.text = "Veuillez completer tout les champs";
else
lResponse.text = "connecter";
checkpassword();
// checkLogin("login.Verify.validate",[nom.text,prenom.text]);
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
<mx:RemoteObject id="myRemote" destination="MyService" source="MyService"
endpoint="http://localhost/amfphp/gateway.php" showBusyCursor="true"/>
</fx:Declarations>
<s:Panel x="334" y="168" width="245" height="135" title="Identifiez vous" textAlign="center">
<s:TextInput x="102" y="10" textAlign="left" id="nom" />
<s:TextInput x="102" y="40" textAlign="left" id="prenom" />
<s:RichText x="50" y="6" text="Login :" height="22" width="56" textAlign="left" verticalAlign="bottom"/>
<s:RichText x="27" y="46" text="Password :" height="20"/>
<s:Button x="125" y="70" label="Connecter" width="105" click="checkInput()"/>
<mx:Label x="380" y="10" id="lResponse"/>
</s:Panel>
</s:Application>
Here is my php code :
<?php
session_start();
require_once ('./vo/org/corlan/VOAuthor.php');
//conection info
define( "DATABASE_SERVER", "127.0.0.1");
define( "DATABASE_USERNAME", "root");
define( "DATABASE_PASSWORD", "xxxx");
define( "DATABASE_NAME", "flex360");
class MyService {
function validate($author){
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);
mysql_select_db(DATABASE_NAME);
$user = $author[0];
$pass = $author[1];
$query = "SELECT DISTINCT * FROM authors_aut WHERE fname_aut = '$user' AND lname_aut = '$pass'";
$rs = mysql_query($query);
$var = mysql_fetch_assoc($rs);
$u = $var["fname_aut"];
$p = $var["lname_aut"];
if ($pass != $p){
$response[0] = "INVALID";
$response[1] = "Invalid username and/or password";
} else {
$response[0] = "VALID";
$response[1] = "Welcome $u";
return $response;
?>I usually have a resultHandler function, to handle stuff from the server.
resultHandler(event:ResultEvent):void -
Flex/Air Application Login - the best way
Hi,
I have small ideological problem :) I have login form in my
application. So, each user has his own login and password. As
serverside is used LCDS with secured destinations.
And here are two possible approaches:
1) I use server side auth. mechanism (Tomcat realm) to check
users credentials. I have custom auth. class, which check user
credentials. This works, but, i have some problems in logout
operation and if user enter wrong username or password.
2) Second way is this. I have only one user (which is
hardcoded in app or loaded from config). This user is authenticated
to server at the start (setCredentials() ). I need this, because
all destinations are secured. And the "real user" is verified
against the services that will bring the information if that user
is verified or not.
So, i don't know which approach is better. Now, using the
first.
What do You think about this ? Which way is the best ?Hi,
this topic can be deleted (i can't do this, i can edit, but
can't delete this post).
I'm very sorry, i wanted to post my question into Flex Data
Services forum, not here.
So, i entered this question into the Flex Data Services
forum:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=583&threadid =1400436&enterthread=y
Maybe you are looking for
-
Modified CRM application doesn't deployed in PROD server.
Hello SDN! We have DEV and PROD runtime systems for CRM developing. Our custom CRM application successfully deployed to the DEV server many times. But transport to the PROD server hasn't any effect - our application doesn't exists in PROD server. In
-
Issue in SQL-server migration to new domain
Hello, I have a scenario, where i need to migrate SQL 2005 servers db's ( around 30, small ones) to new server in a new domain. Destinationserver is 2012 R2, running SQL2014 Domains have trust between them, and users have already been migrated to new
-
Problem burning to external DVD
I'm trying to burn my iDVD project to an external DVD burner (brand-new Philips model that's supposed to have all the bells and whistles). I went with an external burner since the Pioneer drive that came with my eMac croaked and I couldn't find a goo
-
Can the picture be on the hard cover of the book
Just trying to find out with a hardcover book if the picture for the cover (ie the dustjacket) is also printed on the actual hardcover as well, or is the picture only on the dustjacket?
-
Going to take a Plunge And Get 9700 Pro
As much as it hurts my wallet. I want to get it. Why bother upgrading your system if not going to get one of the best Video cards to go with it. Read a few problems with these. But looks like things are fine now. OH the inhumanity of it all. ;(