You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Akins <an...@gmail.com> on 2011/02/17 23:08:33 UTC

Help with JQuery plugin

I'm trying to implement a modal dialog in a Struts2 application.

I found the struts2-jquery-plugin.

What I'm not sure about is how to implement a dialog that contains a
form.  I'm trying to implement a feature to edit the value in a page
by displaying the dialog with a <s:form/> and submitting that form to
an action as the dialog is closed.

The examples in the struts-jquery-plugin wiki don't seem to cover this
case; though I've been fighting this (along with some other attempts
using SimpleModal) for a day now and am hoping someone can point me in
the right direction.

Thanks.



-- 
Greg Akins
http://twitter.com/akinsgre

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Help with JQuery plugin

Posted by Martin Gainty <mg...@hotmail.com>.
Hello Angry Gregg

download struts2-jquery-plugin from the google repository
http://code.google.com/p/struts2-jquery/

Be aware that the object default persistence store is HSQL (Hypersonic)
I have retasked the configuration to implement mysql-5.1.25
also be sure to hook in 2.4.2 lucene-core as child dependency

I am sure you will be impressed with the user-friendly RIA interface!

give a shout if you need any help,
Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> From: vitordemario@gmail.com
> Date: Thu, 17 Feb 2011 20:15:47 -0200
> Subject: Re: Help with JQuery plugin
> To: user@struts.apache.org; angrygreg@gmail.com
> 
> I've had a good experience regarding jQuery and modal dialogs using
> Impromptu: http://trentrichardson.com/Impromptu/index.php
> 
> <http://trentrichardson.com/Impromptu/index.php>It covers the use of forms
> inside a dialog, but I don't know how it relates to the
> struts2-jquery-plugin, I've never used it.
> 
> On Thu, Feb 17, 2011 at 8:08 PM, Greg Akins <an...@gmail.com> wrote:
> 
> > I'm trying to implement a modal dialog in a Struts2 application.
> >
> > I found the struts2-jquery-plugin.
> >
> > What I'm not sure about is how to implement a dialog that contains a
> > form.  I'm trying to implement a feature to edit the value in a page
> > by displaying the dialog with a <s:form/> and submitting that form to
> > an action as the dialog is closed.
> >
> > The examples in the struts-jquery-plugin wiki don't seem to cover this
> > case; though I've been fighting this (along with some other attempts
> > using SimpleModal) for a day now and am hoping someone can point me in
> > the right direction.
> >
> > Thanks.
> >
> >
> >
> > --
> > Greg Akins
> > http://twitter.com/akinsgre
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
 		 	   		  

Re: Help with JQuery plugin

Posted by Vitor De Mario <vi...@gmail.com>.
I've had a good experience regarding jQuery and modal dialogs using
Impromptu: http://trentrichardson.com/Impromptu/index.php

<http://trentrichardson.com/Impromptu/index.php>It covers the use of forms
inside a dialog, but I don't know how it relates to the
struts2-jquery-plugin, I've never used it.

On Thu, Feb 17, 2011 at 8:08 PM, Greg Akins <an...@gmail.com> wrote:

> I'm trying to implement a modal dialog in a Struts2 application.
>
> I found the struts2-jquery-plugin.
>
> What I'm not sure about is how to implement a dialog that contains a
> form.  I'm trying to implement a feature to edit the value in a page
> by displaying the dialog with a <s:form/> and submitting that form to
> an action as the dialog is closed.
>
> The examples in the struts-jquery-plugin wiki don't seem to cover this
> case; though I've been fighting this (along with some other attempts
> using SimpleModal) for a day now and am hoping someone can point me in
> the right direction.
>
> Thanks.
>
>
>
> --
> Greg Akins
> http://twitter.com/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Help with JQuery plugin

Posted by "CRANFORD, CHRIS" <Ch...@setech.com>.
Greg -

In order to open the dialog, you simply need to initially define your
dialog in your JSP.  I prefer to use dynamic invocation of my dialogs,
especially in the scenario where I need to pass dynamic values such as
URL parameters to the dialog in the event I am editing multiple records,
say in a table or grid.

1. Define your dialog in your JSP like:

<sj:dialog id="myDialog" autOpen="false" modal="true" width="525"
  position="[150,250]" onCloseTopics="myDialogClosed" 
  onCompleteTopics="myDialogOpened" resizable="false" />

