Struts, How to get at bean properties

Discussion in 'Javascript' started by Dave, Jul 12, 2004.

  1. Dave

    Dave Guest

    I think this is a simple struts question....

    I want to display information on a page in a static way. That is, not
    as part of text elements. I can't find an appropriate struts tag to
    use.

    This what I did find. The form bean will be named the same as the
    "name" attribute of the <form-bean> element in the struts-config.xml.

    So if I have a form bean with 2 string properties, such as str1 and
    str2, I can get the values on my jsp this way:

    <jsp:useBean
    id="DataForm"
    scope="session"
    type="com.mycompany.DataForm" />
    ...
    <p>Str1 : <%=DataForm.getStr1()%></p>
    <p>Str2 : <%=DataForm.getStr2()%></p>

    But that doesn't seem like the right way to do this. I expected some
    kind of special tag that I'll call "getprop":

    <p>Str1 : <html:getprop property="str1"></p>
    <p>Str2 : <html:getprop property="str2"></p>

    What is the right way to do this?
    Dave, Jul 12, 2004
    #1
    1. Advertising

  2. Dave

    Dave Guest

    Ooops. Yes, I meant to post this at c.l.j.prog. I'll repost it there.


    In article <1oc2rcndfg06j$.nhd3wesvlfsw$>,
    d says...
    > On Mon, 12 Jul 2004 17:22:48 -0400, Dave wrote:
    >
    > > What is the right way to do this?

    >
    > Post it to a group that speaks the
    > language might be a help..
    > <http://www.physci.org/codes/javafaq.jsp#cljp>
    >
    > But chase the links here first..
    > <http://www.physci.org/codes/javafaq.jsp#js>
    >
    >
    Dave, Jul 13, 2004
    #2
    1. Advertising

  3. Dave

    kaeli Guest

    kaeli, Jul 13, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benjamin Stewart

    To bean or not to bean...

    Benjamin Stewart, Jun 30, 2003, in forum: Java
    Replies:
    0
    Views:
    786
    Benjamin Stewart
    Jun 30, 2003
  2. Dave
    Replies:
    2
    Views:
    731
  3. Thomas P. Fuller
    Replies:
    1
    Views:
    4,511
    bitbucket43
    Aug 17, 2004
  4. jill
    Replies:
    5
    Views:
    15,531
  5. Replies:
    0
    Views:
    355
Loading...

Share This Page