Announcement Announcement Module
No announcement yet.
Display tags in the Spring Applications Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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());"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 :--

    <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}"/>

    <h2>Display tag end </h2>

  • #2
    [ 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

    <display:table name="model.products">
      <display:column property="description" />
      <display:column property="price"/>


    • #3
      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
        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
          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
            What does your HashMap look like? What is the key & the value?


            • #7
              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"/>
              <h2>Display tag end </h2>