You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Alexey Koloskov <al...@ocslab.com> on 2009/04/22 15:48:23 UTC

How to set up server-side state saving method

Hello!
I'am new to MyFaces. I have written a simple program on jsf:
<h:form>
       <h:inputText value="#{indexBean.name}"/>
       <h:commandLink action="#{indexBean.submit}" value="Submit"/>
       <h:outputText value="#{indexBean.processedName}"/>
</h:form>
and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
But html code of the rendered page contains:
<input type="hidden" name="javax.faces.ViewState" 
id="javax.faces.ViewState" 
value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q==" 
/>
It looks like saving state on client, is it correct behavior or I'm 
doing something wrong?

PS. I use MyFaces 1.2.6

Thank you,
Alexey

Re: How to set up server-side state saving method

Posted by Cagatay Civici <ca...@gmail.com>.
Even value of the "javax.faces.ViewState is "same" after switching?

On Wed, Apr 22, 2009 at 3:44 PM, Alexey Koloskov <alexey_koloskov@ocslab.com
> wrote:

> BTW, I took myfaces-example-simple-1.1.8, expand it and change
> STATE_SAVING_METHOD from client to server, and deploy it to tomcat-6.0.18,
> but I still get the same
>
> <input type="hidden" name="javax.faces.ViewState"
> id="javax.faces.ViewState" value="..." />
>
> in the rendered pages. Maybe I have some wrong settings in the web server?
>
>
> Alexey Koloskov wrote:
>
>> Here is my web.xml
>> <display-name>firstJsf</display-name>
>>  <welcome-file-list>
>>   <welcome-file>/index.jsp</welcome-file>
>>  </welcome-file-list>
>>
>>  <context-param>
>>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>>   <param-value>server</param-value>
>>  </context-param>
>>  <context-param>
>>   <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
>>   <param-value>20</param-value>
>>  </context-param>
>>  <context-param>
>>   <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
>>   <param-value>true</param-value>
>>  </context-param>
>>
>>  <servlet>
>>   <servlet-name>Faces Servlet</servlet-name>
>>   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>>   <load-on-startup>1</load-on-startup>
>>  </servlet>
>>  <servlet-mapping>
>>   <servlet-name>Faces Servlet</servlet-name>
>>   <url-pattern>*.jsf</url-pattern>
>>  </servlet-mapping>
>>
>> Cagatay Civici wrote:
>>
>>> How do you specify it in web.xml, please post the context param config.
>>>
>>> On Wed, Apr 22, 2009 at 2:48 PM, Alexey Koloskov <
>>> alexey_koloskov@ocslab.com <ma...@ocslab.com>> wrote:
>>>
>>>    Hello!
>>>    I'am new to MyFaces. I have written a simple program on jsf:
>>>    <h:form>
>>>         <h:inputText value="#{indexBean.name}"/>
>>>         <h:commandLink action="#{indexBean.submit}" value="Submit"/>
>>>         <h:outputText value="#{indexBean.processedName}"/>
>>>    </h:form>
>>>    and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
>>>    But html code of the rendered page contains:
>>>    <input type="hidden" name="javax.faces.ViewState"
>>>    id="javax.faces.ViewState"
>>>
>>>  value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q=="
>>>
>>>    />
>>>    It looks like saving state on client, is it correct behavior or
>>>    I'm doing something wrong?
>>>
>>>    PS. I use MyFaces 1.2.6
>>>
>>>    Thank you,
>>>    Alexey
>>>
>>>
>>>
>>
>>
>

Re: How to set up server-side state saving method

Posted by Alexey Koloskov <al...@ocslab.com>.
BTW, I took myfaces-example-simple-1.1.8, expand it and change 
STATE_SAVING_METHOD from client to server, and deploy it to 
tomcat-6.0.18, but I still get the same

<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="..." />

in the rendered pages. Maybe I have some wrong settings in the web server?