I have my dialog defined to not auto open, be modal when invoked, and to
be positioned at a given location and to fire a few topics based on some
dialog events.  

2. Bind a click event to something to invoke your dialog

jQuery(document).ready(function() {
  $("#myid").click(function(event,data) {
    var url = "build my url here";
    $("#myDialog").load(url, function() { 
      $(this).dialog("open");
    });
    return false;
  });
});

When the DOM is ready, I tie a click event to a DOM element.  I build my
URL when the user clicks the element and pass that URL to my dialog to
be loaded.  When the dialog has loaded the URL content, I then invoke
the dialog open to render the screen.  If your content you need to show
can be built inside the <sj:dialog/> tags when you initially render the
page and doesn't need to be remote/dynamic called, you can do that and
simply call change the above function to:

jQuery(document).ready(function() {
  $("#myid").click(function(event,data) {
    $("#myDialog").dialog("open");
  });
});

3. Setup your form and tie a click event to your submit button

When you click the button, you make an AJAX call to the server to submit
your data.  If you get a successful result, you can then call
$("#myDialog").dialog("close") to close the dialog window and if you get
an error, you can then overlay another dialog to display the error or
set a div in your form you rendered in the dialog with the error
message.

Inevitability it boils down to a number of topic publish/subscribe
events you need to handle.
Any questions, hit me up off list.

Chris


> -----Original Message-----
> From: Greg Akins [mailto:angrygreg@gmail.com]
> Sent: Thursday, February 17, 2011 4:09 PM
> To: user@struts.apache.org
> Subject: Help with JQuery plugin
> 
> I'm trying to implement a modal dialog in a Struts2 application.
> 
> I found the struts2-jquery-plugin.
> 
> What I'm not sure about is how to implement a dialog that contains a
> form.  I'm trying to implement a feature to edit the value in a page
> by displaying the dialog with a <s:form/> and submitting that form to
> an action as the dialog is closed.
> 
> The examples in the struts-jquery-plugin wiki don't seem to cover this
> case; though I've been fighting this (along with some other attempts
> using SimpleModal) for a day now and am hoping someone can point me in
> the right direction.
> 
> Thanks.
> 
> 
> 
> --
> Greg Akins
> http://twitter.com/akinsgre
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Help with JQuery plugin

Posted by Dave Newton <da...@gmail.com>.
Why not just use plain jquery?

Dave
 On Feb 17, 2011 5:09 PM, "Greg Akins" <an...@gmail.com> wrote:
> I'm trying to implement a modal dialog in a Struts2 application.
>
> I found the struts2-jquery-plugin.
>
> What I'm not sure about is how to implement a dialog that contains a
> form. I'm trying to implement a feature to edit the value in a page
> by displaying the dialog with a <s:form/> and submitting that form to
> an action as the dialog is closed.
>
> The examples in the struts-jquery-plugin wiki don't seem to cover this
> case; though I've been fighting this (along with some other attempts
> using SimpleModal) for a day now and am hoping someone can point me in
> the right direction.
>
> Thanks.
>
>
>
> --
> Greg Akins
> http://twitter.com/akinsgre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: Help with JQuery plugin

Posted by Johannes Geppert <jo...@web.de>.
1.) can you please give a code example?

2.) do you have any output in your browser javascript console?

Johannes


akinsgre wrote:
> 
> On Fri, Feb 18, 2011 at 3:40 AM, Johannes Geppert <jo...@web.de> wrote:
>>
>> what exactly is the problem?
>>
>> i never have a problem with forms inside of the dialog.
>>
> The example you posted doesn't work for me.. I'm looking through the
> wiki and not finding anything similar
> 
> When I try what you suggested the form appears on the page and not in
> the dialog.
> 
>> http://code.google.com/p/struts2-jquery/wiki/DialogTag
>>
>> <%@ taglib prefix="s" uri="/struts-tags"%>
>> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
>> <html>
>>  <head>
>>    <sj:head />
>>  </head>
>>  <body>
>>    <sj:dialog id="modalDialog" title="Modal Dialog"  modal="true">
>>     <s:form>
>>       <s:textarea .... />
>>       <s:submit />
>>     </s:form>
>>   </sj:dialog>
>>  </body>
>> </html>
>>
>> Johannes
>>
>>
>> akinsgre wrote:
>>>
>>> I'm trying to implement a modal dialog in a Struts2 application.
>>>
>>> I found the struts2-jquery-plugin.
>>>
>>> What I'm not sure about is how to implement a dialog that contains a
>>> form.  I'm trying to implement a feature to edit the value in a page
>>> by displaying the dialog with a <s:form/> and submitting that form to
>>> an action as the dialog is closed.
>>>
>>> The examples in the struts-jquery-plugin wiki don't seem to cover this
>>> case; though I've been fighting this (along with some other attempts
>>> using SimpleModal) for a day now and am hoping someone can point me in
>>> the right direction.
>>>
>>> Thanks.
>>>
>>>
>>>
>>> --
>>> Greg Akins
>>> http://twitter.com/akinsgre
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>>
>>
>>
>> -----
>> ---
>> web: http://www.jgeppert.com
>> twitter: http://twitter.com/jogep
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Help-with-JQuery-plugin-tp30954067p30956812.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 
> 
> -- 
> Greg Akins
> http://twitter.com/akinsgre
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


