Thanks a lot Abdul! Its working ...



On 7/6/05, Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> Hari,
> 
> As Sree said, in Flex we think application in terms of Views. In your
> case, user can submit the data and see the result in the same place.
> 
> You can send the data using HTTPSerivce, servlet processes the data and
> returns the result in form of xml/name-value pairs etc. You can show
> that data in same place...
> 
> HTTPService won't go to next page, instead it waits for server-side
> script to return data.
> 
> 
> But answering your query, even though its not best practice in flex :)
> 
> Look at the modified code below:
> 
> ##Registration.jsp##
> 
> <?xml version="1.0" encoding="utf-8"?>
> <%@ taglib uri="FlexTagLib" prefix="mm" %>
> <mm:mxml>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
> height="600">
> <mx:Script>
>        <![CDATA[
>                function sendData()
>                {
>                        var form_lv:LoadVars = new LoadVars();
>                        form_lv.firstName = firstName.text;
>                        form_lv.lastName = lastName.text;
>                        form_lv.phone = phone.text;
>                        form_lv.email = email.text;
>                        form_lv.send("login.do", "_self", "POST");
>                }
>        ]]>
> </mx:Script>
> <mx:Form>
>        <mx:FormItem label="First Name" required="true" >
>            <mx:TextInput id="firstName" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem label="Last Name" required="true" >
>            <mx:TextInput id="lastName" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem label="Phone" required="true" >
>            <mx:TextInput id="phone" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem label="Email" required="true" >
>            <mx:TextInput id="email" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem>
>            <mx:Button label="Register" click="sendData()"/>
>        </mx:FormItem>
>    </mx:Form>
>   </mx:Application>
>  </mm:mxml>
> 
> 
> -abdul
> 
> -----Original Message-----
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
> Behalf Of Harinath
> Sent: Wednesday, July 06, 2005 6:00 PM
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Redirect to next page
> 
> Hi Sree,
> 
> Thanks a lot for the information. I am trying to use Flex for the
> first time and I really dont understand the usage of Flex. I started
> running the examples given by Macromedia in my Tomcat 5.0. Please run
> through the code of the examples that I have used. Let me know where I
> went wrong. Thanks in advance.
> 
> Registration.jsp:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <%@ taglib uri="FlexTagLib" prefix="mm" %>
> <mm:mxml>
> <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
> height="600">
> <mx:HTTPService id="registrationRequest" url="login.do"
>                resultFormat="text" method="POST"
>                result="methOne();">
>      <mx:request>
>            <firstName>{firstName.text}</firstName>
>            <lastName>{lastName.text}</lastName>
>            <phone>{phone.text}</phone>
>            <email>{email.text}</email>
>     </mx:request>
>  </mx:HTTPService>
>  <mx:Form>
>        <mx:FormItem label="First Name" required="true" >
>            <mx:TextInput id="firstName" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem label="Last Name" required="true" >
>            <mx:TextInput id="lastName" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem label="Phone" required="true" >
>            <mx:TextInput id="phone" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem label="Email" required="true" >
>            <mx:TextInput id="email" width="200"/>
>        </mx:FormItem>
>        <mx:FormItem>
>            <mx:Button label="Register"
> click="registrationRequest.send()"/>
>        </mx:FormItem>
>    </mx:Form>
>   </mx:Application>
>  </mm:mxml>
> 
> Action Mapping [Struts-Config.xml]
> 
> <action   path="/login"
>           type="flex.FlexAction"
>           name="registration"
>           input="/registration.jsp">
>          <forward   name="success" path="/confirm.jsp"
> redirect="true"/>
> </action>
> 
> Action Class
> 
> package flex;
> 
> import org.apache.struts.action.Action;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionForward;
> import org.apache.struts.action.ActionMapping;
> import java.io.IOException;
> import javax.servlet.RequestDispatcher;
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> 
> public class FlexAction extends Action {
>    public ActionForward execute(ActionMapping mapping, ActionForm form,
>        HttpServletRequest request, HttpServletResponse response)
>        throws IOException, ServletException {
>        ActionForward actionForward = null;
>                FlexForm flexForm=(FlexForm)form;
> 
>        System.out.println(" First Name :::"
> +request.getParameter("firstName"));
>        System.out.println(" Last Name :::" +
> request.getParameter("lastName"));
>        System.out.println(" Phone       :::" +
> request.getParameter("phone"));
>        System.out.println(" E-Mail :::" +
> request.getParameter("email"));
> 
> 
>        request.getSession().setAttribute("registration",form);
> 
>        return mapping.findForward("success");
>        }
> 
> 
> }
> 
> Confirm.jsp:
> 
> <%@ page import="java.util.Enumeration"%>
> <%@ taglib uri="/tags/struts-bean" prefix="bean" %>
> Thank you for registering:<br>
> <bean:write name="registration" property="firstName"/><br>
> <bean:write name="registration" property="lastName"/><br>
> <bean:write name="registration" property="phone"/><br>
> <bean:write name="registration" property="email"/h>
> 
> 
> On 7/5/05, Sreejith Unnikrishnan <[EMAIL PROTECTED]> wrote:
> > Hari,
> > This would be very minimal information for anybody to comment!
> > Are u developing the entire application in Flex?
> > Or a few UI components embedded in JSP?
> >
> > If it is the second case, there you might have to provide some more
> details,
> > but if it is the first, you should then understand that there is
> really no
> > concept such as "next page" in flex.
> >
> > The alert is a flex popup that displays the result of ur struts
> action, but
> > the forward does not work as in JSP. You should use that data and map
> it to
> > a flex component to see the results.
> >
> > Regards
> > Sree
> >
> > Harinath wrote:
> > Hi Guys
> > I am trying to develop simple application using flex using sturts
> > framework.But i am unable to forward to result page that is specified
> > in action mappings.
> > If i am using result="alert(----)" the result is displayed in popup
> > box. But why ?
> > it is not forward to next page..
> > Please help me
> > Thanks a lot..
> > Regards
> > Harinath K
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> >
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
> > http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> > http://www.mail-archive.com/flexcoders%40yahoogroups.com
> >
> >
> > ________________________________
> > YAHOO! GROUPS LINKS
> >
> >  Visit your group "flexcoders" on the web.
> >
> >  To unsubscribe from this group, send an email to:
> >  [EMAIL PROTECTED]
> >
> >  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
> > ________________________________
> >
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
> Yahoo! Groups Links
> 
> 
> 
> 
> 
> 
>


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
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