Results 1 to 7 of 7

Thread: Display tags in the Spring Applications

  1. #1

    Default Display tags in the Spring Applications

    Hi If any one has used the Display Tags with Spring .
    Please help me ..
    I am populating data in the form of HashMap as a Model.
    How can I populate data in the Display Tags.


    My Code for Data is :--

    public class InventoryController implements Controller {
    protected final Log logger=LogFactory.getLog(getClass());
    private ProductManagerService productManager;

    public void setProductManager(ProductManagerService productManager) {
    this.productManager = productManager;
    }
    public ModelAndView handleRequest(HttpServletRequest Request,HttpServletResponse response)throws ServletException,IOException
    { String now=(new Date().toString());
    logger.info("Returning hello view"+now);
    Map myModel = new HashMap();
    myModel.put("now", now);
    myModel.put("products", this.productManager.getProducts());
    return new ModelAndView("hello", "model", myModel);
    }
    }


    For Displayig data i have code as :--

    <h3>Products</h3>
    <h2>Display Tag Start</h2>

    <display:table name="products">
    <display:column property="description" /><c:out value="${model.products.description}"/>
    <display:column property="price"/><c:out value="${model.products.price}"/>
    </display:table>

    <h2>Display tag end </h2>

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

    Default

    [ code][/code ] tags next time please.

    I suggest you recheck the way Display Tag works.

    1) Your definition is wrong, don't include the c:out stuff
    2) the table name should be model.products

    Code:
    <display:table name="model.products">
      <display:column property="description" />
      <display:column property="price"/>
    </display:table>
    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

    Default Display tags in the Spring Application

    thanks a lot for Reply Marten,

    I tried with your suggestions, but it is not populating the data. Can you tell me if the data which i is being returned ias Hasmap and in the Display tag in the name attribute we have to provide the collection.

    In my program can you suggest , where i need to furthur change

    Thanks in advance martin

  4. #4
    Join Date
    Aug 2008
    Location
    St Louis, MO
    Posts
    51

    Default

    What does productManager.getProducts() return? See if you have data populating into the model.

    Are you getting "Nothing found to display" message on your jsp or nothing at all?

  5. #5

    Default Collection to iterate for the Display tag

    Hello thanks for the reply,

    I am geting the data from this productManager.getProducts()
    in the form of hashMap.

    I understand in the display tags we have to give the name of the colllection but it is not taking up..

    Plz suggest me.

  6. #6
    Join Date
    Aug 2008
    Location
    St Louis, MO
    Posts
    51

    Default

    What does your HashMap look like? What is the key & the value?

  7. #7

    Default Display tags in the Spring Application

    Hi,I have got the display tags work in my system, it is populating the data but when i click on the pgination (i.e next or previous) or I try downloading it is showing error as resource not found.

    <h2>Display Tag Start</h2>

    <c:set var="prod" value="${model.products}" scope="request"/>
    <display:table name="prod" export="true" pagesize="1">
    <display:column property="id" sortable="true"/>
    <display:column property="description" />
    <display:column property="price"/>
    </display:table>
    <h2>Display tag end </h2>

Posting Permissions

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