Announcement Announcement Module
Collapse
No announcement yet.
access specific field from all fields returned by getAttribute object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • access specific field from all fields returned by getAttribute object

    I am currently working on a SpringRoo project using MVC architecture.
    I have 2 model classes as given below:

    public class GrowthDetails {
    private Integer minAge;
    private Integer maxAge;
    private String growthDetail;
    private String growthDetailDescription;
    @ManyToOne
    private ItemCategory itemCategoryId;
    }


    public class ItemCategory {
    private String itemCategoryName;
    private String itemCategoryDescription;
    }

    And I have written controllers for both models.
    Now in the GrowthDetailsController, I use the persist() method to write data of the fields in "GrowthDetails.java" to google app engine.
    And i used "request.setAttribute" to pass the object to a jsp where "request.getAttribute" is used to access the set object.

    In GrowthDetailsController.java:
    growthDetails.persist();
    request.setAttribute("itemCatId", growthDetails.getGrowthDetail());

    In list-dynamic.jsp:
    <%= request.getAttribute("itemCatId") %>

    In the jsp, I want to access itemCategoryName of "ItemCategory.java" through itemCategoryId referenced in "GrowthDetails.java".
    Now what I am getting is all the objects of ItemCategory, whereas I just want to access only itemCategoryName from all attributes returned by the object.
    This is where I am stuck. I cant figure how to access a specific field from all the fields returned by an object.

  • #2
    Moved this to the Roo forum where you can get some better help.

    Comment

    Working...
    X