myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fırat KÜÇÜK <firatku...@gmail.com>
Subject Re: JSF recalls datatable on POST
Date Thu, 27 Aug 2009 05:11:04 GMT
Thanks Gerhard.

2009/8/27 Gerhard Petracek <gerhard.petracek@gmail.com>

> hi,
>
> that's a given behaviour. generally spoken: you don't know how often a
> component invokes your getter methods. you will find a lot of possible
> solutions.
> e.g. there is a myfaces sub-project which provides a solution (the
> view-controller provided by orchestra [1]).
>
> (or you use javax.faces.event.PreRenderViewEvent of jsf 2.0)
>
> regards,
> gerhard
>
> [1]
> http://myfaces.apache.org/orchestra/myfaces-orchestra-core15/ViewControllerAnnotations.html
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2009/8/26 Fırat KÜÇÜK <firatkucuk@gmail.com>
>
> Hi,
>>
>> Here is the test codes:
>>
>> This is my simple managed bean:
>>
>> ----------------------------------
>> public class Sample {
>>
>>   public String getText() {
>>     System.out.println("this is text");
>>     return "this is text";
>>   }
>>
>>   public String[] getData() {
>>     System.out.println("this is data");
>>     return new String[] {
>>       "deneme1",
>>       "deneme2"
>>     };
>>   }
>>
>>   public String SampleAction() {
>>     return "sample";
>>   }
>> }
>> ----------------------------------
>>
>> This is web page:
>>
>> ----------------------------------
>> <%@page contentType="text/html" pageEncoding="UTF-8"%>
>>
>> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
>> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
>>
>> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
>>   "http://www.w3.org/TR/html4/loose.dtd">
>>
>> <html>
>>   <head>
>>     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
>>     <title>JSP Page</title>
>>   </head>
>>   <body>
>>     <h:dataTable var="d" border="1" value="#{sample.data}">
>>       <h:column>
>>         <h:outputText value="#{d}" />
>>       </h:column>
>>     </h:dataTable>
>>     <h:form>
>>       <h:outputText value="#{sample.text}" />
>>       <h:commandButton action="#{sample.SampleAction}" value="click" />
>>     </h:form>
>>   </body>
>> </html>
>> ----------------------------------
>>
>> and this is faces config:
>>
>> ----------------------------------
>>   <navigation-rule>
>>     <navigation-case>
>>       <from-outcome>sample</from-outcome>
>>       <to-view-id>sample.jsf</to-view-id>
>>     </navigation-case>
>>   </navigation-rule>
>>
>>   <managed-bean>
>>     <managed-bean-name>sample</managed-bean-name>
>>     <managed-bean-class>Sample</managed-bean-class>
>>     <managed-bean-scope>request</managed-bean-scope>
>>   </managed-bean>
>> ----------------------------------
>>
>> When we call http://localhost:8080/index.jsf. The server output is:
>> this is text
>> this is data
>>
>> Another word JSF calls datatable #{sample.data} and #{sample.text}.this
>> normal.
>>
>> But when we click the button. The Server output is:
>> this is data
>>
>> getData method should not be called.
>>
>> is this a possible bug? How may i avoid of reloading datatable content.
>>
>> all of jsf and jstl tags that i used. Works properly except datatable.
>> When i click button and post data.
>> Datatable uses getter method. No other tags use getter methods. This is an
>> exception.
>>
>> --
>> FIRAT KÜÇÜK
>>
>
>


-- 
FIRAT KÜÇÜK

Mime
View raw message