Hi, all, 

I have trouble to save data posted while ajax request, the manager doesn't
do anything, when I invoke itemManager.save(item);

Here is the code for to submit request via prototype Ajax:

        var url="/saveItem.html";
        var pars  = 'cartonno='+carton.cartonno;
        carton.items.each(function(item) {                                      
                        pars=pars+'&barcode='+item.barcode+item.amount;         
                         
                                                        
                });
        
        var myAjax = new Ajax.Request( url, {method: 'post', parameters: pars,
onComplete: submitDone} );

In the ItemAction, I do get the data posted by ajax. 


String cartonno = getRequest().getParameter("cartonno");

                String[] barcodes = getRequest().getParameterValues("barcode");

                PackingList packinglist = (PackingList) 
getSession().getAttribute(
                                "packingList");
                System.out.println("------ items number:" + barcodes.length);

                for (int i = 0; i < barcodes.length; i++) {
                         item = new Item();
                        
                        item.setCartonno(cartonno);

                        String barcode = barcodes[i].substring(0, 13);
                        String amo = barcodes[i].substring(13);

                        item.setBarcode(barcode);
                        item.setAmount(Integer.parseInt(amo));
                        item.setPackinglist(packinglist);                       
                        
                        System.out.println("------ item i:"+i+" barcode:" + 
barcode+" :
amount"+amo);
                        itemManager.save(item);
                }

Nothing happens, and no exception throws. The for loop only execute once, if
I comment itemManager.save(item); the loop can finish.

The itemManger I used is GenericManagerImpl:

    <bean id="itemManager"
class="com.absorbx.barcode.service.impl.GenericManagerImpl">
        <constructor-arg>
            <bean
class="com.absorbx.barcode.dao.hibernate.GenericDaoHibernate">
                <constructor-arg value="com.absorbx.barcode.model.Item"/>
                <property name="sessionFactory" ref="sessionFactory"/>
            </bean>
        </constructor-arg>
    </bean>

If I use the itemForm generated by appfuse: mvn appfuse:gen -Dentity=Item,
the save doesn't have any problem.

Do you guys can figure out what's the problem? Thank you so much.
-- 
View this message in context: 
http://www.nabble.com/Manager-doesn%27t-work-for-the-ajax-data-submition-tp19405880s2369p19405880.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to