You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eugen Stoianovici <eu...@gmail.com> on 2007/08/17 16:24:09 UTC
[S2][Tabbed panel] posting data from one tab
i have a tabbedpanel which displays several tabs one of which contains a
form. How do i turn back to that tab after i've pressed the submit
button on that form?
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2][Tabbed panel] posting data from one tab
Posted by Alvaro Sanchez-Mariscal <al...@gmail.com>.
If the URL changes, then a normal http post is being fired, instead of
an ajax request.
What's your struts.ui.theme in struts.properties? If it is not "ajax",
try using theme="ajax" in the s:form and in the s:submit tags.
Did you included the s:head tag (http://struts.apache.org/2.x/docs/head.html)?
On 8/19/07, Eugen Stoianovici <eu...@gmail.com> wrote:
> Alvaro Sanchez-Mariscal wrote:
> > Try prepending an slash, ie, "/addProduct". Without it, it also didn't
> > worked to me.
> >
> > Also, what happens exactly? Javascript errors? Have you tried
> > inspecting it with firebug?
> >
> > Alvaro.
> >
> > On 8/19/07, Eugen Stoianovici <eu...@gmail.com> wrote:
> >
> I've tried it with /addProduct and i've also moved the products pane to
> to the addpo.jsp page (so now, it isn't a remote pane). There's nothing
> wrong happening, it just takes me to the first tab after i press the add
> button. I mean: the data gets posted, everything is in place...it's just
> that it displays the first tab instead of the 3th.
> The url changes from addpo.jsp to addproduct.action. Is this a problem?
>
> Here's the code:
> action mapping:
> <action name="addproduct" class="addPoAction" method="addProduct">
> <result>/popages/addpo.jsp</result>
> <result name="input">/popages/addpo.jsp</result>
> </action>
>
> The jsp:
>
> <!-- addpo.jsp-->
> <s:tabbedPanel id="tabbedpanel">
> <s:div id="vendor" label="Vendor" href="%{#vendor_tab}" theme="ajax" />
> <s:div id="shipment" label="Shipment" href="%{#shipment_tab}"
> theme="ajax" />
> <!-- the form-->
> <s:div id="products" label="Products"
> theme="ajax" listenTopics="/addProduct">
> <div style="border-style: solid">
> <p>Add new product to list</p>
> <s:form action="addproduct" validate="true">
> <s:textfield id="description" name="product.description"
> label="Description" />
> <s:textfield id="quantity" name="product.quantity"
> label="Quantity" />
> <s:textfield id="taxrate" name="product.taxRate" label="Tax
> Rate" />
> <s:textfield id="unitprice" name="product.unitPrice"
> label="Unit Price" />
> <s:submit value="Add" notifyTopics="/addProduct" />
> </s:form></div>
> </s:div>
> </s:tabbedPanel>
>
> jsp warnings: (there are no errors):
>
> Warning: Unknown property '_zoom'. Declaration dropped.
> Source File: http://localhost:8080/POPSWeb/addproduct.action
> Line: 7
>
> Warning: Unknown property '_margin-bottom'. Declaration dropped.
> Source File: http://localhost:8080/POPSWeb/addproduct.action
> Line: 24
>
> Warning: Error in parsing value for property 'display'. Declaration
> dropped.
> Source File: http://localhost:8080/POPSWeb/addproduct.action
> Line: 47
>
> Warning: Expected ':' but found 'none'. Declaration dropped.
> Source File: http://localhost:8080/POPSWeb/addproduct.action
> Line: 0
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Alvaro Sanchez-Mariscal Arnaiz
Java EE Architect & Instructor
alvaro.sanchezmariscal@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2][Tabbed panel] posting data from one tab
Posted by Eugen Stoianovici <eu...@gmail.com>.
Alvaro Sanchez-Mariscal wrote:
> Try prepending an slash, ie, "/addProduct". Without it, it also didn't
> worked to me.
>
> Also, what happens exactly? Javascript errors? Have you tried
> inspecting it with firebug?
>
> Alvaro.
>
> On 8/19/07, Eugen Stoianovici <eu...@gmail.com> wrote:
>
I've tried it with /addProduct and i've also moved the products pane to
to the addpo.jsp page (so now, it isn't a remote pane). There's nothing
wrong happening, it just takes me to the first tab after i press the add
button. I mean: the data gets posted, everything is in place...it's just
that it displays the first tab instead of the 3th.
The url changes from addpo.jsp to addproduct.action. Is this a problem?
Here's the code:
action mapping:
<action name="addproduct" class="addPoAction" method="addProduct">
<result>/popages/addpo.jsp</result>
<result name="input">/popages/addpo.jsp</result>
</action>
The jsp:
<!-- addpo.jsp-->
<s:tabbedPanel id="tabbedpanel">
<s:div id="vendor" label="Vendor" href="%{#vendor_tab}" theme="ajax" />
<s:div id="shipment" label="Shipment" href="%{#shipment_tab}"
theme="ajax" />
<!-- the form-->
<s:div id="products" label="Products"
theme="ajax" listenTopics="/addProduct">
<div style="border-style: solid">
<p>Add new product to list</p>
<s:form action="addproduct" validate="true">
<s:textfield id="description" name="product.description"
label="Description" />
<s:textfield id="quantity" name="product.quantity"
label="Quantity" />
<s:textfield id="taxrate" name="product.taxRate" label="Tax
Rate" />
<s:textfield id="unitprice" name="product.unitPrice"
label="Unit Price" />
<s:submit value="Add" notifyTopics="/addProduct" />
</s:form></div>
</s:div>
</s:tabbedPanel>
jsp warnings: (there are no errors):
Warning: Unknown property '_zoom'. Declaration dropped.
Source File: http://localhost:8080/POPSWeb/addproduct.action
Line: 7
Warning: Unknown property '_margin-bottom'. Declaration dropped.
Source File: http://localhost:8080/POPSWeb/addproduct.action
Line: 24
Warning: Error in parsing value for property 'display'. Declaration
dropped.
Source File: http://localhost:8080/POPSWeb/addproduct.action
Line: 47
Warning: Expected ':' but found 'none'. Declaration dropped.
Source File: http://localhost:8080/POPSWeb/addproduct.action
Line: 0
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2][Tabbed panel] posting data from one tab
Posted by Alvaro Sanchez-Mariscal <al...@salenda.es>.
Try prepending an slash, ie, "/addProduct". Without it, it also didn't
worked to me.
Also, what happens exactly? Javascript errors? Have you tried
inspecting it with firebug?
Alvaro.
On 8/19/07, Eugen Stoianovici <eu...@gmail.com> wrote:
> Alvaro Sanchez-Mariscal wrote:
> > Hi,
> >
> > I've done the same using topics:
> >
> > 1) Publish on a topic after the request is executed (eg,
> > notifyTopics="/submit" in the s:submit).
> >
> > 2) Register to the same topic in the s:div corresponding to the tab
> > (eg, listenTopics="/submit" in the s:div).
> >
> > Alvaro.
> >
> >
> Can you give me an example? what i did was:
>
> the master file: (the one where i define the tabbedpanel)
> <s:tabbedPanel id="tabbedpanel">
> <s:div id="vendor" label="Vendor" href="%{#vendor_tab}"
> theme="ajax" />
> <s:div id="shipment" label="Shipment" href="%{#shipment_tab}"
> theme="ajax" />
> <s:div id="products" label="Products" href="%{#products_tab}"
> theme="ajax" listenTopics="addProduct" />
> </s:tabbedPanel>
>
>
> the add product form:
>
> <s:form action="addproduct" validate="true">
> <s:textfield id="description" name="product.description"
> label="Description" />
> <s:textfield id="quantity" name="product.quantity" label="Quantity" />
> <s:textfield id="taxrate" name="product.taxRate" label="Tax Rate" />
> <s:textfield id="unitprice" name="product.unitPrice" label="Unit
> Price" />
> <s:submit value="Add" notifyTopics="addProduct" />
> </s:form>
>
>
> Now, is there anything else i need to do in my action class or in those
> two jsp's? Because it doesn't work like this :(
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
--
Alvaro Sanchez-Mariscal
Arquitecto de Software Java EE
Salenda - www.salenda.es
Avd. Rey Juan Carlos I, 92. 28916 - Leganés (Madrid).
T: 91 101 0607 ext. 301 / F: 91 101 0608
M: +34.647.94.44.30
E: alvaro.sanchez@salenda.es
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2][Tabbed panel] posting data from one tab
Posted by Eugen Stoianovici <eu...@gmail.com>.
Alvaro Sanchez-Mariscal wrote:
> Hi,
>
> I've done the same using topics:
>
> 1) Publish on a topic after the request is executed (eg,
> notifyTopics="/submit" in the s:submit).
>
> 2) Register to the same topic in the s:div corresponding to the tab
> (eg, listenTopics="/submit" in the s:div).
>
> Alvaro.
>
>
Can you give me an example? what i did was:
the master file: (the one where i define the tabbedpanel)
<s:tabbedPanel id="tabbedpanel">
<s:div id="vendor" label="Vendor" href="%{#vendor_tab}"
theme="ajax" />
<s:div id="shipment" label="Shipment" href="%{#shipment_tab}"
theme="ajax" />
<s:div id="products" label="Products" href="%{#products_tab}"
theme="ajax" listenTopics="addProduct" />
</s:tabbedPanel>
the add product form:
<s:form action="addproduct" validate="true">
<s:textfield id="description" name="product.description"
label="Description" />
<s:textfield id="quantity" name="product.quantity" label="Quantity" />
<s:textfield id="taxrate" name="product.taxRate" label="Tax Rate" />
<s:textfield id="unitprice" name="product.unitPrice" label="Unit
Price" />
<s:submit value="Add" notifyTopics="addProduct" />
</s:form>
Now, is there anything else i need to do in my action class or in those
two jsp's? Because it doesn't work like this :(
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [S2][Tabbed panel] posting data from one tab
Posted by Alvaro Sanchez-Mariscal <al...@salenda.es>.
Hi,
I've done the same using topics:
1) Publish on a topic after the request is executed (eg,
notifyTopics="/submit" in the s:submit).
2) Register to the same topic in the s:div corresponding to the tab
(eg, listenTopics="/submit" in the s:div).
Alvaro.
On 8/17/07, Clement, Steve <SC...@flyfrontier.com> wrote:
>
> You should be able to set the listenTopic attribute on the div for that
> panel, and then notify the topic (I think this is on the s:submit tag,
> but I could be mistaken). See
> http://struts.apache.org/2.0.9/docs/tag-reference.html for more details.
>
> This works if your theme "ajax".
>
> One thing I have found, however, is that if you use the rich text editor
> for a textarea, the content of that textarea does not submit for some
> reason. Other form controls submit fine.
>
> Steve Clement
> -----Original Message-----
> From: Eugen Stoianovici [mailto:eugen.stoianovici@gmail.com]
> Sent: Friday, August 17, 2007 8:24 AM
> To: Struts Users Mailing List
> Subject: [S2][Tabbed panel] posting data from one tab
>
> i have a tabbedpanel which displays several tabs one of which contains a
>
> form. How do i turn back to that tab after i've pressed the submit
> button on that form?
>
> ---------------------------------------------------------------------
> 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
>
>
--
Alvaro Sanchez-Mariscal
Arquitecto de Software Java EE
Salenda - www.salenda.es
Avd. Rey Juan Carlos I, 92. 28916 - Leganés (Madrid).
T: 91 101 0607 ext. 301 / F: 91 101 0608
M: +34.647.94.44.30
E: alvaro.sanchez@salenda.es
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: [S2][Tabbed panel] posting data from one tab
Posted by "Clement, Steve" <SC...@flyfrontier.com>.
You should be able to set the listenTopic attribute on the div for that
panel, and then notify the topic (I think this is on the s:submit tag,
but I could be mistaken). See
http://struts.apache.org/2.0.9/docs/tag-reference.html for more details.
This works if your theme "ajax".
One thing I have found, however, is that if you use the rich text editor
for a textarea, the content of that textarea does not submit for some
reason. Other form controls submit fine.
Steve Clement
-----Original Message-----
From: Eugen Stoianovici [mailto:eugen.stoianovici@gmail.com]
Sent: Friday, August 17, 2007 8:24 AM
To: Struts Users Mailing List
Subject: [S2][Tabbed panel] posting data from one tab
i have a tabbedpanel which displays several tabs one of which contains a
form. How do i turn back to that tab after i've pressed the submit
button on that form?
---------------------------------------------------------------------
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