By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

Javascript and struts submit action Lookup Dispatcher Problem

P: n/a
Hi,
i am in a bit of a delima here.
I need to submit an action through javascript
so i used

document.forms[0].action='/search.do?&submitaction=Add Minus'
document.forms[0].submit();
since i am working on struts then submitaction maps to through the
action dispatcher.

so where the action is mapperd as Add Minus
it goes as Add%20%Minus because of the way i submitted. Is there any
way i can make it go as Add Minus Please help

Thanx in advance
Sandip

Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
sancha wrote:
Hi,
i am in a bit of a delima here.
I need to submit an action through javascript
so i used

document.forms[0].action='/search.do?&submitaction=Add Minus'
document.forms[0].submit();
since i am working on struts then submitaction maps to through the
action dispatcher.

so where the action is mapperd as Add Minus
it goes as Add%20%Minus because of the way i submitted. Is there any
way i can make it go as Add Minus Please help

Thanx in advance
Sandip


Hi,

FIrstly:
document.forms[0].action='/search.do?&submitaction=Add Minus'
is wrong.

document.forms[0].action='/search.do?&submitaction=Add+Minus'
would be better.

But i would suggest another field in your form, call it submitaction, and
make it hidden.
Set the value for the hdeen field submitaction, and then just submit.

You are sending information by BOTH the Querystring and the POST.
Very confusing, at least for me, and probably for a few webservers too.

Regards,
Erwin Moller
Jul 23 '05 #2

P: n/a


I know i am using the method POST but the problem is that i am new to
Struts.

I tried setting the value of submitaction using javascript but that
dosent work

i am passing it as a string because i havent figuers out a better way to
post.

The problem lies in my ignorance in struts.
We have the LookupDispatcher which maps certain words ro the action to
be performed.

So the struts application needs to know which action to call.
This is passed by the parameter submitaction.
Intrestingly if i pass it through the url using javascript it works. the
problem is the user needs a prompt whenhe tries to cancel a form
Now the javascript prompt message is useless as the two buttons are 'OK'
and 'Cancel' so i had to write my own small window operner script.
However i cant stop the form from submiting using this. so i converted
the submit button into a plain button and was using javascript to
submit.
Now everthing was working except for this value. So i am stuck. Can any1
please help me ??

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

P: n/a
sandip chaudhuri wrote:

The problem lies in my ignorance in struts.
We have the LookupDispatcher which maps certain words ro the action to
be performed.


Hi,

Why don't you repost your question in a Java newsgroup, since Javascript is
not the problem?

This is a Javascriptnewsgroup.
Try comp.lang.java.help
or
comp.lang.java.programmer

Regards,
Erwin Moller
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.