You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ignacio Enriquez <na...@gmail.com> on 2009/09/08 04:00:33 UTC

how to get the result of a form inside of a sx:tabbedpanel div?

Hi.
How can I get the result of a form that is originally inside a
sx:tabbedpanel sx:div inside of the same sx:div?

probably the answer is ajax calls, but I don't know ajax calls and I
am in kind of a hurry. (So no time to learn very difficult ajax stuff)

I would like to have the results inside the same sx:div and not a
completely new jsp reloaded.

currently I have something like :
<sx:tabbedpanel id="mainContainer" >
	<sx:div label="Upload Files"
			href="ShowFileUpload.action"
			closable="false">
			loading ShowFileUploadView.jsp
	</sx:div>
        <sx:div label="View Files"
			cssStyle="height:200px;margin:20%;"
			href="ShowFiles.action">
			
	</sx:div>
</sx:tabbedpanel>

when click in the submit button (DoUpload.action) inside
ShowFileUploadView.jsp I have the complety page reloaded which is
obvious since I have struts.xml like  this.

		<action name="DoUpload" class="userPackage.UploadAction">
			<result name="input">/jsp/ShowFileUploadView.jsp</result>
			<result name="error">/jsp/ShowFileUploadView.jsp</result>
			<result>/jsp/FileUploadSuccessView.jsp</result>
		</action>


How can change my jsp or my struts.xml in order to have my result
inside the original tab ?
Thanks

Ignacio.

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


Re: how to get the result of a form inside of a sx:tabbedpanel div?

Posted by Ignacio Enriquez <na...@gmail.com>.
I could run the project with maven and I am looking here
http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html
and trying to something similar.

I show a list of files (each one with a id) in a table.
also each one has a EDIT button, which is supposed to show more
detailed info and capabilties to edit it.
all this edit stuff should be shown in a div

But When I press the button edit I have a UNDEFINED message in the div.
What I am doing wrong?
I have confirmed that I am get correct data into my action class so my
guess is that the mistake should be in struts.xml? or maybe inside
jsp?

This is part of my jsp, struts.xml, and the java class used.
/****************************************************************************/
UserFilesView.jsp
<s:url action="ShowSingleFile" id="descrsUrl"/>

    <div style="width: 500px;border-style: solid">
		<div style="text-align: right;">
    		<sx:a notifyTopics="/refresh">Refresh</sx:a>
    	</div>
    	<sx:div id="singleFileDiv" href="%{descrsUrl}"
loadingText="Loading..." listenTopics="/refresh"/>
    </div>

<table border="1">
    <tr class="headRow"><td>Name</td><td>Edit</td></tr>
    <s:iterator value="filesList" status="status">

        <tr>
       	<td><s:property value="name"/></td>
	<td>
		<s:url id="EditSingleFileURL" action="EditSingleFile">
		<s:param name="id" value="id" />
		</s:url>
		<sx:a href="%{EditSingleFileURL}" targets="singleFileDiv">Edit</sx:a>
	</td>
	</tr>

    </s:iterator>
</table>
/****************************************************************************/
from struts.xml :
<action name="ShowSingleFile" class="userPackage.ShowFileDetailsAction">
        	<result>/jsp/UserFilesView.jsp</result>
   </action>
   <action name="EditSingleFile"
class="userPackage.ShowFileDetailsAction" method="edit">
        	<result>/jsp/FileDetail.jsp</result>
   </action>
