这里是一个flex整合struts的一个基本的例子
1. testFlex10.mxml
layout="absolute"
backgroundColor="#FFFFFF"
backgroundAlpha="0" horizontalCenter="true" >
{userId.text}
{password.text}
核心代码:
{userId.text}
{password.text}
以及
dataProvider="{info.lastResult.userinfo.user}"
2.struts.config.xml
attribute="testForm"
input="/form/test.jsp"
name="testForm"
path="/test"
scope="request"
type="com.yourcompany.struts.action.TestAction" >
3.Action: TestAction.java
package com.yourcompany.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
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 com.yourcompany.struts.form.TestForm;
public class TestAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
TestForm testForm = (TestForm) form;// TODO Auto-generated method stub
String name = testForm.getUsername();
System.out.println("fadf : " + name);
return (mapping.findForward("success"));
}
}
4. MyJsp.jsp
< import="
java.util.List"%>
<%
response.setContentType("text/xml");
out.println("");
out.println("");
out.println("");
out.println(""+42314+"");
out.println(""+3123+"");
out.println(""+4231+"");
out.println(""+2+"");
out.println(""+4231+"");
out.println("");
out.println("");
%>
阅读(742) | 评论(0) | 转发(0) |