Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Call a JSP procedure through 'onClick' with a js variable...

Reply
Thread Tools

Call a JSP procedure through 'onClick' with a js variable...

 
 
Sébastien de Mapias
Guest
Posts: n/a
 
      11-21-2008
Hi,
I'm using Struts 1.1. I'm displaying in a list in a JSP, with 4
columns
(an ID, a date, a type1 and a type2). A click on the 4rth element
in one row of this list triggers the appearance of a small pop-up
(just a div that I make visible), with 3 fields To, Cc, Bcc and a
hidden 'id' field, and 2 buttons: 'Send' or 'Cancel'.

I'd like to call the 'sendMail' defined in my struts-config.xml, with
one argument: the ID of the row clicked. I can't seem to be able
to have it working.

1/ in the 1rst case I do the following in the definition of my 'Send'
button:
~ <a href="#" onClick="sendMail.do?docId=document.getElementById
('id').value;">
~ <bean:message key="button.send" />
~ </a>

I get error "missing: in conditional expression" with
"sendMail.do?docId=document.getElementById('id').v alue;"

=> the 'document.getElementById('id').value' is not evaluated
(I should get "sendMail.do?docId=6489")

2/ in the 2nd case I've created a javascript function, and tried with
~ <a href="#" onClick="sendMail();">
~ <bean:message key="button.send" />
~ </a>

my sendMail() function being:
~ function sendMail() {
~ var docId = document.getElementById('id').value;
~ window.location.href='sendMail.do?docId='+docId;
~ }

I do get the correct URL in my address bar then:
~ http://localhost:9080/app-web/sendMail.do?docId=1618

but with the following error:
~ Error 500: Cannot find bean org.apache.struts.taglib.html.BEAN
~ in any scope

My question: is there a way to call my JSP-defined 'sendMail'
procedure with this 'docId' parameter ? (I only need to call this
procedure/action, don't need to open another window)

In advance, thanks...
Seb
 
Reply With Quote
 
 
 
 
Sébastien de Mapias
Guest
Posts: n/a
 
      11-21-2008
Forgot to add that the following can't work:
~ <a href="#" onClick="sendMail.do?docId=<bean:write name="xxx"
property="id"/>;">
~ <bean:message key="button.send" />
~ </a>
neither as I have no bean defined within this sub-div
displaying these To/Cc/Bcc fields and Send/Cancel buttons.

Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
procedure as argument in procedure AlexWare VHDL 2 10-23-2009 09:14 AM
'Procedure or function <stored procedure name> has too many arguments specified',,,ARGH! Mike P ASP .Net 0 06-19-2006 01:19 PM
[JSP] difference between jsp:forward and jsp:include alexjaquet@gmail.com Java 0 06-02-2006 01:21 PM
Sending email through Stored procedure Patrick ASP .Net 2 02-15-2005 08:29 AM
send email through stored procedure Patrick ASP .Net 3 01-24-2005 07:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57