/****************************************************************************/
ShowFileDetailsAction.java:
package userPackage;
import com.opensymphony.xwork2.ActionSupport;
public class ShowFileDetailsAction extends ActionSupport{
private String something;
	private int id;
	public String execute(){
		System.out.println("execute from ShowFileDetailsAction");
		setSomething("A String");
		return SUCCESS;     }
	public String edit(){
		System.out.println("edit from ShowFileDetailsAction");
		setSomething("A String 2");
		System.out.println("id : " + getId());
		return SUCCESS;	}
	public String getSomething(){return something;}
	public void setSomething(String s){this.something = s;}
	public int getId() {return id;}
	public void setId(int id) {this.id = id;}

/****************************************************************************/
from .jsp (the file I want to render inside the div)

<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<html><head></head><body>
	File Id : <s:property value="id"/>
	Something string value: <s:property value="something"/>
</body></html>
/****************************************************************************/
Help please!



On Wed, Sep 9, 2009 at 1:46 AM, Martin Gainty<mg...@hotmail.com> wrote:
> see if the project has suppplied a pom.xml
>
> mvn -e compiler:compiler will compile
>
> mvn -e install:install-file will install
> mvn -e deploy:deploy-file will deploy to repository
>
> to use maven in eclipse you will need install the eclipse-maven plugin
> http://maven.apache.org/guides/mini/guide-ide-eclipse.html
>
> Buena Suerte
> 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.
>
>
>
>
>> Date: Wed, 9 Sep 2009 00:54:12 +0900
>> Subject: Re: how to get the result of a form inside of a sx:tabbedpanel
>> div?
>> From: nacho4d@gmail.com
>> To: user@struts.apache.org
>>
>> Thanks
>> Dave
>> I actually found a very useful sample project from here
>> http://cwiki.apache.org/S2WIKI/struts-2-spring-2-jpa-ajax.html or
>> http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html
>>
>> There, the apache people seems to be using s:a tag "targets" attribute
>> to put the result in the same div. (see list.jsp and index.jsp)
>>
>> But for some reason I am not able to compile this project. (in eclipse)
>> I suppose because is old. Or maybe the transaction library jar was not
>> the correct one.
>> I am still trying.
>>
>> Regards
>>
>> BTW: I have not tried StrutsBuilder yet, but I wish it gets popular. I
>> never liked that much Eclipse and maven in windows xp cmd is so
>> frustrating!
>>
>> On Tue, Sep 8, 2009 at 11:06 PM, Dave Newton<ne...@yahoo.com> wrote:
>> > Ignacio Enriquez wrote:
>> >>
>> >> Martin, Could you be more specific?
>> >
>> > *sigh*
>> >
>> >> I think that what I need is not update is actually reload a new
>> >> content inside the div. (this content is not static, it depends
>> >
>> >> on the initial form input)
>> >
>> > You don't show the form at all. Did you try using the form submit that
>> > uses
>> > the "targets" attribute to define a div (or divs) where the results of
>> > the
>> > submission should be?
>> >
>> >> but I don't know ajax calls and I am in kind of a hurry. (So no time
>> >> to learn very difficult ajax stuff)
>> >
>> > There are no shortcuts.
>> >
>> > Dave
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >
>>
>>
>>
>> --
>> ________________________________
>> 慶應義塾大学大学院 理工学研究科
>> 開放環境科学専攻 斎藤英雄研究室
>> 修士1年 Guillermo Ignacio Enriquez G.
>> e-mail :  nacho4d@hvrl.ics.keio.ac.jp
>> ________________________________
>> _____________________________________________
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ________________________________
> Hotmail® is up to 70% faster. Now good news travels really fast. Try it now.



-- 
________________________________
慶應義塾大学大学院 理工学研究科
開放環境科学専攻 斎藤英雄研究室
修士1年 Guillermo Ignacio Enriquez G.
e-mail :  nacho4d@hvrl.ics.keio.ac.jp
________________________________
_____________________________________________

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


Re: how to get the result of a form inside of a sx:tabbedpanel div?

Posted by Ignacio Enriquez <na...@gmail.com>.
Thanks
Dave
I actually found a very useful sample project from here
http://cwiki.apache.org/S2WIKI/struts-2-spring-2-jpa-ajax.html or
http://struts.apache.org/2.0.14/docs/struts-2-spring-2-jpa-ajax.html

There, the apache people seems to be using s:a tag "targets" attribute
to put the result in the same div. (see list.jsp and index.jsp)

But for some reason I am not able to compile this project. (in eclipse)
I suppose because is old. Or maybe the transaction library jar was not
the correct one.
I am still trying.

Regards

BTW: I have not tried StrutsBuilder yet, but I wish it gets popular. I
never liked that much Eclipse and maven in windows xp cmd is so
frustrating!

On Tue, Sep 8, 2009 at 11:06 PM, Dave Newton<ne...@yahoo.com> wrote:
> Ignacio Enriquez wrote:
>>
>> Martin, Could you be more specific?
>
> *sigh*
>
>> I think that what I need is not update is actually reload a new
>> content inside the div. (this content is not static, it depends
>
>> on the initial form input)
>
> You don't show the form at all. Did you try using the form submit that uses
> the "targets" attribute to define a div (or divs) where the results of the
> submission should be?
>
>> but I don't know ajax calls and I am in kind of a hurry. (So no time
>> to learn very difficult ajax stuff)
>
> There are no shortcuts.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
________________________________
慶應義塾大学大学院 理工学研究科
開放環境科学専攻 斎藤英雄研究室
修士1年 Guillermo Ignacio Enriquez G.
e-mail :  nacho4d@hvrl.ics.keio.ac.jp
________________________________
_____________________________________________

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


