Results 1 to 4 of 4

Thread: Reference Field, hidden some field in view.

  1. #1
    Join Date
    Jun 2012
    Location
    Italy
    Posts
    6

    Default Reference Field, hidden some field in view.

    Using Spring Roo, I created a relationship between two tables: peoples and users, using a reference field in peoples.(ManyToOne)
    The problem is that when I show the view for peoples, for the reference field to users, it show me the fields username and password.
    How do I hide the second field of users, password in my view of peoples.

    My view is like:

    Code:
      <form:create id="model_peoples" modelAttribute="people" path="/sec/peoples" render="${empty dependencies}" z="5XtUHaw1WvxoSPiylXYxRvHceVw=">
            <field:input field="surname" id="..." required="..." z="KSHHIIBq+Tt9qSMgMfsURpB7hTQ="/>
            <field:input field="name" id="...." required="..." z="JEqPqfAKPU/QDqqfuhbqSonuCYY="/>
            <field:select field="username" id="....users" itemValue="id" items="${users}" path="..." z="J2H2Av88D17vcEn/RSy7w4Hy2kc="/>
        </form:create>
    thanks in advance

  2. #2
    Join Date
    Jun 2012
    Location
    Italy
    Posts
    6

    Default

    Ok, I solved my problem for half, in the view I used itemLabel="username" for create.jspx and update.jspx,
    and object="${people.username}" in show.jspx.

    But not for list.jspx

    .........
    <field:select field="username" id="..." itemValue="id" items="${users}" itemLabel="username" path="..." z="fzUp9zsw1Xto+YclUyXh01F3cnA="/>

    ........
    <field:display field="username" id="........" object="${people.username}" z="c1Ym/yeuInkTh/VPAgczByTVp+s="/>
    Last edited by giamak; Jul 2nd, 2012 at 02:16 PM.

  3. #3
    Join Date
    Jan 2010
    Location
    Mislata - Valencia - Spain
    Posts
    162

    Default

    In your web package, you have a class named ConversionService. Here, you have a method for each entity of your domain. This methods declares how entities are show in text format. Push in your desired method and remove password from concatenation.
    Mario Martínez Sánchez
    Project Manager & Software Architect
    --------------------------
    Disid Technologies S.L.
    http://www.disid.com
    --------------------------
    gvNIX
    http://gvnix.googlecode.com
    http://www.gvnix.org

  4. #4
    Join Date
    Jun 2012
    Location
    Italy
    Posts
    6

    Default

    Thank you very much, I solved my problem with your help. Now is ok!!!

    I changed:

    public Converter<User, String> ApplicationConversionServiceFactoryBean.getUserToS tringConverter() {
    return new org.springframework.core.convert.converter.Convert er<...., java.lang.String>() {
    public String convert(User user) {
    return new StringBuilder().append(user.getUsername()).append( ' ').append(user.getPassword()).toString();
    }
    };
    }

    In:

    public Converter<User, String> ApplicationConversionServiceFactoryBean.getUserToS tringConverter() {
    return new org.springframework.core.convert.converter.Convert er<...., java.lang.String>() {
    public String convert(User user) {
    return new StringBuilder().append(user.getUsername()).toStrin g();
    }
    };
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •