Results 1 to 3 of 3

Thread: <c:out value="${variable}"/> form formBackingObject returns nothing

  1. #1
    Join Date
    Jul 2009
    Posts
    26

    Default <c:out value="${variable}"/> form formBackingObject returns nothing

    Just a quick question.

    I have a formBackinObject that populates a variable ie pCount

    In my JSP I have a <form:hidden path="pCount"> that gets properly populated and generates proper HTML

    Code:
    <input id="pCount" name="pCount" type="hidden" value="2"/>
    which is exactly what I set it to in the formBackingObject.

    However, later in the JSP I try to retrieve pCount value with

    Code:
    <c:out value="${pCount}"/>
    but that returns an empty string.

    How do I get the number in pCount?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Include your command bean in the value. The form tags add that for you.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2009
    Posts
    26

    Default

    Quote Originally Posted by Marten Deinum View Post
    Include your command bean in the value. The form tags add that for you.
    Yeah, after spending about 2,5 hours staring at the code, I realized I have to actually call the command I'm retrieving the value from.

    The correct way was to write

    Code:
    <c:out value="${command.pCount}"/>

Posting Permissions

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