Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Struts service facade

    10 answers - 557 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Im new in Struts, in fact im pretty new in Java, but i have programmed for
    Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server with
    Struts on it using Flex. Flex is able to call a java component on the server
    and execute a method and then serialize the result and deserialize it in an
    Actionscript(scripting language of flex) object. In my imaginary app Flex
    will provide the View, so im trying to find a way to enable Struts to serve
    just a result without a JSP or HTML page, i just want the result. god
    this is confusing
  • No.1 | | 1461 bytes | |

    What do you mean by "just the result?" If your Flex app is calling Struts,
    then it needs some kind of data back. Are you saying that you want the
    result to be ActionScript, kind of like a JSN result? XML?

    In the general case, if a Struts action writes data to the Servlet response,
    then it should return null. But often, an easier way to do something like a
    simple XML or JSN result is to use a JSP with a content type other than
    text/html. Automatic serialization of a PJ to JSN or XML is probably
    more elegant, but for a quick solution, you can render that stuff in a JSP
    -- in any case, better than writing directly to the output stream, which I'd
    generally only want to do with downloads or other binary data.

    I don't know if this helps at all

    Joe

    1/23/07, einundswanzig <einundswanzig (AT) yahoo (DOT) com.hkwrote:
    --
    Im new in Struts, in fact im pretty new in Java, but i have programmed for
    Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server with
    Struts on it using Flex. Flex is able to call a java component on the
    server
    and execute a method and then serialize the result and deserialize it in
    an
    Actionscript(scripting language of flex) object. In my imaginary app Flex
    will provide the View, so im trying to find a way to enable Struts to
    serve
    just a result without a JSP or HTML page, i just want the result. god
    this is confusing
  • No.2 | | 2460 bytes | |

    I have never used Flex, but it seems like it plays nicely with JSN:

    You can use the JSN plugin to serialize your actions into JSN. If you
    post this question on the user list, you'll probably get more answers

    regards
    musachy

    Joe Germuska wrote:
    What do you mean by "just the result?" If your Flex app is calling
    Struts,
    then it needs some kind of data back. Are you saying that you want the
    result to be ActionScript, kind of like a JSN result? XML?

    In the general case, if a Struts action writes data to the Servlet
    response,
    then it should return null. But often, an easier way to do something
    like a
    simple XML or JSN result is to use a JSP with a content type other than
    text/html. Automatic serialization of a PJ to JSN or XML is probably
    more elegant, but for a quick solution, you can render that stuff in a
    JSP
    -- in any case, better than writing directly to the output stream,
    which I'd
    generally only want to do with downloads or other binary data.

    I don't know if this helps at all

    Joe
    --
    1/23/07, einundswanzig <einundswanzig (AT) yahoo (DOT) com.hkwrote:
    >>
    >>

    >Im new in Struts, in fact im pretty new in Java, but i have
    >programmed for
    >Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server with
    >Struts on it using Flex. Flex is able to call a java component on the
    >server
    >and execute a method and then serialize the result and deserialize it in
    >an
    >Actionscript(scripting language of flex) object. In my imaginary app
    >Flex
    >will provide the View, so im trying to find a way to enable Struts to
    >serve
    >just a result without a JSP or HTML page, i just want the result. god
    >this is confusing
    >--
    >View this message in context:
    >#a8553935
    >Sent from the Struts - Dev mailing list archive at Nabble.com.
    >>
    >>

    >
    >To unsubscribe, e-mail: dev-unsubscribe (AT) struts (DOT) apache.org
    >For additional commands, e-mail: dev-help (AT) struts (DOT) apache.org
    >>
    >>

    >
    >


    To unsubscribe, e-mail: dev-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: dev-help (AT) struts (DOT) apache.org
  • No.3 | | 700 bytes | |

    1/23/07, Musachy Barroso <mbarroso (AT) wfscorp (DOT) comwrote:

    I have never used Flex, but it seems like it plays nicely with JSN:

    It does, and you don't need a plugin. If you just want to get data back from
    the server, you can send JSN and use ActionScript's 'eval' function to turn
    that into a data structure, just like you would in JavaScript.

    For rendering beans or other Java object into JSN, you might want to take a
    look at some code that Don wrote that's sitting in the Struts sandbox. See:

    I wrote a more generalised and extensible JSN renderer at my day job, but
    I'd need to get permission before I could post that.
  • No.4 | | 1194 bytes | |

    Well, you can use the plugin to "send the data back", using a "json"
    result, instead of writing to the Stream directly, like Joe
    mentioned. The plugin has a helper class to write to an stream, or build
    an string from an object also. I recently added an interceptor, to
    populate an action from a request containing a JSN string.

    regards
    musachy

    Martin Cooper wrote:
    1/23/07, Musachy Barroso <mbarroso (AT) wfscorp (DOT) comwrote:
    >>

    >I have never used Flex, but it seems like it plays nicely with JSN:
    >
    >

    It does, and you don't need a plugin. If you just want to get data
    back from
    the server, you can send JSN and use ActionScript's 'eval' function
    to turn
    that into a data structure, just like you would in JavaScript.

    For rendering beans or other Java object into JSN, you might want to
    take a
    look at some code that Don wrote that's sitting in the Struts sandbox.
    See:

    --
    I wrote a more generalised and extensible JSN renderer at my day job,
    but
    I'd need to get permission before I could post that.
  • No.5 | | 509 bytes | |

    1/24/07, Musachy Barroso <mbarroso (AT) wfscorp (DOT) comwrote:

    Well, you can use the plugin to "send the data back", using a "json"
    result, instead of writing to the Stream directly, like Joe
    mentioned.

    , *that* plugin. Sorry. I thought you were talking about the contents of
    the link you had just posted, rather than the S2 plugin. I also assumed the
    original poster was talking about S1 rather than S2, but it could have been
    either. The class I mentioned will work for S1.
  • No.6 | | 1450 bytes | |

    einundswanzig wrote:

    Im new in Struts, in fact im pretty new in Java, but i have programmed for
    Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server with
    Struts on it using Flex. Flex is able to call a java component on the
    server and execute a method and then serialize the result and deserialize
    it in an Actionscript(scripting language of flex) object. In my imaginary
    app Flex will provide the View, so im trying to find a way to enable
    Struts to serve just a result without a JSP or HTML page, i just want the
    result. god this is confusing

    Sorry, may be i am unable to explain what i want to do, so i will enter in
    some details. What i understand is that when a request to a Struts-enabled
    app, the request is passed to the controller, the controller then create
    some kind of object based on the request and then send that to the "handler"
    then the handler do whatever it should and then send a result
    (forwardsomehing is called) back to the controller which at the end render a
    page. What i want to do its avoiding the controller render that page, and
    just sent back "the result", for example an object, a bean to be consumed by
    flexJust like if you were calling a function, since Flex is able to
    serialize java objects and deserialize them into actionscript objects. I
    mean, im trying to enable Struts to serve to different clients, for example
    Flex or an applet
  • No.7 | | 496 bytes | |

    First, this is really a question for the User list. This list is for
    discussion of the development of Struts itself. Please follow up on that
    list rather than here.

    Second, you haven't actually said whether you're trying to use Struts 1 or
    Struts 2. Joe has provided the answer for S1; Musachy has provided the
    answer for S2. If you read a little bit more of the corresponding
    documentation, you will see that either way, the solution to your problem is
    simple.
  • No.8 | | 2545 bytes | |

    Hi,

    First, this is probably not a question for the dev list, but rather
    for the user list (#subscribing)

    I haven't done much with Flex, but I'm familiar enough with the
    technology to hopefully shed some light on your situation. Struts is
    designed to serve HTTP requests. I don't think Flex is designed out
    of the box to use HTTP to transfer the serialized objects you need.
    Basically, Struts, and the servlet container that it runs in, just
    sends HTTP responses. By default, Flex uses a different protocol.

    As such, you probably want to check out the Flex HTTPService, which
    looks like it is designed to make use of HTTP responses, which a
    Struts app will serve, within Flex.

    Check out this article:

    Eric Rank

    Jan 24, 2007, at 9:00 AM, einundswanzig wrote:

    >
    >
    >

    einundswanzig wrote:
    >>

    >Im new in Struts, in fact im pretty new in Java, but i have
    >programmed for
    >Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server
    >with
    >Struts on it using Flex. Flex is able to call a java component on the
    >server and execute a method and then serialize the result and
    >deserialize
    >it in an Actionscript(scripting language of flex) object. In my
    >imaginary
    >app Flex will provide the View, so im trying to find a way to enable
    >Struts to serve just a result without a JSP or HTML page, i just
    >want the
    >result. god this is confusing
    >>

    >

    Sorry, may be i am unable to explain what i want to do, so i will
    enter in
    some details. What i understand is that when a request to a Struts-
    enabled
    app, the request is passed to the controller, the controller then
    create
    some kind of object based on the request and then send that to the
    "handler"
    then the handler do whatever it should and then send a result
    (forwardsomehing is called) back to the controller which at the end
    render a
    page. What i want to do its avoiding the controller render that
    page, and
    just sent back "the result", for example an object, a bean to be
    consumed by
    flexJust like if you were calling a function, since Flex is able to
    serialize java objects and deserialize them into actionscript
    objects. I
    mean, im trying to enable Struts to serve to different clients, for
    example
    Flex or an applet
  • No.9 | | 892 bytes | |

    1/24/07, Eric Rank <ericrank (AT) lo-fi (DOT) netwrote:

    Hi,

    First, this is probably not a question for the dev list, but rather
    for the user list (#subscribing)

    I haven't done much with Flex, but I'm familiar enough with the
    technology to hopefully shed some light on your situation. Struts is
    designed to serve HTTP requests. I don't think Flex is designed out
    of the box to use HTTP to transfer the serialized objects you need.
    Basically, Struts, and the servlet container that it runs in, just
    sends HTTP responses. By default, Flex uses a different protocol.

    Well, sort of. If you just ignore all the fancy bits of Flex, you can use
    the loadXML API to make a request to a servlet and send back JSN wrapped in
    minimal XML. Then 'eval' the JSN, and you have your response in an
    ActionScript data structure.
  • No.10 | | 3366 bytes | |

    Well in that article in the
    page number 5 the
    author says that we could create some kind of service facade to solve the
    problem, my question is how can i do that in Struts?

    Eric Rank-2 wrote:

    Hi,

    First, this is probably not a question for the dev list, but rather
    for the user list (#subscribing)

    I haven't done much with Flex, but I'm familiar enough with the
    technology to hopefully shed some light on your situation. Struts is
    designed to serve HTTP requests. I don't think Flex is designed out
    of the box to use HTTP to transfer the serialized objects you need.
    Basically, Struts, and the servlet container that it runs in, just
    sends HTTP responses. By default, Flex uses a different protocol.

    As such, you probably want to check out the Flex HTTPService, which
    looks like it is designed to make use of HTTP responses, which a
    Struts app will serve, within Flex.

    Check out this article:

    Eric Rank

    Jan 24, 2007, at 9:00 AM, einundswanzig wrote:

    >>
    >>
    >>

    >einundswanzig wrote:


    Im new in Struts, in fact im pretty new in Java, but i have
    programmed for
    Coldfusion, C#/VB and Flex. Im trying to connect to a J2EE server
    with
    Struts on it using Flex. Flex is able to call a java component on the
    server and execute a method and then serialize the result and
    deserialize
    it in an Actionscript(scripting language of flex) object. In my
    imaginary
    app Flex will provide the View, so im trying to find a way to enable
    Struts to serve just a result without a JSP or HTML page, i just
    want the
    result. god this is confusing

    >>

    >Sorry, may be i am unable to explain what i want to do, so i will
    >enter in
    >some details. What i understand is that when a request to a Struts-
    >enabled
    >app, the request is passed to the controller, the controller then
    >create
    >some kind of object based on the request and then send that to the
    >"handler"
    >then the handler do whatever it should and then send a result
    >(forwardsomehing is called) back to the controller which at the end
    >render a
    >page. What i want to do its avoiding the controller render that
    >page, and
    >just sent back "the result", for example an object, a bean to be
    >consumed by
    >flexJust like if you were calling a function, since Flex is able to
    >serialize java objects and deserialize them into actionscript
    >objects. I
    >mean, im trying to enable Struts to serve to different clients, for
    >example
    >Flex or an applet
    >--
    >View this message in context:
    >facade-tf3078810.html#a8563271
    >Sent from the Struts - Dev mailing list archive at Nabble.com.
    >>
    >>

    >
    >To unsubscribe, e-mail: dev-unsubscribe (AT) struts (DOT) apache.org
    >For additional commands, e-mail: dev-help (AT) struts (DOT) apache.org
    >>


    To unsubscribe, e-mail: dev-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: dev-help (AT) struts (DOT) apache.org

Re: Struts service facade


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Java"

EMSDN.COM