Hi Dave,
targets=formResult in s:aj is unnecessary in my case. Simply
removing it solved the problem.
Thanks!
- Mounir
Am 29.02.2012 00:50, schrieb Dave Newton:
You update the div with the same jsp as the form, so you're adding the page
to itself.
d.
(pardon brevity and typos, on cell)
On Feb 28, 2012 6:44 PM, Mounir Benzidm...@meetingmasters.de wrote:
Here's a simple enough example of how to use thesj:a tag available in
the struts2-jquery plugin (v 3.2.1)
http://www.weinfreund.de/**struts2-jquery-showcase/index.**actionhttp://www.weinfreund.de/struts2-jquery-showcase/index.action
Well what I get though is somehow mysterious (to me).
The first time when I call the action [1] given by its URL
http://localhost:8080/myApp/**test/mehttp://localhost:8080/myApp/test/me
I get the correct server response, that is
- a line saying Echo: Hello me!
- underneath it a textfield containig the phrase Hello me !
- followed by a submit button
This is what it looks like:
Before: http://i40.tinypic.com/vf8782.**jpghttp://i40.tinypic.com/vf8782.jpg
Nice.
But after I submit the form the textfield and the submit button get
somehow mysteriously duplicated! (but not the Echo:... textline)
So there's still the initial textfield with the updated Hello +
whatever-you-typed-in phrase but yet another textfield and yet another
submit button.
The only difference I can tell between the initial and the duplicated
textfield is that the latter never gets a refresh.
It always contains the initial Hello me ! phrase.
This is how it looks like after the submit:
After: http://i41.tinypic.com/2ji44j.**jpghttp://i41.tinypic.com/2ji44j.jpg
Maybe someone can tell what I'm missing here.
Thanks!
[1] http://pastebin.com/Wq0Ek1H4http://pastebin.com/Wq0Ek1H4**(Action
class)
[2] http://pastebin.com/6yF2xwu4 (jsp)
--**--**
--**--**
--**--
[1] ACTION class
package xxx.actions.yyy;
import org.apache.log4j.Logger;
import org.apache.struts2.convention.**annotation.Action;
import org.apache.struts2.convention.**annotation.Actions;
import org.apache.struts2.convention.**annotation.Namespace;
import org.apache.struts2.convention.**annotation.Result;
import com.opensymphony.xwork2.**ActionSupport;
@Namespace(/test)
public class HelloWorldAction extends ActionSupport {
public String getYourName() {return yourName; }
public void setYourName(String value) {this.yourName = value;}
@Actions({
@Action(value={yourName}, results={@Result(location =
test.jsp)}),
@Action(value=put, results={@Result(location = test.jsp)})
})
public String execute() {
yourName = Hello + yourName + !;
logger.debug(execute: + yourName);
return SUCCESS;
}
private static final long serialVersionUID = 1L;
private String yourName;
private static Logger logger = Logger.getLogger(**
HelloWorldAction.class);
}
[2] (jsp)
--**--**
--**
%@ taglib prefix=s uri=/struts-tags %
%@ taglib prefix=sj uri=/struts-jquery-tags%
html
head
sj:head/
/head
body
div id=formResult
pEcho : ${yourName}/p
/div
s:form id=form action=put
s:textfield id=echo name=yourName/
/s:form
sj:a
id=ajaxformlink
formIds=form
targets=formResult
indicator=indicator
button=true
buttonIcon=ui-icon-gear
Submit form here
/sj:a
img id=indicator src=images/indicator.gif alt=Loading...
style=display:none/
/body
/html
--
Mounir Benzid
Systementwickler / EDV
meetingmasters.de
meetings meisterhaft managen
· Unabhängige Vermittlung von Tagungshotels
· Online-Hotelreservierungssystem zur Integration in die Veranstaltungs-Webseite
· Webbasiertes Veranstaltungs- und Teilnehmermanagement
· E-Procurement für den Tagungshoteleinkauf
· Webbasierte Anfrage und Verhandlung von Firmenraten
Max-Planck-Straße 22
D-54296 Trier
fon +49 (0)651-145789-38
fax +49 (0)651-145789-20
www.meetingmasters.de
m...@meetingmasters.de
-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org