You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ray <ra...@yahoo.co.uk> on 2002/08/16 15:06:02 UTC
Passing Struts parameters to JavaScript functions.
Hi there ... :-)
I was hoping someone could help me with a validation problem.
I'm trying to build a simple page that deletes an item from a database,
when the user clicks on the "delete" link.
Before going on to delete the item though, I need to ask the user if she's
sure that she wants to delete the item.
I thought the easiest way to do this, was a JavaScript call that would
display a dialog:
<html:link onclick="askDelete(<bean:write name="myCollectionElement"
property="id"/>)">delete</html:link>
I'm trying to pass the bean value to the askDelete function, but the syntax
is shafted. How do I go about doing this? My next problem would be calling
the deleteItem.do method from Javascript, whilst making sure that the
URL-rewriting stuff stays intact.
Is there in fact, a better way to do this? I've heard of something called
the Validation Framework, which works clientside. Are there any tutorials
on using it?
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Validator - Locale - Variant
Posted by "Saptha \"Girish\" Gadamsetty" <gi...@spry-tech.com>.
Hi all,
Sorry to send this message again...haven't got any response as yet...hoping
that this mail would trigger some response/ideas to my problem.
I am trying to implement Internationalization based validation using the
Struts Validator. The validation works fine when I just have the language
and the country code as attributes for formset in validation.xml but it
fails when I include a variant attribute in the formset. I am using the
following command to set the locale
session.setAttribute(org.apache.struts.action.Action.LOCALE_KEY, new
java.util.Locale("en", "US", "200"));
the number "200" is a custom value (company code).
...Any help is highly appreciated.
Thanks in advance again
Girish
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Validator - Locale - Variant
Posted by "Saptha \"Girish\" Gadamsetty" <gi...@spry-tech.com>.
Hi all,
I am trying to implement Internationalization based validation using the
Struts Validator. The validation works fine when I just have the language
and the country code as attributes for formset in validation.xml but it
fails when I include a variant attribute in the formset. I am using the
following command to set the locale
session.setAttribute(org.apache.struts.action.Action.LOCALE_KEY, new
java.util.Locale("en", "US", "200"));
Where am I going wrong? Did anyone try/implement this before?
...Any help in this regard is highly appreciated.
Thanks in advance
Girish
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Validator - Locale - Variant
Posted by "Saptha \"Girish\" Gadamsetty" <gi...@spry-tech.com>.
Hi all,
I am trying to implement Internationalization based validation using the
Struts Validator. The validation works fine when I just have the language
and the country code as attributes for formset in validation.xml but it
fails when I include a variant attribute in the formset. I am using the
following command to set the locale
session.setAttribute(org.apache.struts.action.Action.LOCALE_KEY, new
java.util.Locale("en", "US", "200"));
...Any help in this regard is highly appreciated.
Thanks in advance
Girish
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Passing Struts parameters to JavaScript functions.
Posted by Ray <ra...@yahoo.co.uk>.
Ok, I'll give that a try .. thanks.
At 13:44 16/08/2002 -0700, you wrote:
>I guess you can do this as long as variables myCollection, x are in the
>script context(you need to put braces before getId()):
>
>((elementType)myCollection.elementAt(x)).getId();
>
>Mei
>-----Original Message-----
>From: Ray [mailto:ray_offiah@yahoo.co.uk]
>Sent: Friday, August 16, 2002 10:58 AM
>To: Struts Users Mailing List
>Subject: RE: Passing Struts parameters to JavaScript functions.
>
>
>Mmm .. I get it .... :-)
>
>Ok, another question.
>
>If I have:
>
>name="myCollectionElement" property="id"
>
>from my collection iteration; is there any way I can get at the underlying
>object as a JSP call?
>
>Something like:
>
>(elementType)myCollection.elementAt(x).getId();
>
>
>At 11:52 16/08/2002 -0700, you wrote:
> >Please see if the attached example code can help.
> >
> >Mei
> >
> >-----Original Message-----
> >From: Ray [mailto:ray_offiah@yahoo.co.uk]
> >Sent: Friday, August 16, 2002 8:06 AM
> >To: Struts Users Mailing List
> >Subject: Re: Passing Struts parameters to JavaScript functions.
> >
> >
> >Yes, that would be great, except that I'm reading the stuf from a
> >collection, which might be quite large. I was wondering if there was a way
> >to do it, without having to have twenty or thirty hidden fields on the
>form.
> >
> >At 08:39 16/08/2002 -0500, you wrote:
> > >Ray....
> > >
> > >Don't pass the value to Javascript. Put the value of "id" in a hidden
> > >field in the form then Javascript can get the value via
> > >document.formName.hiddenFiledName.value.
> > >
> > >
> > >Later, aj
> > >
> > >
> > >
> > >Ray wrote:
> > >
> > >>Hi there ... :-)
> > >>I was hoping someone could help me with a validation problem.
> > >>I'm trying to build a simple page that deletes an item from a database,
> > >>when the user clicks on the "delete" link.
> > >>Before going on to delete the item though, I need to ask the user if
> > >>she's sure that she wants to delete the item.
> > >>I thought the easiest way to do this, was a JavaScript call that would
> > >>display a dialog:
> > >><html:link onclick="askDelete(<bean:write name="myCollectionElement"
> > >>property="id"/>)">delete</html:link>
> > >>I'm trying to pass the bean value to the askDelete function, but the
> > >>syntax is shafted. How do I go about doing this? My next problem would
>be
> > >>calling the deleteItem.do method from Javascript, whilst making sure
>that
> > >>the URL-rewriting stuff stays intact.
> > >>Is there in fact, a better way to do this? I've heard of something
>called
> > >>the Validation Framework, which works clientside. Are there any
>tutorials
> > >>on using it?
> > >>
> > >>__________________________________________________
> > >>Do You Yahoo!?
> > >>HotJobs - Search Thousands of New Jobs
> > >>http://www.hotjobs.com
> > >>-- To unsubscribe, e-mail:
> > >><ma...@jakarta.apache.org>
> > >>For additional commands, e-mail:
> ><ma...@jakarta.apache.org>
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> ><ma...@jakarta.apache.org>
> > >For additional commands, e-mail:
> ><ma...@jakarta.apache.org>
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >HotJobs - Search Thousands of New Jobs
> >http://www.hotjobs.com
> >
> >--
> >To unsubscribe, e-mail:
> ><ma...@jakarta.apache.org>
> >For additional commands, e-mail:
> ><ma...@jakarta.apache.org>
> >
> >--
> >To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> >For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>__________________________________________________
>Do You Yahoo!?
>Sign up for SBC Yahoo! Dial - First Month Free
>http://sbc.yahoo.com
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Passing Struts parameters to JavaScript functions.
Posted by Mei Zhu <mz...@goperiscope.com>.
I guess you can do this as long as variables myCollection, x are in the
script context(you need to put braces before getId()):
((elementType)myCollection.elementAt(x)).getId();
Mei
-----Original Message-----
From: Ray [mailto:ray_offiah@yahoo.co.uk]
Sent: Friday, August 16, 2002 10:58 AM
To: Struts Users Mailing List
Subject: RE: Passing Struts parameters to JavaScript functions.
Mmm .. I get it .... :-)
Ok, another question.
If I have:
name="myCollectionElement" property="id"
from my collection iteration; is there any way I can get at the underlying
object as a JSP call?
Something like:
(elementType)myCollection.elementAt(x).getId();
At 11:52 16/08/2002 -0700, you wrote:
>Please see if the attached example code can help.
>
>Mei
>
>-----Original Message-----
>From: Ray [mailto:ray_offiah@yahoo.co.uk]
>Sent: Friday, August 16, 2002 8:06 AM
>To: Struts Users Mailing List
>Subject: Re: Passing Struts parameters to JavaScript functions.
>
>
>Yes, that would be great, except that I'm reading the stuf from a
>collection, which might be quite large. I was wondering if there was a way
>to do it, without having to have twenty or thirty hidden fields on the
form.
>
>At 08:39 16/08/2002 -0500, you wrote:
> >Ray....
> >
> >Don't pass the value to Javascript. Put the value of "id" in a hidden
> >field in the form then Javascript can get the value via
> >document.formName.hiddenFiledName.value.
> >
> >
> >Later, aj
> >
> >
> >
> >Ray wrote:
> >
> >>Hi there ... :-)
> >>I was hoping someone could help me with a validation problem.
> >>I'm trying to build a simple page that deletes an item from a database,
> >>when the user clicks on the "delete" link.
> >>Before going on to delete the item though, I need to ask the user if
> >>she's sure that she wants to delete the item.
> >>I thought the easiest way to do this, was a JavaScript call that would
> >>display a dialog:
> >><html:link onclick="askDelete(<bean:write name="myCollectionElement"
> >>property="id"/>)">delete</html:link>
> >>I'm trying to pass the bean value to the askDelete function, but the
> >>syntax is shafted. How do I go about doing this? My next problem would
be
> >>calling the deleteItem.do method from Javascript, whilst making sure
that
> >>the URL-rewriting stuff stays intact.
> >>Is there in fact, a better way to do this? I've heard of something
called
> >>the Validation Framework, which works clientside. Are there any
tutorials
> >>on using it?
> >>
> >>__________________________________________________
> >>Do You Yahoo!?
> >>HotJobs - Search Thousands of New Jobs
> >>http://www.hotjobs.com
> >>-- To unsubscribe, e-mail:
> >><ma...@jakarta.apache.org>
> >>For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> >For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>__________________________________________________
>Do You Yahoo!?
>HotJobs - Search Thousands of New Jobs
>http://www.hotjobs.com
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Passing Struts parameters to JavaScript functions.
Posted by Ray <ra...@yahoo.co.uk>.
Mmm .. I get it .... :-)
Ok, another question.
If I have:
name="myCollectionElement" property="id"
from my collection iteration; is there any way I can get at the underlying
object as a JSP call?
Something like:
(elementType)myCollection.elementAt(x).getId();
At 11:52 16/08/2002 -0700, you wrote:
>Please see if the attached example code can help.
>
>Mei
>
>-----Original Message-----
>From: Ray [mailto:ray_offiah@yahoo.co.uk]
>Sent: Friday, August 16, 2002 8:06 AM
>To: Struts Users Mailing List
>Subject: Re: Passing Struts parameters to JavaScript functions.
>
>
>Yes, that would be great, except that I'm reading the stuf from a
>collection, which might be quite large. I was wondering if there was a way
>to do it, without having to have twenty or thirty hidden fields on the form.
>
>At 08:39 16/08/2002 -0500, you wrote:
> >Ray....
> >
> >Don't pass the value to Javascript. Put the value of "id" in a hidden
> >field in the form then Javascript can get the value via
> >document.formName.hiddenFiledName.value.
> >
> >
> >Later, aj
> >
> >
> >
> >Ray wrote:
> >
> >>Hi there ... :-)
> >>I was hoping someone could help me with a validation problem.
> >>I'm trying to build a simple page that deletes an item from a database,
> >>when the user clicks on the "delete" link.
> >>Before going on to delete the item though, I need to ask the user if
> >>she's sure that she wants to delete the item.
> >>I thought the easiest way to do this, was a JavaScript call that would
> >>display a dialog:
> >><html:link onclick="askDelete(<bean:write name="myCollectionElement"
> >>property="id"/>)">delete</html:link>
> >>I'm trying to pass the bean value to the askDelete function, but the
> >>syntax is shafted. How do I go about doing this? My next problem would be
> >>calling the deleteItem.do method from Javascript, whilst making sure that
> >>the URL-rewriting stuff stays intact.
> >>Is there in fact, a better way to do this? I've heard of something called
> >>the Validation Framework, which works clientside. Are there any tutorials
> >>on using it?
> >>
> >>__________________________________________________
> >>Do You Yahoo!?
> >>HotJobs - Search Thousands of New Jobs
> >>http://www.hotjobs.com
> >>-- To unsubscribe, e-mail:
> >><ma...@jakarta.apache.org>
> >>For additional commands, e-mail:
><ma...@jakarta.apache.org>
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
> >For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>
>__________________________________________________
>Do You Yahoo!?
>HotJobs - Search Thousands of New Jobs
>http://www.hotjobs.com
>
>--
>To unsubscribe, e-mail:
><ma...@jakarta.apache.org>
>For additional commands, e-mail:
><ma...@jakarta.apache.org>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Passing Struts parameters to JavaScript functions.
Posted by Mei Zhu <mz...@goperiscope.com>.
Please see if the attached example code can help.
Mei
-----Original Message-----
From: Ray [mailto:ray_offiah@yahoo.co.uk]
Sent: Friday, August 16, 2002 8:06 AM
To: Struts Users Mailing List
Subject: Re: Passing Struts parameters to JavaScript functions.
Yes, that would be great, except that I'm reading the stuf from a
collection, which might be quite large. I was wondering if there was a way
to do it, without having to have twenty or thirty hidden fields on the form.
At 08:39 16/08/2002 -0500, you wrote:
>Ray....
>
>Don't pass the value to Javascript. Put the value of "id" in a hidden
>field in the form then Javascript can get the value via
>document.formName.hiddenFiledName.value.
>
>
>Later, aj
>
>
>
>Ray wrote:
>
>>Hi there ... :-)
>>I was hoping someone could help me with a validation problem.
>>I'm trying to build a simple page that deletes an item from a database,
>>when the user clicks on the "delete" link.
>>Before going on to delete the item though, I need to ask the user if
>>she's sure that she wants to delete the item.
>>I thought the easiest way to do this, was a JavaScript call that would
>>display a dialog:
>><html:link onclick="askDelete(<bean:write name="myCollectionElement"
>>property="id"/>)">delete</html:link>
>>I'm trying to pass the bean value to the askDelete function, but the
>>syntax is shafted. How do I go about doing this? My next problem would be
>>calling the deleteItem.do method from Javascript, whilst making sure that
>>the URL-rewriting stuff stays intact.
>>Is there in fact, a better way to do this? I've heard of something called
>>the Validation Framework, which works clientside. Are there any tutorials
>>on using it?
>>
>>__________________________________________________
>>Do You Yahoo!?
>>HotJobs - Search Thousands of New Jobs
>>http://www.hotjobs.com
>>-- To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
Re: Passing Struts parameters to JavaScript functions.
Posted by Ray <ra...@yahoo.co.uk>.
Yes, that would be great, except that I'm reading the stuf from a
collection, which might be quite large. I was wondering if there was a way
to do it, without having to have twenty or thirty hidden fields on the form.
At 08:39 16/08/2002 -0500, you wrote:
>Ray....
>
>Don't pass the value to Javascript. Put the value of "id" in a hidden
>field in the form then Javascript can get the value via
>document.formName.hiddenFiledName.value.
>
>
>Later, aj
>
>
>
>Ray wrote:
>
>>Hi there ... :-)
>>I was hoping someone could help me with a validation problem.
>>I'm trying to build a simple page that deletes an item from a database,
>>when the user clicks on the "delete" link.
>>Before going on to delete the item though, I need to ask the user if
>>she's sure that she wants to delete the item.
>>I thought the easiest way to do this, was a JavaScript call that would
>>display a dialog:
>><html:link onclick="askDelete(<bean:write name="myCollectionElement"
>>property="id"/>)">delete</html:link>
>>I'm trying to pass the bean value to the askDelete function, but the
>>syntax is shafted. How do I go about doing this? My next problem would be
>>calling the deleteItem.do method from Javascript, whilst making sure that
>>the URL-rewriting stuff stays intact.
>>Is there in fact, a better way to do this? I've heard of something called
>>the Validation Framework, which works clientside. Are there any tutorials
>>on using it?
>>
>>__________________________________________________
>>Do You Yahoo!?
>>HotJobs - Search Thousands of New Jobs
>>http://www.hotjobs.com
>>-- To unsubscribe, e-mail:
>><ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Passing Struts parameters to JavaScript functions.
Posted by ajTreece <aj...@sun.com>.
Ray....
Don't pass the value to Javascript. Put the value of "id" in a hidden field in
the form then Javascript can get the value via
document.formName.hiddenFiledName.value.
Later, aj
Ray wrote:
> Hi there ... :-)
>
> I was hoping someone could help me with a validation problem.
>
> I'm trying to build a simple page that deletes an item from a database,
> when the user clicks on the "delete" link.
>
> Before going on to delete the item though, I need to ask the user if
> she's sure that she wants to delete the item.
>
> I thought the easiest way to do this, was a JavaScript call that would
> display a dialog:
>
> <html:link onclick="askDelete(<bean:write name="myCollectionElement"
> property="id"/>)">delete</html:link>
>
> I'm trying to pass the bean value to the askDelete function, but the
> syntax is shafted. How do I go about doing this? My next problem would
> be calling the deleteItem.do method from Javascript, whilst making sure
> that the URL-rewriting stuff stays intact.
>
> Is there in fact, a better way to do this? I've heard of something
> called the Validation Framework, which works clientside. Are there any
> tutorials on using it?
>
>
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>