Alexey Koloskov wrote:
> Here is my web.xml
> <display-name>firstJsf</display-name>
>  <welcome-file-list>
>    <welcome-file>/index.jsp</welcome-file>
>  </welcome-file-list>
>
>  <context-param>
>    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>    <param-value>server</param-value>
>  </context-param>
>  <context-param>
>    <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
>    <param-value>20</param-value>
>  </context-param>
>  <context-param>
>    <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
>    <param-value>true</param-value>
>  </context-param>
>
>  <servlet>
>    <servlet-name>Faces Servlet</servlet-name>
>    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>    <load-on-startup>1</load-on-startup>
>  </servlet>
>  <servlet-mapping>
>    <servlet-name>Faces Servlet</servlet-name>
>    <url-pattern>*.jsf</url-pattern>
>  </servlet-mapping>
>
> Cagatay Civici wrote:
>> How do you specify it in web.xml, please post the context param config.
>>
>> On Wed, Apr 22, 2009 at 2:48 PM, Alexey Koloskov 
>> <alexey_koloskov@ocslab.com <ma...@ocslab.com>> wrote:
>>
>>     Hello!
>>     I'am new to MyFaces. I have written a simple program on jsf:
>>     <h:form>
>>          <h:inputText value="#{indexBean.name}"/>
>>          <h:commandLink action="#{indexBean.submit}" value="Submit"/>
>>          <h:outputText value="#{indexBean.processedName}"/>
>>     </h:form>
>>     and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
>>     But html code of the rendered page contains:
>>     <input type="hidden" name="javax.faces.ViewState"
>>     id="javax.faces.ViewState"
>>     
>> value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q==" 
>>
>>     />
>>     It looks like saving state on client, is it correct behavior or
>>     I'm doing something wrong?
>>
>>     PS. I use MyFaces 1.2.6
>>
>>     Thank you,
>>     Alexey
>>
>>
>
>


Re: How to set up server-side state saving method

Posted by Alexey Koloskov <al...@ocslab.com>.
Thank you Cagatay for your answer, indeed when setting state saving to 
client, generated response is as two times bigger than previous one.
So ViewState hidden filed is renderer always but contains different size 
of information.

Cagatay Civici wrote:
> Can't remember what info probably view id, but in server state saving 
> still some information is saved.
>
> Try setting state saving to client, you'll see the difference in size 
> of that hidden input.
>
> On Wed, Apr 22, 2009 at 3:36 PM, Alexey Koloskov 
> <alexey_koloskov@ocslab.com <ma...@ocslab.com>> wrote:
>
>     Here is my web.xml
>     <display-name>firstJsf</display-name>
>      <welcome-file-list>
>       <welcome-file>/index.jsp</welcome-file>
>      </welcome-file-list>
>
>      <context-param>
>       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>       <param-value>server</param-value>
>      </context-param>
>      <context-param>
>      
>     <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
>       <param-value>20</param-value>
>      </context-param>
>      <context-param>
>      
>     <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
>       <param-value>true</param-value>
>      </context-param>
>
>      <servlet>
>       <servlet-name>Faces Servlet</servlet-name>
>       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>       <load-on-startup>1</load-on-startup>
>      </servlet>
>      <servlet-mapping>
>       <servlet-name>Faces Servlet</servlet-name>
>       <url-pattern>*.jsf</url-pattern>
>      </servlet-mapping>
>
>     Cagatay Civici wrote:
>
>         How do you specify it in web.xml, please post the context
>         param config.
>
>         On Wed, Apr 22, 2009 at 2:48 PM, Alexey Koloskov
>         <alexey_koloskov@ocslab.com
>         <ma...@ocslab.com>
>         <mailto:alexey_koloskov@ocslab.com
>         <ma...@ocslab.com>>> wrote:
>
>            Hello!
>            I'am new to MyFaces. I have written a simple program on jsf:
>            <h:form>
>                 <h:inputText value="#{indexBean.name}"/>
>                 <h:commandLink action="#{indexBean.submit}"
>         value="Submit"/>
>                 <h:outputText value="#{indexBean.processedName}"/>
>            </h:form>
>            and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
>            But html code of the rendered page contains:
>            <input type="hidden" name="javax.faces.ViewState"
>            id="javax.faces.ViewState"
>          
>          value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q=="
>            />
>            It looks like saving state on client, is it correct behavior or
>            I'm doing something wrong?
>
>            PS. I use MyFaces 1.2.6
>
>            Thank you,
>            Alexey
>
>
>
>


Re: How to set up server-side state saving method

Posted by Cagatay Civici <ca...@gmail.com>.
Can't remember what info probably view id, but in server state saving still
some information is saved.

Try setting state saving to client, you'll see the difference in size of
that hidden input.

On Wed, Apr 22, 2009 at 3:36 PM, Alexey Koloskov <alexey_koloskov@ocslab.com
> wrote:

