473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Javascript and struts submit action Lookup Dispatcher Problem

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
3 10251
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


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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Amy | last post by:
When accessing my JSP I get the following error: org.apache.jasper.JasperException: Missing message for key button.next Can anyone tell me what the problem is? I have tried to figure this out...
1
by: marco | last post by:
Hi, I have this problem : when I submit a Form with the usual <html:form name="myForm" action="/myAction" type="org.apache.struts.validator.DynaValidatorActionForm"> ...... <input...
1
by: JumpingOffPlace | last post by:
Hi, I'm hoping that the wealth of knowledge here can stop me from spinning my wheels on this syntax error for hours. :) Below is the code, and the error I am recieving.... Code: <!DOCTYPE...
0
by: kisc71117 | last post by:
When accessing my JSP I get the following error: org.apache.jasper.JasperException: Missing message for key "button.add" my error message javax.servlet.ServletException: Missing message for key...
5
by: =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?= | last post by:
Hello, I've been trying to figure something out for the past few days and I can't seem to pinpoint what I'm doing wrong. I've been trying to call javascript from inside a <logic:equal>, but...
3
by: shanmukhi | last post by:
hi all, i got a problem with struts. iam unable to find it. i have written an action class, form bean class and a jsp page on submitting form, request is going to action class but it is not...
1
by: shrik | last post by:
hi everybody. I have following problem. There are two pages. index.jsp and main.jsp in my application Index.jsp contains logging interface in . It submits password and userid to loginform bean. ...
31
by: ajos | last post by:
hi frnds, i have a form,which has 2 input text boxes, the values are entering the text boxes,when i leave the 2 text boxes blank and hit submit a java script gives the message that the 2 fields are...
1
by: NamelessNumberheadMan | last post by:
I can't seem to get Struts 2 validations to work. I have been converting from Strust 1 to Struts 2. So far I've refactored all the code (for this particular module) on the back end, rewrote the jsp...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.