473,761 Members | 5,848 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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?&subm itaction=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 10268
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?&subm itaction=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?&subm itaction=Add Minus'
is wrong.

document.forms[0].action='/search.do?&subm itaction=Add+Mi nus'
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 LookupDispatche r 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 LookupDispatche r 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 Javascriptnewsg roup.
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
3632
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 but am new to building webapps and struts. Thank you for your help. My JSP has : <html:form action="/ContactAction">
1
2048
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 type="submit" name="action" value="Soumettre"> .....
1
1989
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 HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%@ taglib uri="/WEB-INF/tag-lib/struts-html-el.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tag-lib/struts-bean.tld" prefix="bean" %>
0
2278
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 "button.add" org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758) ...
5
20008
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 it doesn't seem to work like I want. I've tried calling an alert('hello'); to test out if my call worked correctly, and it does, but when I call my own javascript functions
3
5400
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 executing action class iam unable to solve it... here is my code FormLogin.java public class FormLogin extends ActionForm{ private String username=null;;
1
14057
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. following are entries in struts-config.xml file <action input="index.jsp" name="loginform" path="/login" scope="session" type="com.myapp.struts.loginaction"> <forward name="success" path="/main.jsp"/>
31
15379
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 blank.....the problem now is when i leave the text boxes blank the message appears...and when i click ok...then instead of showing me the page its giving me an exception--> type Exception report message description The server encountered an...
1
11534
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 using Struts 2 notations, and wired up the xml (aside from the abc-validation.xml). Everything runs just fine. If there is an error not generated by user input (i.e. file format problem) I can get that message to come out, so I know my error messages...
0
9522
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9336
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8770
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7327
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6603
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5364
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3446
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.