Hi,

>2) It looks like HTTPService is waiting for the response to come to it
>directly, so doing a forward is useless because the browser does not
>process the returned data.  Does this mean if I want to do something
>like this, then I should pass the forwarding address as the result and
>have mxml application issue a getUrl(url, "_top").  

Yes. But you can think of something where you don't have forward. I
mean, RIA have different UI patterns, where you load different Views in
same place.
So instead of forward, you can load a welcome View in same place, a view
could be custom component, a .swf etc.

But I am sure, you can come up something better that forwards. RIA gurus
around would suggest you many available ways. Look at the available RIA
frameworks like Cairngorm, ARP etc.


-abdul

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of pat_ryan_99
Sent: Friday, June 17, 2005 11:12 PM
To: [email protected]
Subject: [flexcoders] Flex and JSP forwarding

Hello Everyone,

I hate being the newbie to Flex, but I guess at some stage we are all
newbies.  I am hoping someone here can help correct my thought process
on how to use Flex.  BTW:  I have developed many a J2EE application
with  Struts, JSP, Velocity, etc.

What I am trying to do is introduce Flex slowly into our Struts/JSP
application.

I wrote a login page to post to a JSP to validate the login, and in
the JSP I wanted to foward to an html/jsp/mxml page to test the flow.

Here are my very simple files:

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

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
verticalGap="20">

    <mx:HTTPService id="loginSrv" url="login.jsp">
        <mx:request>
            <loginName>{loginName.text}</loginName>
            <password>{password.text}</password>
        </mx:request>
    </mx:HTTPService>

    <mx:HBox>

        <mx:Label text="Welcome"/>
        <mx:Label text="Please login:"/>

        <mx:Form>
         <mx:FormItem label="Login" required="true">
            <mx:TextInput id="loginName" width="200"/>
         </mx:FormItem>

         <mx:FormItem label="Password" required="true">
            <mx:TextInput id="password" width="200"/>
         </mx:FormItem>

         <mx:Button label="Login" click="loginSrv.send();"/>

       </mx:Form>
    </mx:HBox>


</mx:Application>

My test jsp looks like:
<%
    String loginName=request.getParameter("loginName");
    String password=request.getParameter("password");
    System.out.println("LoginName: " + loginName);
    System.out.println("Password: " + password);


%>

<jsp:forward page="/loginservice/welcome.html" />


However when I run this, the login page just sits there.  

some of my questions are:
1) Am I thinking about a Flex application incorrectly in that I viewed
the mxml pages in a similar way as JSP pages?  Each mxml page would
render, potentially interact with the server and get data, BUT
sometimes the server would forward to another page to get rendered. 
Can / should I be able to do this?

2) It looks like HTTPService is waiting for the response to come to it
directly, so doing a forward is useless because the browser does not
process the returned data.  Does this mean if I want to do something
like this, then I should pass the forwarding address as the result and
have mxml application issue a getUrl(url, "_top"). 

3) If I can do what I am thinking of with the forwards, how do I do
that.

Thanks in advance for any help and guidance.  I did just buy the
"Developing Rich Clients with Macromedia Flex" and it arrived today!

Pat




 
Yahoo! Groups Links



 




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to