Salam!

Bir JSF Page den AJAX desteyi ile diger JSF Page de olan componenti render etmek mumkunmu.

Misal: MyFrgmnt.xhtml de olan h:inputtext deyer yazdigimiz an MyPage.xhtml de olan h:outputtext de deyerin gorunmesini saglamaq icin AJAX ı nasıl kullanırız?

MyCls.java

@ManagedBean(name="MyBCls")
@SessionScoped
public class MyCls {
    private String Deyer;

    public String getDeyer() {
        return Deyer;
    }

    public void setDeyer(String Deyer) {
        this.Deyer = Deyer;
    }
}

MyPage.xhtml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Page</title>
    </h:head>
    <h:body>
        <h:form>
            <ui:include src="MyFrgmnt.xhtml"></ui:include>
            <h:outputtext id="otpt" value="#{MyBCls.deyer}"></h:outputtext>
        </h:form>
    </h:body>
</html>

MyFrgmnt.xhtml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets">
    <ui:fragment>
        <h:inputtext id="inpt" value="#{MyBCls.deyer}"></h:inputtext>
    </ui:fragment>
</html>

Tesekkurler!

soruldu: 23 May '13, 06:10

arzumanbayramov's gravatar image

arzumanbayramov
56559
cevap kabul oranı: 0%

değiştirildi: 23 May '13, 10:11

%C3%B6zcanacar's gravatar image

özcanacar ♦♦
17.2k59183183


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1 DTD/xhtml1-transitional.dtd">
<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:ui="http://java.sun.com/jsf/facelets">
<h:head>
<title>Page</title>
</h:head>
<h:body>

<h:form>
    <ui:include src="/myFragment.xhtml"></ui:include>
    <h:outputText id="otpt" value="aa" />
</h:form>
</h:body>
</html>

   ----------------

 <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:ui="http://java.sun.com/jsf/facelets">
<ui:fragment>

    <h:inputText id="inpt" value="Test">
        <f:ajax event="blur" execute="@this" render="otpt" />
    </h:inputText>
</ui:fragment>
</html>
permanent link

cevaplandı: 23 May '13, 06:49

mahmut_can's gravatar image

mahmut_can ♦
2.9k62552
cevap kabul oranı: 67%

Böyle calisir.

<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:ui="http://java.sun.com/jsf/facelets">
    .....
<h:form>
    <h:inputtext id="inpt" value="#{MyBCls.deyer}">
        <f:ajax event="blur" execute="@this" render=":otpt" />
    </h:inputtext>
</h:form>
(23 May '13, 06:15) mahmut_can ♦ mahmut_can's gravatar image

Amma error veriyor

An Error Occurred: <f:ajax> contains an unknown id ':otpt' - cannot locate it in the context of the component inpt

(23 May '13, 06:30) arzumanbayramov arzumanbayramov's gravatar image

senin versionda

<f:ajax event="blur" execute="@this" render="otpt"/>

olacak

(23 May '13, 06:36) mahmut_can ♦ mahmut_can's gravatar image

Ayni error u veriyor Bence problem "otpt" id si MyFrgmnt.xhtml den disarda yani MyPage.xhtml de olugu icin dir

(23 May '13, 06:47) arzumanbayramov arzumanbayramov's gravatar image

Yok calisiyor.

(23 May '13, 06:50) mahmut_can ♦ mahmut_can's gravatar image

Anladim Form un yerini deyisdirdiniz Cox tesekkur ederim

(23 May '13, 06:55) arzumanbayramov arzumanbayramov's gravatar image
6 yorumdan 5 tanesi gösteriliyor hepsini göster
Cevabınız
toggle preview

Bu soruyu takip et

E-Posta üzerinden:

Üyelik girişi yaptıktan sonra abonelik işlemlerini yapabilirsiniz

RSS üzerinden:

Cevaplar

Cevaplar ve Yorumlar

Yazı Formatlama

  • *italic* ya da _italic_
  • **bold** ya da __bold__
  • link:[text](http://url.com/ "başlık")
  • resim?![alt text](/path/img.jpg "başlık")
  • liste: 1. Foo 2. Bar
  • temel HTML etiketleri de kullanılabilir

Bu sorunun etiketleri:

×281
×41

Soruldu: 23 May '13, 06:10

Görüntüleme: 886 kez

Son güncelleme: 24 May '13, 04:09

powered by BitNami OSQA