Toni Montero

+ Follow
since Jul 04, 2012
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Toni Montero

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.
8 years ago
Your call to getJson is not valid, you must put action name, after this parameters and function (data....etc

Put here your js method, please.
8 years ago
If your action code return correctly the result list, is js function who fill your child select. Look:

function loadFamilias(value)
//valor de la familia seleccionada en el combo
var formInput= 'codTipoProducto='+value;
var options=''; //variable para poner los valores de subfamilia

options += '<option selected value="0">Subfamilia</option>';

options = '';

//this function call your action
$.getJSON('loadFamiliasAction', formInput,function(data) {
//After action, here you have your list, now you have to fill de select, first of all, you can put an initial value like '0 - SELECT YOUR ITEM'
options += '<option selected value="0">Familia</option>';

//Then your data into the select with a forEach fucntion. Note that ITEM is your bean and idFamilia or nombre is your attribut inside bean
$.each(data.familias, function(i,item){
options += '<option value="' + item.idFamilia + '">' + item.nombre + '</option>';

//after fill select, you must assign the new variable into your select

8 years ago
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.
8 years ago

And the action code:

This work fine, tell me if you need more info.
8 years ago
Hi Usha!

I did it with json.

I got the first dropdown called tipoProducto like this:

And i add a onchange function calling a json function:

this call a struts action with specific type:

Note the type of result. Before you add this kind of result you must add the code above in your struts.xml like this:

When action return the second list, the same code of js, fill the second select called familiaSelect.

I hope it helps you. Good luck
8 years ago

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... ^^
8 years ago