-----
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

-- 
View this message in context: http://old.nabble.com/Help-with-JQuery-plugin-tp30954067p30959876.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Help with JQuery plugin

Posted by Greg Akins <an...@gmail.com>.
On Fri, Feb 18, 2011 at 3:40 AM, Johannes Geppert <jo...@web.de> wrote:
>
> what exactly is the problem?
>
> i never have a problem with forms inside of the dialog.
>
The example you posted doesn't work for me.. I'm looking through the
wiki and not finding anything similar

When I try what you suggested the form appears on the page and not in
the dialog.

> http://code.google.com/p/struts2-jquery/wiki/DialogTag
>
> <%@ taglib prefix="s" uri="/struts-tags"%>
> <%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
> <html>
>  <head>
>    <sj:head />
>  </head>
>  <body>
>    <sj:dialog id="modalDialog" title="Modal Dialog"  modal="true">
>     <s:form>
>       <s:textarea .... />
>       <s:submit />
>     </s:form>
>   </sj:dialog>
>  </body>
> </html>
>
> Johannes
>
>
> akinsgre wrote:
>>
>> I'm trying to implement a modal dialog in a Struts2 application.
>>
>> I found the struts2-jquery-plugin.
>>
>> What I'm not sure about is how to implement a dialog that contains a
>> form.  I'm trying to implement a feature to edit the value in a page
>> by displaying the dialog with a <s:form/> and submitting that form to
>> an action as the dialog is closed.
>>
>> The examples in the struts-jquery-plugin wiki don't seem to cover this
>> case; though I've been fighting this (along with some other attempts
>> using SimpleModal) for a day now and am hoping someone can point me in
>> the right direction.
>>
>> Thanks.
>>
>>
>>
>> --
>> Greg Akins
>> http://twitter.com/akinsgre
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>
>
>
> -----
> ---
> web: http://www.jgeppert.com
> twitter: http://twitter.com/jogep
>
> --
> View this message in context: http://old.nabble.com/Help-with-JQuery-plugin-tp30954067p30956812.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Greg Akins
http://twitter.com/akinsgre

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Help with JQuery plugin

Posted by Johannes Geppert <jo...@web.de>.
what exactly is the problem?

i never have a problem with forms inside of the dialog.

http://code.google.com/p/struts2-jquery/wiki/DialogTag

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
    <sj:head />
  </head>
  <body>
    <sj:dialog id="modalDialog" title="Modal Dialog"  modal="true">
     <s:form>
       <s:textarea .... />
       <s:submit />
     </s:form>
   </sj:dialog>
  </body>
</html>

Johannes


akinsgre wrote:
> 
> I'm trying to implement a modal dialog in a Struts2 application.
> 
> I found the struts2-jquery-plugin.
> 
> What I'm not sure about is how to implement a dialog that contains a
> form.  I'm trying to implement a feature to edit the value in a page
> by displaying the dialog with a <s:form/> and submitting that form to
> an action as the dialog is closed.
> 
> The examples in the struts-jquery-plugin wiki don't seem to cover this
> case; though I've been fighting this (along with some other attempts
> using SimpleModal) for a day now and am hoping someone can point me in
> the right direction.
> 
> Thanks.
> 
> 
> 
> -- 
> Greg Akins
> http://twitter.com/akinsgre
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 


-----
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

-- 
View this message in context: http://old.nabble.com/Help-with-JQuery-plugin-tp30954067p30956812.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org