Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 and displaytag issue

 
Toni Montero
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I need to paginate a resultList and in this forum i see in other post that you recomend to use displayTag, so I introduce it into my project but now i have an issue that i can't see the solution.

Every row (table generated with displaytag for pagination) contains product info like:

idArticle, name, description, price.

And in another 2 columns I need an input with quantity and the other one a submit link to add current row (product) in a cart.

The problem is that i don't know how to take the number of quantity input and put it in 'column-link' to 'add-to-cart'.

This is the resultList (bean):




Here the jsp:



In column property = "idArticulo" will be an image with 'Add to cart' and after click on it it must send an object to my action with 'Cantidad' input value and idArticulo.

Can anyone help me? What i have to do? Javascript? I read something about decorators in displaytag documentation but there is nothing about picking an input value that is not in ArticleBean...

Thanks in advance and excuse me if I don't speak (write in this case.. ) english very well... ^^
 
ganapathi pudi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Click on idArticulo give tag specified parameters href="addArticuloCarritoAction"(Action name) paramId="Articulo.idArticulo" (giving param default value is properity)
finally the solution is

in action you geeting cantidad value is idArticulo(click iteam) handle operations.
further ref display tag tutorial
 
Toni Montero
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your replay ganapathi, but this is not what I need. I mean to pass multiple paramters in action link, in this case two parameters, idArticulo and cantidad, but I don't know how to pick the input value named cantidad..

Thank you again.
 
ganapathi pudi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
generate getters and setter to cantidad at actionclass then getCantidad() returns related idArticulo value. and for multiple values write a decorator .
 
Toni Montero
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ganapathi pudi wrote:generate getters and setter to cantidad at actionclass then getCantidad() returns related idArticulo value. and for multiple values write a decorator .


Ok. I read something about decorators but still I need to try it. Let's see how it works.

Thank you so much, if i need more help then i will answer here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic