Add a JSP embedded flex example

Source: Internet
Author: User
Flex is embedded in JSP in the form of jstl. The first sentence in the JSP file is

<% @ Taglib uri = "flextaglib" prefix = "mm" %>


Below is the running

Source code test. jsp

The input and output characters in JSP are encoded. I use tomcat5.5, which may vary with other servers!

<% @ Taglib uri = "flextaglib" prefix = "mm" %>

<% @ Page contenttype = "text/html; charset = UTF-8" %>

<HTML>

<%

String data = (string) Session. getattribute ("data ");

String name = new string (request. getparameter ("name"). getbytes ("8859_1"), "UTF-8 ");

String email = new string (request. getparameter ("email"). getbytes ("8859_1"), "UTF-8 ");


Data = Data + "<mydata name = '" + name + "'email ='" + email + "'/> ";

// System. Out. println (data );

Session. setattribute ("data", data );

%>

This is HTML powered by JSP <br>

<Mm: mxml>

<Mx: Application width = "300" Height = "200" xmlns: MX = "http://www.macromedia.com/2003/mxml">


<Mx: Model id = "mymodel">

<% = Session. getattribute ("data") %>

</MX: Model>


<Mx: DataGrid width = "100%" Height = "100%" dataprovider = "{mymodel. mydata}"/>


</MX: Application>


</MM: mxml>

<Form action = "" method = "Post">

Name: <input name = "name"> <br>

Email: <input name = "email"> <br>

<Input type = "Submit" value = "add">

</Form>

</Html>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.