![]() |
![]() |
||||||
|
|||||||
| Tags: flex, jsp |
![]() |
|
|||
|
Hi All,
am new to Flex.Here is the simple scenario that am not able to make it work, how to get the values from the form(from MXML file) in JSP and validating the form(for manadatory fields) and storing those values in database and getting those details back and diaplaying with the MXML file. Thanks in Advance. |
| Sponsored Links |
|
|||
|
|
|
|||
|
Hi,
Thanks for your help JB2622 . Earlier also i got the same example from the net but in that just they mentioned the file name. Now after deploying that file in the Tomcat server and changing the URL employee.jsp to http://localhost:8080/employee.jsp it is working fine now. |
|
|||
|
sankar83
Maybe we are not talking about the same thing. The jsp page that I'm referring to is included with my Flex application. The following syntax works when I call the jsp page from this Flex application: navigateToURL(new URLRequest("/DataExportExample/jsp/downloadCSV.jsp "), "_blank"); The "DataExportExample" is the context root of the application. I have also called a jsp without the context root: navigateToURL(new URLRequest("jsp/downloadCSV.jsp"), "_blank"); |
|
|||
|
Hi JB2622,
Ok, right now am comfortable with your eariler suggestion and i will try with navigateToURL later since am new to flex and i have one more problem and i think you will solve this problem here is the scenario , am trying to connect to the my-sql database and get the data from the DB in the JSP page ( employee.jsp) and trying to displaying those records through the MXML using the DataGrid as shown in the following code I have deployed that employee.jsp in the Tomcat Server and am able to display those recoeds(http://localhost:8080/employee.jsp in the browser), but the problem is am not able to display those records through the MXML. sample.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="emp.send()"> <!--<mx:Script> <![CDATA[ private function onResult(event:Event):void { return; } ]]> </mx:Script>--> <mx:HTTPService id="emp" method="POST" url="http://localhost:8080/employee.jsp"/> <mx ataGrid dataProvider="{emp.lastResult.employees.employee}" x="100"y="100"> <mx:columns> <mx ataGridColumn dataField="firstname" headerText="First Name"/><mx ataGridColumn dataField="lastname" headerText="Last Name"/><mx ataGridColumn dataField="age" headerText="Age"/><mx ataGridColumn dataField="designation" headerText="Designation"/></mx:columns> </mx ataGrid></mx:Application> employee.jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="java.sql.*" %> <employees> <% try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://loca lhost:3306/sankar","root","san kar"); out.println("Successfully connected to my-sql <br>"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from employee"); while(rs.next()) { %> <employee> <firstname><%= rs.getString(1) %></firstname> <lastname><%= rs.getString(2) %></lastname> <age><%= rs.getString(3) %></age> <designation><%= rs.getString(4) %></designation> </employee> <% } con.close(); } catch(Exception e) { System.out.println("Exception due to:"+e); } %> </employees> |
|
|||
|
You can also use a servlet with your Flex app, though setting the paths up in
your web.xml can be tricky. I just finished doing that for a project. Here's one example of a servlet for a Flex app: http://blog.kevinhoyt.org/2007/12/07...t-file-upload/ If you look further down that linked page, you'll see a link to the source code. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise