LookupDispatchAction + Paging with form submit

2003-03-25 Thread Pat Quinn
I have a LookupDispatchAction as follows:

protected Map getKeyMethodMap() {
   Map map = new HashMap();
   map.put(label.catalogue.find, doFind);
   map.put(label.catalogue.addtoCart, doAddToCart);
   map.put(label.paging, doPaging);
   return map;
}
I display my paging details using a Href's for eg.
a 
href=/myWebApp/myLookupDispatchAction.do?action=pagingpager.offset=82/a

This all worked fine for me... but i then need to change my href to submit 
the form as i page to the next page (I want to pick up client changes as 
they page...
redirecting to the next view doesn't work as you'd expect)
.
So i changed my paging href's to the following:

a href=# onClick=dopaging(8)2/a

I have the following javascript method defined in the same jsp file:

function dopaging(offset) {
document.forms[0].submit.value = 
/myLookupDispatchAction.do?action=pagingpager.offset= + offset;
document.forms[0].submit();
	}

I then get the following error:

ERROR BaseAction::execute unexpected exception
javax.servlet.ServletException: Request[/myLookupDispatchAction] does not 
contain handler parameter named
action
   at 
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:200)



Any ideas guys... is there a better way to do this???







_
Add photos to your messages with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


RE: LookupDispatchAction + Paging with form submit

2003-03-25 Thread Andrew Hill
Looks like the action parameter isnt getting through.

Hmm. Heres why:
snip
document.forms[0].submit.value =
/myLookupDispatchAction.do?action=pagingpager.offset= + offset;
/snip

You seem to be setting the wrong attribute. Try:

document.forms[0].action =
/myLookupDispatchAction.do?action=pagingpager.offset= + offset;

btw
Despite being used in several struts examples, the parameter name action
is actually a very bad choice as it shadows a javascript form object
attribute also named action (which you probably noticed in my potential
solution above - shouldnt hurt as part of the url but as an html field it
will be bad as it will stop you setting the form action attribute in
javascript). A better choice of parameter name would be method or bob
(hehe).
/btw

-Original Message-
From: Pat Quinn [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 25 March 2003 22:29
To: [EMAIL PROTECTED]
Subject: LookupDispatchAction + Paging with form submit


I have a LookupDispatchAction as follows:

protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put(label.catalogue.find, doFind);
map.put(label.catalogue.addtoCart, doAddToCart);
map.put(label.paging, doPaging);


return map;
}

I display my paging details using a Href's for eg.
a
href=/myWebApp/myLookupDispatchAction.do?action=pagingpager.offset=82/a



This all worked fine for me... but i then need to change my href to submit
the form as i page to the next page (I want to pick up client changes as
they page...
redirecting to the next view doesn't work as you'd expect)
.
So i changed my paging href's to the following:


a href=# onClick=dopaging(8)2/a


I have the following javascript method defined in the same jsp file:


function dopaging(offset) {
document.forms[0].submit.value =
/myLookupDispatchAction.do?action=pagingpager.offset= + offset;
document.forms[0].submit();
}


I then get the following error:

ERROR BaseAction::execute unexpected exception
javax.servlet.ServletException: Request[/myLookupDispatchAction] does not
contain handler parameter named
action
at
org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.
java:200)



Any ideas guys... is there a better way to do this???







_
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail


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


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