Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSF
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSF
[JSF2] f:ajax doesn't seemed to decode input field
Bupjae Lee
Ranch Hand
Posts: 107
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
composite xhtml code
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"> <!-- INTERFACE --> <composite:interface componentType="intac.web.UIStatus"> <composite:attribute name="name"/> <composite:attribute name="value" type="intac.entity.StatusValue"/> </composite:interface> <!-- IMPLEMENTATION --> <composite:implementation> <h:form> <h:outputText value="#{cc.attrs.name}: "/> <h:outputText value="#{cc.display}"/> <h:outputText value="(#{cc.needPoint})"/> <h:inputHidden value="#{cc.delta}"/> <h:commandButton value="+1" actionListener="#{cc.modifyDelta}"> <f:ajax render="@form" event="action"/> </h:commandButton> </h:form> </composite:implementation> </html>
component
java
class code
@FacesComponent("intac.web.UIStatus") public class UIStatus extends UINamingContainer implements Serializable { private static final long serialVersionUID = 1L; private int delta; private String getName() { return getAttributes().get("name").toString(); } private StatusValue getValue() { return (StatusValue) getAttributes().get("value"); } public int getNeedPoint() { return getValue().getNeedPoint(delta); } public int getDelta() { return delta; } public void setDelta(int delta) { System.out.println("delta=" + delta); // DEBUG CODE this.delta = delta; } public String getDisplay() { return String.format("%d+%d", getValue().getUnmodified() + getDelta(), getValue().getModifier()); } public void modifyDelta(ActionEvent ev) { String cmd = ((UICommand) ev.getComponent()).getValue().toString(); if (cmd.startsWith("+")) { cmd = cmd.substring(1); } int ddelta = Integer.parseInt(cmd); delta += ddelta; if (delta < 0) { delta = 0; } } }
When I click button, AJAX request goes to container, and it should call setDelta, but it doesn't.
Am I do something wrong?
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
javax.el.PropertyNotFoundException: Objetivo inalcanzable - JSF - Facelet - method-signature
Problem using composite components
create component with ajax and listener behavior in java
Composite Components Problem
cc.parent in component compositions not working
More...