Please explain how to handle ajax event in spring web flow.
For example if we have page code
<h:commandLink id="nextPageLink" value="More Results" action="next"/>
so we can use "next" in flow definition
<transition on="next">
But what about such evebts like
<p:accordionPanel>
<p:ajax event="tabChange" listener="#{myBean.onTabChange}" />
By primefaces tutorial it can be handled in MyBean in such way:
public void onChange(TabChangeEvent event)
{
Tab activeTab = event.getTab();
}
But how this event may be handled in Spring context?
Thank you
How to handle p:ajax event
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
If you have good understanding of spring webflow and Primefaces components (accordionPanel event="tabChange"), then it is best to merge the two concepts and see how you can make it work.
1. Try to get accordionPanel tabChange to meet your requirements without spring webflow.
2. Afterwards, try to merge or make use of spring webflow benefits.
3. You may want to consider p:wizard. From what I have read here in community forum, p:wizard is similar to p:tabView (and p:tabView and p:accordionPanel are similar). p:wizard has a way of 'flowing' through the tabchanges. I am writing based on assumption, personal experience of what a 'wizard' is/does, and what i have read here, when community users are discussing p:wizard.
I am not a user of spring webflow, so I cannot advise any further. Below, you will see my test/development environment details.
1. Try to get accordionPanel tabChange to meet your requirements without spring webflow.
2. Afterwards, try to merge or make use of spring webflow benefits.
3. You may want to consider p:wizard. From what I have read here in community forum, p:wizard is similar to p:tabView (and p:tabView and p:accordionPanel are similar). p:wizard has a way of 'flowing' through the tabchanges. I am writing based on assumption, personal experience of what a 'wizard' is/does, and what i have read here, when community users are discussing p:wizard.
I am not a user of spring webflow, so I cannot advise any further. Below, you will see my test/development environment details.
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
Excuse me, but I cannot save my reply here.
Mistake appears
General Error
SQL ERROR [ mysqli ]
Incorrect string value: '\xE2\x80\x9Dtab...' for column 'post_text' at row 1 [1366]
An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.
Mistake appears
General Error
SQL ERROR [ mysqli ]
Incorrect string value: '\xE2\x80\x9Dtab...' for column 'post_text' at row 1 [1366]
An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.
I write my answer and question there
http://forum.springsource.org/newreply. ... &noquote=1
Could you answer?
http://forum.springsource.org/newreply. ... &noquote=1
Could you answer?
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
Because you copy/pasted a single quote character or a escaped character. I have seen that error message and i had to remove escaped characters and/or single quote characters from my post/response.alekss wrote:Excuse me, but I cannot save my reply here.
Mistake appears
General Error
SQL ERROR [ mysqli ]
Incorrect string value: '\xE2\x80\x9Dtab...' for column 'post_text' at row 1 [1366]
An SQL error occurred while fetching this page. Please contact the Board Administrator if this problem persists.
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
It would not show me your question there, it said the following:alekss wrote:I write my answer and question there
http://forum.springsource.org/newreply. ... &noquote=1
Could you answer?
Sorry, i'm not a sping (framework) user and I only contribute to this community.You are not logged in. Fill in the form at the bottom of this page and try again.
You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
Thank you. I corrected this mistake.
So the question is -
I have in my page
Code:
<p:tabView id="tabView" var="category" value="#{showcaseBean.categories}">
When I'm clicking every tab the next tab with related goods to this category should appear.
So I have to catch
Code:
<p:ajax event="tabChange" listener="#{showcaseBean.onChange}" />
in my showcaseBean and fetch the related goods from database like
Code:
ShowcaseService.getGoodsByCategory(Category category) {}
This ShowcaseService can work with database only through flow.xml file (because transaction is bound to flow).
So I cannot make something like
Code:
(inside ShowcaseBean)
ShowcaseService showcaseService = new ShowcaseService();
showcaseService.getGoodsByCategory(Category category)
Instead of it I have to reflect this fetching in flow.xml like
Code:
<transition on="changeTab">
<evaluate expression="showcaseService.getGoodsByCategory(showcaseBean.selectedCategory)" />
</transition>
But examples (that I have seen) show the handling only JSF action (in flow.xml ) like
Code:
<transition on="cancelBooking">
<evaluate expression="bookingService.cancelBooking(bookings.selectedRow)" />
</transition>
where cancelBooking taken from
Code:
<p:commandButton id="cancel" value="Cancel" action="cancelBooking"/>
So how can I reflect "tabChange" event
Code:
<p:ajax event="tabChange" listener="#{showcaseBean.onChange}" />
in flow.xml to invoke method getGoodsByCategory of ShowcaseService?
There are different events - not only <p:button action ="MyAction"/>
For example valueChangeListener for selectOneMenu.
How I can catch such event in spring web flow?
So the question is -
I have in my page
Code:
<p:tabView id="tabView" var="category" value="#{showcaseBean.categories}">
When I'm clicking every tab the next tab with related goods to this category should appear.
So I have to catch
Code:
<p:ajax event="tabChange" listener="#{showcaseBean.onChange}" />
in my showcaseBean and fetch the related goods from database like
Code:
ShowcaseService.getGoodsByCategory(Category category) {}
This ShowcaseService can work with database only through flow.xml file (because transaction is bound to flow).
So I cannot make something like
Code:
(inside ShowcaseBean)
ShowcaseService showcaseService = new ShowcaseService();
showcaseService.getGoodsByCategory(Category category)
Instead of it I have to reflect this fetching in flow.xml like
Code:
<transition on="changeTab">
<evaluate expression="showcaseService.getGoodsByCategory(showcaseBean.selectedCategory)" />
</transition>
But examples (that I have seen) show the handling only JSF action (in flow.xml ) like
Code:
<transition on="cancelBooking">
<evaluate expression="bookingService.cancelBooking(bookings.selectedRow)" />
</transition>
where cancelBooking taken from
Code:
<p:commandButton id="cancel" value="Cancel" action="cancelBooking"/>
So how can I reflect "tabChange" event
Code:
<p:ajax event="tabChange" listener="#{showcaseBean.onChange}" />
in flow.xml to invoke method getGoodsByCategory of ShowcaseService?
There are different events - not only <p:button action ="MyAction"/>
For example valueChangeListener for selectOneMenu.
How I can catch such event in spring web flow?
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
I quoted your response and added code tags via code button, since it is easier for us all to read. i hope you learn to use the code tag via code button when responding with code. I'll review code after submitting this post.alekss wrote:I have in my pageWhen I'm clicking every tab the next tab with related goods to this category should appear.Code: Select all
<p:tabView id="tabView" var="category" value="#{showcaseBean.categories}">
So I have to catchin my showcaseBean and fetch the related goods from database likeCode: Select all
<p:ajax event="tabChange" listener="#{showcaseBean.onChange}" />
This ShowcaseService can work with database only through flow.xml file (because transaction is bound to flow).Code: Select all
ShowcaseService.getGoodsByCategory(Category category) {}
So I cannot make something like
(inside ShowcaseBean)Instead of it I have to reflect this fetching in flow.xml likeCode: Select all
ShowcaseService showcaseService = new ShowcaseService(); showcaseService.getGoodsByCategory(Category category)
But examples (that I have seen) show the handling only JSF action (in flow.xml ) likeCode: Select all
<transition on="changeTab"> <evaluate expression="showcaseService.getGoodsByCategory(showcaseBean.selectedCategory)" /> </transition>
where cancelBooking taken fromCode: Select all
<transition on="cancelBooking"> <evaluate expression="bookingService.cancelBooking(bookings.selectedRow)" /> </transition>
So how can I reflect "tabChange" eventCode: Select all
<p:commandButton id="cancel" value="Cancel" action="cancelBooking"/>
in flow.xml to invoke method getGoodsByCategory of ShowcaseService?Code: Select all
<p:ajax event="tabChange" listener="#{showcaseBean.onChange}" />
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
1. Hmmm, okay, i just saw earlier posts, and I see you are using spring webflow. I am not a spring webflow user, so I can only reply with some suggested searches.
2. see following, and search community forum via google like I did. I responded to a similar topic; your tabview tabchange, seems similar to the implementation of p:wizard (which is similar to tabview w/ tabChange), and there has been discussion of this requirement/issue by other spring webflow users.
forum.primefaces.org tabview tabchange flow.xml
2. see following, and search community forum via google like I did. I responded to a similar topic; your tabview tabchange, seems similar to the implementation of p:wizard (which is similar to tabview w/ tabChange), and there has been discussion of this requirement/issue by other spring webflow users.
forum.primefaces.org tabview tabchange flow.xml
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
-
- Information
-
Who is online
Users browsing this forum: No registered users and 51 guests