Announcement Announcement Module
Collapse
No announcement yet.
Reference Field, hidden some field in view. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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, 02:16 PM.

    Comment


    • #3
      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.

      Comment


      • #4
        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();
        }
        };
        }

        Comment

        Working...
        X