Announcement Announcement Module
Collapse
No announcement yet.
Spring JPA help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring JPA help

    Hi I am using HQL for selecting all the contents in 'EXCEPTION_CODE_MASTER' table.

    Please go throuth the code fragments.

    findAllEXCEPTION_CODE_MASTERs() method:

    return entityManager().createQuery("select o from EXCEPTION_CODE_MASTER o", EXCEPTION_CODE_MASTER.class).getResultList();

    This is my controller code:

    @RequestMapping(method = RequestMethod.GET)
    public String list(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) {
    uiModel.addAttribute("exception_code_masters", EXCEPTION_CODE_MASTER.findAllEXCEPTION_CODE_MASTER s());
    return "exception_code_masters/list";
    }


    Which calls the above declared"findAllEXCEPTION_CODE_MASTERs()' method.

    Now in the jsp file when i try to print all data in the object

    xxxx.jsp


    <c:forEach var="Exception"
    items="${exception_code_masters}">
    <tr><td>${Exception}</td></tr>
    </c:forEach>



    It is showing the entire object.
    Output
    [EXCP_CODE: 100, EXCP_TYPE: Null Pointer, EXCP_DESC: It is a Show Stopper, EXCP_CATEGORY: Critical,
    EXCP_CODE: 50, EXCP_TYPE: Memory, EXCP_DESC: Can be ignored, EXCP_CATEGORY: Medium,
    EXCP_CODE: 75, EXCP_TYPE: xxxxxx, EXCP_DESC yyyyyy: , EXCP_CATEGORY: zzzzzzz]

    But I want to print the value of EXCP_CODE only.
    Can anybody help me out?

    Thanks and regards.
    Privin Thomas

  • #2
    Hello,

    First, you should use code tag when you wrote code.

    It's not a Spring related question but a jstl one

    If getEXCP_CODE() is defined into EXCEPTION_CODE_MASTER

    Code:
    <c:forEach var="Exception" items="${exception_code_masters}">
    <tr><td>${Exception.EXCP_CODE}</td></tr>
    </c:forEach>

    Comment

    Working...
    X