Reg - How to remind previous view state?
Hi,
I have the following requirement:
In mobile application, the home view screen has a text input and button controls. Text input will contain a service URL (value provided at run time), on click of the button, the given URL (specified in text box) will be executed using HTTPService component. The resultant value will be bound to a List component. On select of the list item, next view (details view) will be launched with the selectedItem value. The details view has 'Back' button, on press of back button the home view will be launched. On launch of Home view from the details view i need to maintain the previous state (resultant value) as it is. How can i implement this?
Note: I don't want to allow user to give input and fire a service on each time return back from 'Details view'
I just tried and can able to pass and return the URL value using 'navigator.poppedViewReturnedObject' but it requires need to fire a HTTPservice again on launch of 'Home view' from 'Details view'. How i overcome this? or am i understood wrongly?
Can you help me with your knowledge and experince?
Thanks and Regards,
Manikandan
Hi Mani,
You can use persistence manager.
If I have understood you correct.These two links can help you achive what you want.
http://help.adobe.com/en_US/flex/mobileapps/WSb0a29bf92525419c-54dd253312afbec3ecb-8000.ht ml
http://cookbooks.adobe.com/post_Simple_data_persistence_in_a_Flex_4_5_mobile_appli-18856.h tml
hope this helps
cheers
Similar Messages
-
How to refresh/restore VIEW STATE of a JSF component? urgent help needed!
AOA guys,
I am using Jboss 4.0.5, JSF 1.1.2 and DOJO framework to handle ajax request.
In my project, I am using A4J hidden fields to store values associated with an html anchor tag and use these values to update <h:outputText> dynamically (an ajax request).
But when i click that anchor link a more than 15 times the message appears as a prompt that view state couldn't be restored - reload page.
I think it is because that in JSF 1.1 default value of
om.sun.faces.NUMBER_OF_VIEWS_IN_LOGICAL_VIEW_IN_SESSION is 15, So i can't store more than 15 View Id of JSF components.
My Question is:
_Without shifting to JSF1.2, how can i handle this restore view problem in my Java Code using phase listener or some other way so that if this view state problem will occur it atomatically restore the view ids?_
Please reply me soon?avoid multi post
http://forum.java.sun.com/thread.jspa?threadID=5229804 -
How can i use "View State" Concept in sharepoint sandbox soltuions??
I need to do video player in sharepoint sandbox solutions..I used following code in form solution the same code i need to use sandbox solution..In this code i am using "viewstate" asp control..i don't know how to use in sandbox solutions..how to use??<html><head></head><body> <object classid="clsid:566DB6E-A56D-10pf-96B8-4488888000" width="425" height="344"><param name="movie" value="player.swf" /> <param name="flashvars" value="file=<%= ServerVideo %>"&"Preview=<%= ServerUrl %>" &autoplay="false" &showPlaylist="false" />
<param name="allowFullScreen" value="true" />
<param name="wmode" value="transparent" />
<param name="autoplay" value="false" />
<param name="allowscriptaccess" value="always" />
<embed src="hdplayer.swf" &
flashvars="file=<%=ServerVideo%>"& Preview="<%= ServerUrl %>"&showPlaylist="false"
style="width:425px;height:344px" allowFullScreen="true" allowScriptAccess="always"
type="application/x-shockwave-flash" wmode="transparent"></embed></object></body></html>Hello,
For those still looking, you should ask on the
SharePoint forums.
Karl
When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
My Blog: Unlock PowerShell
My Book: Windows PowerShell 2.0 Bible
My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}}) -
I have previously viewed movies and TV Shows on my IPHONE that I want to delete and free up space so that I can buy new movies/TV show to watch. How do I get them off my IPHONE and my ITUNES account?
Hey RR6705,
If you would like to delete previously purchased content off of your iPhone, you may find the steps outlined in the following article helpful:
How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store - Apple Support
Cheers,
- Brenden -
How to disable automatic opening of previously viewed items in Preview or TextEdit in Max OSX Lion? It was no such issue on Snow Leopard OS.
Please helpThis is a new behavior introduced in Lion. You can disable it completely via System Preferences, General: uncheck the "Restore windows..." box toward the bottom.
You can disable this behavior on a case by case basis by either closing all windows before quitting, or holding the option key while quitting, or holding the shift key while launching from dock.
charlie -
iTunes randomly stops playing purchases that have previously viewed on the same hardware. It has an error message about HD. How can this issue be resolved? What information is available besides the "learn more" option that does not deal with the problem?
Many people have the same problem. However, there is little or nothing readily available to users. This problem has existed for two or more years. Does anyone have anything to offer about this disturbing problem?Thanks for the suggestion kcell. I've tried both versions
9.0.115 and 9.0.124 and both fail with the policy permission error.
I also tried with and without your crossdomain.xml file but
with the same result. It looks like this file is intended for URL
policy, instead of socket policy. Recently Adobe separated the two.
When I run with the files installed on my dev PC, it does
work, which makes sense because the flash player isn't loaded from
an unknown domain.
I did get one step closer. If a crossdomain.xml in the server
root exists and the socketpolicy file is loaded from the app folder
then the first two warnings disappear. The logs now show:
OK: Root-level SWF loaded:
https://192.168.2.5/trunk/myapp.swf
OK: Policy file accepted: https://192.168.2.5/crossdomain.xml
OK: Policy file accepted:
https://192.168.2.5/trunk/socketpolicy.xml
Warning: Timeout on xmlsocket://192.168.2.5:843 (at 3
seconds) while waiting for socket policy file. This should not
cause any problems, but see
http://www.adobe.com/go/strict_policy_files
for an explanation.
Warning: [strict] Ignoring policy file with incorrect syntax:
xmlsocket://192.168.2.5:993
Error: Request for resource at xmlsocket://192.168.2.5:993 by
requestor from https://192.168.2.5/trunk/myapp.swf is denied due to
lack of policy file permissions.
Which basically says, everything is okay, but you stay out
anyway.
PS: I found the XML schema files here:
http://www.adobe.com/devnet/flashplayer/articles/fplayer9_security_02.html
and the socket policy schema:
http://www.adobe.com/xml/schemas/PolicyFileSocket.xsd.
UPDATE: When serving up the policy file on port 843 using the
example perl script then the socket connection seems to be accepted
and the connect succeeds. After that flex hangs trying to logon to
the IMAP server. -
How can I read pages offline that I've previously viewed?
I'm unable to read websites that I've previously looked at online once I've logged off. I can't go into my history and re-read pages ofline. I can see what I've visited, I just can't open it. What do I need to do to read previously viewed pages offline?
*Read It Later: https://addons.mozilla.org/firefox/addon/read-it-later/
-
How to create static list type view state?
Hi!
i want to create a static List type view state in asp.net c# for below type of list?
static List<KeyValuePair<string, int>> istrStartDate = new List<KeyValuePair<string, int>>();Please post it in the dedicated ASP.Net Forum
http://forums.asp.net for more efficient responses.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Firefox launches to pages previously viewed when opened-How to disable this?
When FF is closed, the next time it opens it returns to the previously viewed pages. Multiple tabs open.
Make sure that you close Firefox properly, otherwise session restore will try to open the tabs and windows from the previous session.<br />
See Hang at exit:
* http://kb.mozillazine.org/Firefox_hangs
* [[Firefox hangs]]
Set the pref [http://kb.mozillazine.org/browser.sessionstore.max_resumed_crashes browser.sessionstore.max_resumed_crashes] to 0 on the about:config page to get the about:sessionrestore page immediately with the first restart after a crash has occurred or the Task Manager was used to close Firefox.
See:
* http://kb.mozillazine.org/Session_Restore#Restoring_a_session_after_a_crash -
How: Modules within View States?
Hey fellow FLEXers:
I have a main app configured with view states. Each view state should load a module. Only the first module loads, and when the second one tries to run it fails to run. Any ideas what may be causing this?
Here is the main app code:
And here the SignIn module:
And here the CompanySelection module:
And the CompanyTileList component that the CompanySelection module requires:
Any help is greatly appreciated.
Also, if anyone can point me in the direction of some good tutorials for using modules and views (hopefully in combination), that would be great. I purchased the book FLEX 3 in Action, but unfortunately it doesn't go into too much detail on this topic.
Thanks!
MikeThe problem I am experiencing is that the TileList in the CompanySelection module is not being populated; it results in the module displaying without the tile list.
Everytime I try to add ActionScript code in my post using the INSERT HTML functionality, it dissappears. Any ideas? I'll try adding XML.
Main App:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="app_init()"
>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import com.brassworks.ValueObjects.UserVO;
[Bindable]
private var current_user:UserVO;
private function app_init():void
setState("SignIn");
//if ((!current_user) || (current_user.id <= 0)) {setState("SignIn");}
public function setState(state:String):void
currentState = state;
public function handleFault(event:FaultEvent):void
Alert.show(event.fault.faultDetail, event.fault.faultString);
public function show_error(error:Error, s_function:String):void
Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
]]>
</mx:Script>
<mx:Canvas
id="pnl_default"
>
</mx:Canvas>
<mx:states>
<mx:State
name="SignIn"
>
<mx:RemoveChild
target="{pnl_default}"
/>
<mx:AddChild>
<mx:ModuleLoader
id="mdl_signin"
url="com/brassworks/modules/admin/SignIn.swf"
/>
</mx:AddChild>
</mx:State>
<mx:State
name="ChooseCompany"
>
<mx:RemoveChild
target="{pnl_default}"
/>
<mx:AddChild>
<mx:ModuleLoader
id="mdl_choose_company"
url="com/brassworks/modules/admin/CompanySelection.swf"
/>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:transitions>
<mx:Transition
fromState="*"
toState="*"
>
<mx:Parallel
id="trn_default"
targets="{['SignIn', 'ChooseCompany']}"
>
<mx:Fade
alphaFrom="0.0"
alphaTo="1.0"
/>
</mx:Parallel>
</mx:Transition>
</mx:transitions>
</mx:Application>
SignIn module:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
>
<mx:RemoteObject
id="LoginRemote"
destination="login"
showBusyCursor="true"
>
<mx:method name="sign_in" result="signin_handle(event)" />
<mx:method name="sign_out" result="signout_handle(event)" />
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.utils.ArrayUtil;
import mx.rpc.events.ResultEvent;
import mx.controls.Alert;
import com.brassworks.ValueObjects.CurrentUserVO;
import mx.events.VideoEvent;
[Bindable]
private var this_user:CurrentUserVO = new CurrentUserVO();
private function init():void
private function signin_handle(event:ResultEvent):void
try
this_user = event.result as CurrentUserVO;
if (this_user.token == null) {Alert.show("Supplied login credentials are not valid. Please try again.");}
else
this.parentApplication.setState("ChooseCompany");
//Alert.show("You are now logged in, " + this_user.first_name + " " + this_user.last_name + ".");
catch (error:FaultEvent)
handleFault(error);
private function signout_handle(event:ResultEvent):void
private function sign_in(event:Event):void
//Alert.show(txt_name.text + "|" + txt_password.text);
LoginRemote.sign_in(txt_username.text, txt_password.text);
private function sign_out(event:Event):void
private function show_error(error:Error, s_function:String):void
Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
private function handleFault(event:FaultEvent):void
Alert.show(event.fault.faultDetail, event.fault.faultString);
]]>
</mx:Script>
<mx:Panel
id="pnl_signin"
title="Sign In"
horizontalAlign="center"
verticalAlign="middle"
>
<mx:Form
id="frm_signin"
cornerRadius="5"
defaultButton="{btn_signin}"
>
<mx:FormItem
id="fi_username"
label="Username:"
>
<mx:TextInput
id="txt_username"
/>
</mx:FormItem>
<mx:FormItem
id="fi_password"
label="Password:"
>
<mx:TextInput
id="txt_password"
displayAsPassword="true"
/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar>
<mx:LinkButton
id="lnk_request_password"
label="Forgot your password?"
click="currentState='RequestPassword'"
/>
<mx:Spacer
id="spc_spacer"
width="100%"
/>
<mx:Button
id="btn_signin"
label="Sign In"
click="sign_in(event)"
/>
</mx:ControlBar>
</mx:Panel>
<!--
<mx:states>
<mx:State
name="RequestPassword"
>
<mx:SetProperty
target="{pnl_signin}"
name="title"
value="Request New Password"
/>
<mx:SetProperty
target="{btn_signin}"
name="label"
value="Submit Request"
/>
<mx:RemoveChild
target="{lnk_request_password}"
/>
<mx:RemoveChild
target="{fi_password}"
/>
<mx:AddChild
relativeTo="{spc_spacer}"
position="before"
>
<mx:target>
<mx:LinkButton
id="lnk_sign_in"
label="Return to Sign In form."
click="currentState=''"
/>
</mx:target>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:transitions>
<mx:Transition
fromState="*"
toState="*"
>
<mx:Parallel
id="trn_default"
targets="{['RequestPassword']}"
>
<mx:Fade
alphaFrom="0.0"
alphaTo="1.0"
/>
</mx:Parallel>
</mx:Transition>
</mx:transitions>
-->
</mx:Module>
CompanySelection module:
<?xml version="1.0" encoding="utf-8"?>
<mx:Module
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
xmlns:components="com.brassworks.components.*"
horizontalAlign="center"
>
<mx:RemoteObject
id="CompanyRemote"
destination="company"
source="Company"
showBusyCursor="true"
>
<mx:method name="load_by_user" result="getCompanyHandler(event)"/>
</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
import mx.controls.Alert;
import mx.core.ByteArrayAsset;
import mx.controls.Image;
import mx.rpc.events.FaultEvent;
import mx.rpc.soap.LoadEvent;
import mx.utils.ArrayUtil;
import com.brassworks.ValueObjects.CompanyVO;
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
public function mod_init():void
CompanyRemote.load_by_user("mike");
private function getCompanyHandler(event:ResultEvent):void
Alert.show('test3');
//var results:ArrayCollection = event.result as ArrayCollection;
//companies = event.result as ArrayCollection;
tll_company_selection.dataProvider = event.result;
private function toObject(element:String, index:int, array:Array):Object
return {label:element};
private function item_click(event:ListEvent):void
Alert.show(TileList(event.currentTarget).selectedItem.id.toString());
]]>
</mx:Script>
<mx:Canvas
borderColor="#636363"
backgroundColor="#FCF4DA"
width="900"
horizontalCenter="true"
>
<mx:TileList
id="tll_company_selection"
columnWidth="260"
maxColumns="2"
rowHeight="150"
itemRenderer="com.brassworks.components.CompanyTileList"
itemClick="item_click(event)"
width="520"
horizontalScrollPolicy="off"
horizontalCenter="0"
backgroundAlpha="0.0"
borderStyle="none"
creationComplete="mod_init()"
/>
</mx:Canvas>
</mx:Module>
CompanyTileList component:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox
xmlns:mx="http://www.adobe.com/2006/mxml"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
horizontalCenter="0"
width="260"
paddingLeft="5"
paddingRight="5"
paddingTop="0"
paddingBottom="0"
>
<mx:Script>
<![CDATA[
import com.brassworks.ValueObjects.CompanyVO;
import mx.utils.Base64Decoder;
import flash.utils.ByteArray;
[Bindable]
private var _company_name:String;
[Bindable]
private var _company_logo:ByteArray;
private var _decoder:Base64Decoder = new Base64Decoder();
public var _company:CompanyVO;
private function tile_list_init():void
_company = data as CompanyVO;
_company_name = _company.name;
_decoder.decode(_company.logo);
_company_logo = _decoder.toByteArray();
]]>
</mx:Script>
<mx:Image
source="{_company_logo}"
width="250"
height="100"
/>
<mx:Label
text="{_company_name}"
creationComplete="tile_list_init()"
width="100%"
left="0"
right="0"
textAlign="center"
/>
</mx:VBox> -
C#/SharePoint -View State related issue while exporting data to excel
We have web application based on SharePoint. We have a list view to display data based on Search Criteria. We have total of around 16000 data. When we try to export all data to excel it gives an error. The cause of the issue is:
View State is used to save the state of page i.e. the previous state. When the export to excel link is clicked, the data present in the grid is actually saved in view state so that the overhead of again generating
the data(as per the selection criteria) can be avoided. Now, this View state has a limitation of storage of these records. When we put in some selection criteria, the no. of records is less hence no problem in actually storing the view state. But when there
is no selection criteria, 16306 records are too much to be stored in view state. Hence the error occurs.
We tried to solve this issue by creating a compressor class and overriding two methods:
LoadPageStateFromPersistenceMedium
SavePageStateToPersistenceMedium
This has resolved the issue with Export to Excel. However, there is now some issue in the paging of the list view. The list view has a column with hyperlink which opens related data in a form. While we click on the link in 2<sup>nd</sup>
page of the list view, it displays data for the link in the 1<sup>st</sup> page at same row.
Please suggest how to resolve this issue or any workaround for thisWe have web application based on SharePoint. We have a list view to display data based on Search Criteria. We have total of around 16000 data. When we try to export all data to excel it gives an error. The cause of the issue is:
View State is used to save the state of page i.e. the previous state. When the export to excel link is clicked, the data present in the grid is actually saved in view state so that the overhead of again generating
the data(as per the selection criteria) can be avoided. Now, this View state has a limitation of storage of these records. When we put in some selection criteria, the no. of records is less hence no problem in actually storing the view state. But when there
is no selection criteria, 16306 records are too much to be stored in view state. Hence the error occurs.
We tried to solve this issue by creating a compressor class and overriding two methods:
LoadPageStateFromPersistenceMedium
SavePageStateToPersistenceMedium
This has resolved the issue with Export to Excel. However, there is now some issue in the paging of the list view. The list view has a column with hyperlink which opens related data in a form. While we click on the link in 2<sup>nd</sup>
page of the list view, it displays data for the link in the 1<sup>st</sup> page at same row.
Please suggest how to resolve this issue or any workaround for this -
SSRS 2012 Problem understanding View State Validation steps
Hi,
***** Note I have put my question on Bold to make it easier****
I am trying to Implement this solution on our systems and need help on how to set it up ?
Pasted from
http://technet.microsoft.com/en-us/library/cc281307.aspx?lc=1033
How to Configure View State Validation
To run a scale-out deployment on an NLB cluster, you must configure view state validation so that users can view interactive HTML reports. You must do this for the report server and for Report Manager.
View state validation is controlled by the ASP.NET. By default, view state validation is enabled and uses the identity of the Web service to perform the validation. However, in an NLB cluster scenario, there are multiple service instances and web service
identities that run on different computers. Because the service identity varies for each node, you cannot rely on a single process identity to perform the validation.
To work around this issue, you can generate an arbitrary validation key to support view state validation, and then manually configure each report server node to use the same key. You can use any randomly generated hexadecimal sequence. The validation algorithm
(such as SHA1) determines how long the hexadecimal sequence must be.
1.
Generate a validation key and decryption key by using the autogenerate functionality provided by the .NET Framework.(Well, how to generate Validation key using .Net Framework?)
In the end, you must have a single <machineKey> entry that you can paste into the Web.config file for each Report Manager instance in the scale-out deployment.
The following example provides an illustration of the value you must obtain. Do not copy the example into your configuration files; the key values are not valid.
Copy Code
<machineKey validationKey="123455555" decryptionKey="678999999" validation="SHA1" decryption="AES"/>
2.
Open the Web.config file for Report Manager, and in the <system.web> section paste the <machineKey> element that you generated. By default, the Report Manager Web.config file is located in \Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting
Services\ReportManager\Web.config.
3.
Save the file.
4.
Repeat the previous step for each report server in the scale-out deployment.
5.
Verify that all Web.Config files in the \Reporting Services\Report Manager folders contain identical <machineKey> elements in the <system.web>
Does the key generate using above generates the key with same element ?
Any help on this would be appreciated .
Thank you !
ThanksHi SQL_Help:
Per my understanding that you have some question with the steps descript about "How to Configure View State Validation", you don't know how to generate Validation key and also not clear if all the Web.Config files will add the same
code, right?
We have many method to generate the validation key,details information below for your reference:
Generate either from the machineKey generator utility from
http://aspnetresources.com/tools/keycreator.aspx or your very own utility or from this link: http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx
We can add some code to generate the key, details steps and sample code in article below for your reference:
How to create keys by using Visual C# .NET for use in Forms authentication
We should add the same code which include the generated key in all the web.config file in each server node.
More Details information you can reference to the rticle below:
https://msdn.microsoft.com/en-us/library/ff649308.aspx
If you still have any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
SSRS 2008 R2 Problem understanding View State Validation steps
Hi,
Sorry, but I have some problem understanding this steps. Please help me to understand this.
Pasted from
http://technet.microsoft.com/en-us/library/cc281307.aspx?lc=1033
How to Configure View State Validation
To run a scale-out deployment on an NLB cluster, you must configure view state validation so that users can view interactive HTML reports. You must do this for the report server and for Report Manager.
View state validation is controlled by the ASP.NET. By default, view state validation is enabled and uses the identity of the Web service to perform the validation. However, in an NLB cluster scenario, there are multiple service instances
and web service identities that run on different computers. Because the service identity varies for each node, you cannot rely on a single process identity to perform the validation.
To work around this issue, you can generate an arbitrary validation key to support view state validation, and then manually configure each report server node to use the same key. You can use any randomly generated hexadecimal sequence.
The validation algorithm (such as SHA1) determines how long the hexadecimal sequence must be.
Generate a validation key and decryption key by using the autogenerate functionality provided by the .NET Framework.
(Well, how to generate Validation key using .Net Framework?) In the end, you must have a single <machineKey> entry that you can
paste into the Web.config file for each Report Manager instance in the scale-out deployment.
The following example provides an illustration of the value you must obtain. Do not copy the example into your configuration files; the key values are not valid.
Copy Code
<machineKey validationKey="123455555" decryptionKey="678999999" validation="SHA1" decryption="AES"/>
Open the Web.config file for Report Manager, and in the <system.web> section paste the <machineKey> element that you generated. By default, the Report Manager
Web.config file is located in \Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\Web.config.
Save the file.
Repeat the previous step for each report server in the scale-out deployment.
(Do I need to repeat all 3 previous steps?)
Verify that all Web.Config files in the \Reporting Services\Report Manager folders contain identical <machineKey> elements in the <system.web> section.
ThanksJerry,
Thanks for the reply.
From the above View State Validation Steps,
For 1st step , how to generate validation key using .Net Framework?
for 4th step, Do I need to repeate all 3 previous steps?
Thanks
Kp -
Shoudn't Managed Bean be part of view state?
Hello,
Why does JSF not identify managed bean as part of view state? After all it is beans which provide the data (model) for components in view. Isn't data part of view state?
There are number of problems with 'request' scoped beans - in fact there are enough reasons to question why JSF allowed 'request' scope in first place.
1. Choice of request scope saves storage, but requires the developers to save the bean data in session and restore that data everytime when the bean is reconstructed on subsequent POST backs.
2. Failure to store or restore the bean's previous data results in NullPointerExceptions during APPLY_REQUEST_VALUES phase, when JSF tries to compare old values with new submitted values to broadcast events.
3. This essentially mean beans are required (with old data) right at the APPLY_REQUEST_VALUES phase, same as the view state.
4. Any storing of data in session creates overhead of cleaning it without fail. Failure to clean results in too big session storage affecting performance.
5. Restoring bean state sometimes also means database calls as early as APPLY_REQUEST_VALUES phase - which is not the right phase for such business logic.
JSF spec should at least provide a way for developers to configure the bean to be saved in view state.Hello,
Why does JSF not identify managed bean as part of
view state? After all it is beans which provide the
data (model) for components in view. Isn't data part
of view state?No. MVC is about seperating M-V-C. Model - View - Controller. View == page, Model == data. Data can be very large in some cases, storing it with a page (per user) is not scalable and is not a good idea in many cases.
There are number of problems with 'request' scoped
beans - in fact there are enough reasons to question
why JSF allowed 'request' scope in first place. Request scope is very useful for certain things. I think a "pageScope" is missing, which is why I added it to JSFTemplating (https://jsftemplating.dev.java.net). Request scope is not appropriate for all cases.
1. Choice of request scope saves storage, but
requires the developers to save the bean data in
session and restore that data everytime when the bean
is reconstructed on subsequent POST backs.
2. Failure to store or restore the bean's previous
data results in NullPointerExceptions during
APPLY_REQUEST_VALUES phase, when JSF tries to compare
old values with new submitted values to broadcast
events.
3. This essentially mean beans are required (with old
data) right at the APPLY_REQUEST_VALUES phase, same
as the view state.Both managed beans and the request scope map itself can make this happen transparently.
4. Any storing of data in session creates overhead of
cleaning it without fail. Failure to clean results in
too big session storage affecting performance.I agree.
5. Restoring bean state sometimes also means database
calls as early as APPLY_REQUEST_VALUES phase - which
is not the right phase for such business logic.Depends on how you write your beans / application.
JSF spec should at least provide a way for developers
to configure the bean to be saved in view state.You don't have to use beans let alone use "managed" beans. If you feel your application would be better off storing data w/ the view state... get the UIViewRoot, call setAttribute("key", yourData).
Good luck!
Ken Paulsen
https://jsftemplating.dev.java.net -
Does any one know how to wrap a view in Oracle, I know it is not possible, yet. Are there any third party software to wrap the logic in the view.
Thanks,
SanjayYour best bet is to write a view that queries the source tables and contains any necessary business logic
CREATE VIEW VBASE AS SELECT A.COLUMN_A FROM TABLE_1 A, TABLE_2 B, TABLE_3 C WHERE A.ID = B.ID AND B.ID = C.ID;
create a view for exposure to the user that queries the base view.
CREATE VIEW VSECURE AS SELECT COLUMN_B FROM VBASE;
and grant privileges to VSECURE.
GRANT SELECT ON VSECURE TO SECURE_USER;
This will allow the user to see, query, and describe VSECURE without seeing the definition for VBASE.
The advantage of the this approach is that the query engine can still push predicates down into the base view to optimize the performance or the query where as this is limited with the pipeline function and can become a tuning headache.
eg.
SQL> -----------------------------------------
SQL> -- create some tables
SQL> -----------------------------------------
SQL> CREATE TABLE table_1(ID NUMBER, MESSAGE VARCHAR2(100))
Table created.
SQL> CREATE TABLE table_2(ID NUMBER, message2 VARCHAR2(100))
Table created.
SQL> CREATE TABLE table_3(ID NUMBER, message3 VARCHAR2(100))
Table created.
SQL> -----------------------------------------
SQL> -- populate tables with some data
SQL> -----------------------------------------
SQL> INSERT INTO table_1
SELECT ROWNUM,
CASE
WHEN MOD ( ROWNUM, 50 ) = 0 THEN 'HELLO there joe'
ELSE 'goodbye joe'
END
FROM DUAL
CONNECT BY LEVEL < 1000000
999999 rows created.
SQL> INSERT INTO table_2
SELECT ROWNUM,
CASE
WHEN MOD ( ROWNUM, 50 ) = 0 THEN 'how are you joe'
ELSE 'good to see you joe'
END
FROM DUAL
CONNECT BY LEVEL < 1000000
999999 rows created.
SQL> INSERT INTO table_3
SELECT ROWNUM,
CASE
WHEN MOD ( ROWNUM, 50 ) = 0 THEN 'just some data'
ELSE 'other stuff'
END
FROM DUAL
CONNECT BY LEVEL < 1000000
999999 rows created.
SQL> -----------------------------------------
SQL> --create base view
SQL> -----------------------------------------
SQL> CREATE OR REPLACE VIEW vbase AS
SELECT a.MESSAGE,
c.message3
FROM table_1 a,
table_2 b,
table_3 c
WHERE a.ID = b.ID
AND b.ID = c.ID
View created.
SQL> -----------------------------------------
SQL> --create secure view using base view
SQL> -----------------------------------------
SQL> CREATE OR REPLACE VIEW vsecure AS
SELECT MESSAGE,
message3
FROM vbase
View created.
SQL> -----------------------------------------
SQL> -- create row type for pipeline function
SQL> -----------------------------------------
SQL> CREATE OR REPLACE TYPE vbase_row
AS OBJECT
message varchar2(100),
message3 varchar2(100)
Type created.
SQL> -----------------------------------------
SQL> -- create table type for pipeline function
SQL> -----------------------------------------
SQL> CREATE OR REPLACE TYPE vbase_table
AS TABLE OF vbase_row;
Type created.
SQL> -----------------------------------------
SQL> -- create package
SQL> -----------------------------------------
SQL> CREATE OR REPLACE PACKAGE pkg_getdata AS
FUNCTION f_get_vbase
RETURN vbase_table PIPELINED;
END;
Package created.
SQL> -----------------------------------------
SQL> -- create package body with pipeline function using same query as vbase
SQL> -----------------------------------------
SQL> CREATE OR REPLACE PACKAGE BODY pkg_getdata AS
FUNCTION f_get_vbase
RETURN vbase_table PIPELINED IS
CURSOR cur IS
SELECT a.MESSAGE,
c.message3
FROM table_1 a,
table_2 b,
table_3 c
WHERE a.ID = b.ID
AND b.ID = c.ID;
BEGIN
FOR rec IN cur
LOOP
PIPE ROW ( vbase_row ( rec.MESSAGE, rec.message3 ) );
END LOOP;
END;
END pkg_getdata;
Package body created.
SQL> -----------------------------------------
SQL> -- create secure view using pipeline function
SQL> -----------------------------------------
SQL> CREATE or replace VIEW vsecure_with_pipe AS
SELECT *
FROM TABLE ( pkg_getdata.f_get_vbase ( ) )
View created.
SQL> -----------------------------------------
SQL> -- this would grant select on the 2 views, one with nested view, one with nested pipeline function
SQL> -----------------------------------------
SQL> GRANT SELECT ON vsecure TO test_user
Grant complete.
SQL> GRANT SELECT ON vsecure_with_pipe TO test_user
Grant complete.
SQL> explain plan for
SELECT *
FROM vsecure
WHERE MESSAGE LIKE 'HELLO%'
Explain complete.
SQL> SELECT *
FROM TABLE ( DBMS_XPLAN.display ( ) )
PLAN_TABLE_OUTPUT
Plan hash value: 3905984671
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 16939 | 2365K| | 3098 (3)| 00:00:54 |
|* 1 | HASH JOIN | | 16939 | 2365K| 2120K| 3098 (3)| 00:00:54 |
|* 2 | HASH JOIN | | 24103 | 1835K| | 993 (5)| 00:00:18 |
|* 3 | TABLE ACCESS FULL| TABLE_1 | 24102 | 1529K| | 426 (5)| 00:00:08 |
| 4 | TABLE ACCESS FULL| TABLE_2 | 1175K| 14M| | 559 (3)| 00:00:10 |
| 5 | TABLE ACCESS FULL | TABLE_3 | 826K| 51M| | 415 (3)| 00:00:08 |
Predicate Information (identified by operation id):
1 - access("B"."ID"="C"."ID")
2 - access("A"."ID"="B"."ID")
3 - filter("A"."MESSAGE" LIKE 'HELLO%')
Note
PLAN_TABLE_OUTPUT
- dynamic sampling used for this statement
23 rows selected.
SQL> -----------------------------------------
SQL> -- note that the explain plan shows the predicate pushed down into the base view.
SQL> -----------------------------------------
SQL> explain plan for
SELECT count(*)
FROM vsecure_with_pipe
WHERE MESSAGE LIKE 'HELLO%'
Explain complete.
SQL> SELECT *
FROM TABLE ( DBMS_XPLAN.display ( ) )
PLAN_TABLE_OUTPUT
Plan hash value: 19045890
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 2 | 15 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 2 | | |
|* 2 | COLLECTION ITERATOR PICKLER FETCH| F_GET_VBASE | | | | |
Predicate Information (identified by operation id):
2 - filter(VALUE(KOKBF$) LIKE 'HELLO%')
14 rows selected.
SQL> -----------------------------------------
SQL> -- note that the filter is applied on the results of the pipeline function
SQL> -----------------------------------------
SQL> set timing on
SQL> SELECT count(*)
FROM vsecure
WHERE MESSAGE LIKE 'HELLO%'
COUNT(*)
19999
1 row selected.
Elapsed: 00:00:01.42
SQL> SELECT count(*)
FROM vsecure_with_pipe
WHERE MESSAGE LIKE 'HELLO%'
COUNT(*)
19999
1 row selected.
Elapsed: 00:00:04.11
SQL> -----------------------------------------
SQL> -- note the difference in the execution times.
SQL> -----------------------------------------
Maybe you are looking for
-
Hi, I have this error when I try to run my report thru web console report, and it just happen when I click on the report only. No parameter was selected when I click on the report. "Parameter validation failed. It is not possible to provide valid val
-
Message type 1 unknown error occuring when clicked on IP workbook button
Hi, I am working on authorization. When i click on the save button in an IP workbook button, it throws the message "Message type 1 unknown" saying that an error occured during communication with bw server, and its gets disconnected. I have included a
-
Job termination in source system
Dear All, I am trying to load payroll data using Datasource ZHR_PY_1 . I am doing init data for the first time using infopackage for this datasource. I have tried to pull a couple of years, 2 months, even 1 day of data, but all give me the same
-
HI everyone am having this error when i try to run my simple jsp page 07/03/27 20:14:18 Error initializing server: At least one valid code-source or import-shared-library element is required for shared-library "global.libraries" in /C:/Documents and
-
Using "Pages" as my word processor I can not print a Standard page. Trying to print several copies of a single page gives me every thing parented back to back. What do I do to fix this? (Using iMac OS 10.9.1 and Canon iP4200 printer)