> Here is my web.xml
> <display-name>firstJsf</display-name>
>  <welcome-file-list>
>   <welcome-file>/index.jsp</welcome-file>
>  </welcome-file-list>
>
>  <context-param>
>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>   <param-value>server</param-value>
>  </context-param>
>  <context-param>
>   <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
>   <param-value>20</param-value>
>  </context-param>
>  <context-param>
>   <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
>   <param-value>true</param-value>
>  </context-param>
>
>  <servlet>
>   <servlet-name>Faces Servlet</servlet-name>
>   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>   <load-on-startup>1</load-on-startup>
>  </servlet>
>  <servlet-mapping>
>   <servlet-name>Faces Servlet</servlet-name>
>   <url-pattern>*.jsf</url-pattern>
>  </servlet-mapping>
>
> Cagatay Civici wrote:
>
>> How do you specify it in web.xml, please post the context param config.
>>
>> On Wed, Apr 22, 2009 at 2:48 PM, Alexey Koloskov <
>> alexey_koloskov@ocslab.com <ma...@ocslab.com>> wrote:
>>
>>    Hello!
>>    I'am new to MyFaces. I have written a simple program on jsf:
>>    <h:form>
>>         <h:inputText value="#{indexBean.name}"/>
>>         <h:commandLink action="#{indexBean.submit}" value="Submit"/>
>>         <h:outputText value="#{indexBean.processedName}"/>
>>    </h:form>
>>    and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
>>    But html code of the rendered page contains:
>>    <input type="hidden" name="javax.faces.ViewState"
>>    id="javax.faces.ViewState"
>>
>>  value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q=="
>>    />
>>    It looks like saving state on client, is it correct behavior or
>>    I'm doing something wrong?
>>
>>    PS. I use MyFaces 1.2.6
>>
>>    Thank you,
>>    Alexey
>>
>>
>>
>

Re: How to set up server-side state saving method

Posted by Alexey Koloskov <al...@ocslab.com>.
Here is my web.xml
<display-name>firstJsf</display-name>
  <welcome-file-list>
    <welcome-file>/index.jsp</welcome-file>
  </welcome-file-list>

  <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
    <param-value>20</param-value>
  </context-param>
  <context-param>
    <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
    <param-value>true</param-value>
  </context-param>

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>

Cagatay Civici wrote:
> How do you specify it in web.xml, please post the context param config.
>
> On Wed, Apr 22, 2009 at 2:48 PM, Alexey Koloskov 
> <alexey_koloskov@ocslab.com <ma...@ocslab.com>> wrote:
>
>     Hello!
>     I'am new to MyFaces. I have written a simple program on jsf:
>     <h:form>
>          <h:inputText value="#{indexBean.name}"/>
>          <h:commandLink action="#{indexBean.submit}" value="Submit"/>
>          <h:outputText value="#{indexBean.processedName}"/>
>     </h:form>
>     and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
>     But html code of the rendered page contains:
>     <input type="hidden" name="javax.faces.ViewState"
>     id="javax.faces.ViewState"
>     value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q=="
>     />
>     It looks like saving state on client, is it correct behavior or
>     I'm doing something wrong?
>
>     PS. I use MyFaces 1.2.6
>
>     Thank you,
>     Alexey
>
>


Re: How to set up server-side state saving method

Posted by Cagatay Civici <ca...@gmail.com>.
How do you specify it in web.xml, please post the context param config.

On Wed, Apr 22, 2009 at 2:48 PM, Alexey Koloskov <alexey_koloskov@ocslab.com
> wrote:

> Hello!
> I'am new to MyFaces. I have written a simple program on jsf:
> <h:form>
>      <h:inputText value="#{indexBean.name}"/>
>      <h:commandLink action="#{indexBean.submit}" value="Submit"/>
>      <h:outputText value="#{indexBean.processedName}"/>
> </h:form>
> and specify javax.faces.STATE_SAVING_METHOD=server in web.xml
> But html code of the rendered page contains:
> <input type="hidden" name="javax.faces.ViewState"
> id="javax.faces.ViewState"
> value="/0RL6JBt8cvqShFdUYKZJMFYhH3aK5oYI4toUZvNpTR+xCEIE1Uu9gLy21nZ6Z9tJC3z6WQ4pGdWJUwOkbTP+Q=="
> />
> It looks like saving state on client, is it correct behavior or I'm doing
> something wrong?
>
> PS. I use MyFaces 1.2.6
>
> Thank you,
> Alexey
>