Re: how to get the result of a form inside of a sx:tabbedpanel div?

Posted by Dave Newton <ne...@yahoo.com>.
Ignacio Enriquez wrote:
> Martin, Could you be more specific?

*sigh*

> I think that what I need is not update is actually reload a new
> content inside the div. (this content is not static, it depends 
 > on the initial form input)

You don't show the form at all. Did you try using the form submit that 
uses the "targets" attribute to define a div (or divs) where the results 
of the submission should be?

 > but I don't know ajax calls and I am in kind of a hurry. (So no time
 > to learn very difficult ajax stuff)

There are no shortcuts.

Dave


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


RE: how to get the result of a form inside of a sx:tabbedpanel div?

Posted by Ignacio Enriquez <na...@gmail.com>.
Martin, Could you be more specific?
I think that what I need is not update is actually reload a new
content inside the div.
(this content is not static, it depends on the initial form input)

I am looking for some info but all I found is for struts1 and is
old.... not really useful anymore in Struts 2.1.6

From: Martin Gainty <mg...@hotmail.com>
Date: Tue, Sep 8, 2009 at 11:31 AM
Subject: RE: how to get the result of a form inside of a sx:tabbedpanel div?
To: nacho4d@gmail.com



<sx:div href="%{#url}" updateFreq="2000" indicator="indicator">
  Initial Content
</sx:div>

"the initial content will me updated to URL contents"

el contenido inicial será puesto al día por el resultado contento del
URL definido tan poniendo en
http://www.google.com/#hl=en&source=hp&q=struts&fp=3aa7f458acaa2672

volverá todas las entradas de google para que los puntales substituyan
el contenido inicial para dentro de div

http://struts.apache.org/2.0.14/docs/dojo-div.html
Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und
Vertraulichkeitanmerkung/Note de déni et de confidentialité

Ez az üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük,
hogy jelentse azt nekünk vissza. Semmiféle továbbítása vagy
másolatának készítése nem megengedett.  Ez az üzenet csak ismeret
cserét szolgál és semmiféle jogi alkalmazhatósága sincs.  Mivel az
electronikus üzenetek könnyen megváltoztathatóak, ezért minket semmi
felelöség nem terhelhet ezen üzenet tartalma miatt.

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.




> Date: Tue, 8 Sep 2009 11:00:33 +0900
> Subject: how to get the result of a form inside of a sx:tabbedpanel div?
> From: nacho4d@gmail.com
> To: user@struts.apache.org
>
> Hi.
> How can I get the result of a form that is originally inside a
> sx:tabbedpanel sx:div inside of the same sx:div?
>
> probably the answer is ajax calls, but I don't know ajax calls and I
> am in kind of a hurry. (So no time to learn very difficult ajax stuff)
>
> I would like to have the results inside the same sx:div and not a
> completely new jsp reloaded.
>
> currently I have something like :
> <sx:tabbedpanel id="mainContainer" >
> <sx:div label="Upload Files"
> href="ShowFileUpload.action"
> closable="false">
> loading ShowFileUploadView.jsp
> </sx:div>
> <sx:div label="View Files"
> cssStyle="height:200px;margin:20%;"
> href="ShowFiles.action">
>
> </sx:div>
> </sx:tabbedpanel>
>
> when click in the submit button (DoUpload.action) inside
> ShowFileUploadView.jsp I have the complety page reloaded which is
> obvious since I have struts.xml like this.
>
> <action name="DoUpload" class="userPackage.UploadAction">
> <result name="input">/jsp/ShowFileUploadView.jsp</result>
> <result name="error">/jsp/ShowFileUploadView.jsp</result>
> <result>/jsp/FileUploadSuccessView.jsp</result>
> </action>
>
>
> How can change my jsp or my struts.xml in order to have my result
> inside the original tab ?
> Thanks
>
> Ignacio.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

________________________________
With Windows Live, you can organize, edit, and share your photos. Click here.


-- 
________________________________
慶應義塾大学大学院 理工学研究科
開放環境科学専攻 斎藤英雄研究室
修士1年 Guillermo Ignacio Enriquez G.
e-mail :  nacho4d@hvrl.ics.keio.ac.jp
________________________________
_____________________________________________

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