When should use request scope

hi
i don't know when i should use request scope, the example is use session scope always.
Can anyone help me?
thanks!

SpiderFromMars wrote:
> What are the best practices for using the variables
scope versus using the
> request scope when assigning variables.
>
> In other words, when should I use <cfset variables.x
= 'barf'> and when
> should I use <cfset request.x = 'barf'>?
>
The variables scope is only accessible in the current
template. The
request scope is accessible in the current template and any
other
template, such as a custom tag or include file, that is used
to build
the current request.
I.E
<!---index.cfm--->
<cfset variable.x = "foo">
<cfset request.x = "bar">
<cfoutput>#variable.x##request.x#</cfoutput>
<cf_myCustomTag>
<!---myCustomTag.cfm--->
<cfset variable.x = "bob">
<cfoutput>#variable.x##request.x#</cfoutput>

Similar Messages

  • When to use which scope

    Hi,
    I have a CRUD application.. Where in the data is fetched, displayed n edited n stored back to db. Also there is a sequential access between pages & the information entered on the first page is needed on the second page & so forth. What would be the best scope & why ?
    When to use which scope? What is the life-cycle of each scope.
    Also, I couldn't find any good tutorial on scopes. If you are aware of the same, please guide.
    Its urgent.
    Thanks in advance.

    921331 wrote:
    Hi,
    I have a CRUD application.. Where in the data is fetched, displayed n edited n stored back to db. Also there is a sequential access between pages & the information entered on the first page is needed on the second page & so forth. What would be the best scope & why ?
    When to use which scope? What is the life-cycle of each scope.
    Also, I couldn't find any good tutorial on scopes. If you are aware of the same, please guide.
    Its urgent.
    Thanks in advance.You could use ViewScope and parameters to the next view or if using CDI have a look at conversation scope. You should read about them in detail yourself because even if someone chooses one for you it's still you who has to go on to use it correctly.

  • When should use Declarative components?

    What's the Declarative components and when should use them?

    Frank,
    According to the sentiment I get on this Forum sometimes, I thought ADF was supposed to automatically infuse into your brain while the JDeveloper installer ran - who needs documentation?
    In all seriousness, however, The Fusion Developer's Guide is sitting right here on my desktop, and is open more often than not. I think it suffers from the "free is worthless" syndrome - it's got a lot of good information in it, and if it was a published physical book, I'd bet that people would pay for it.
    John

  • How to get detailStamp working in an af:table when using request scope ?

    <af:table var="row" id="t1" value="#{listUsers.users}" summary="Userlist" binding="#{listUsers.ATable}" [...]
    <af:column sortable="false" headerText="Username" id="c13" filterable="true">
    <af:outputText value="#{row.username}" id="ot13"/>
    </af:column>
    <f:facet name="detailStamp">
    <af:panelFormLayout rows="4" labelWidth="33%" fieldWidth="67%" inlineStyle="width:795px" id="pfl1" labelAlignment="start" >
    <af:group id="g1">
    <af:panelLabelAndMessage id="plamNumber" label="Number" for="number">
    <af:outputText value="#{row.address.number}" id="number"/>
    </af:panelLabelAndMessage>
    I feel there is nothing special with this.
    But I've tested with 2 rows in my table and when I disclose rows, I get random results :
    sometimes I get the details related to the row disclosed, but sometimes I get the details of the other row.
    I've read several posts on the subject but none really helpful.
    Another problem ; I've noticed that when I disclose or close a row, getUsers() is called, this method fetch the data from the DB, any way to prevent it ?
    For the second problem, the solution I see would be to : change scope of listUsers to session instead of request, fetch from the DB only when "refresh", not when "detailStamp",
    but I've no clue on how to actually do the "only when part"
    Thanks in advance,
    JP

    Ok when I change the scope of ListUsers to session it's "ok" since I only load the list from the DB once (just like the demo that does not have this problem since the demo does not use the DB)
    When I change the scope for request and that the page is refreshed then the object ListUsers is "recreated" and the data reloaded : that's the expected behavior
    So I prefer to have the scope sets to request
    The problem is that when a user disclose/close a detailstamp and that the scope is set to request,
    then the data is reloaded from the DB
    because apparently this event acts like a "refresh"
    because this event (disclose/close) cause the destruction of what is in the request scope ...
    That's my understanding, probably few mistakes, I'm beginning with ADF/JSF
    It seems that when I load the data from the DB, it's not always in the same order, causing the problem itself probably, which is not ADF related BUT ;
    what I would like to know is how to (elegantly) prevent the event of "disclose/close" to act like a "refresh" ?
    Because even if I fix the "not ADF related problem" (if there is one), loading the list from the DB each time, appears really useless and the DBA won't like me !
    A solution could be to leave the session scope, but then my question would be ;
    *how to know I've to reload from the DB ?"
    I could just "reload it on page load", seems ok to me but
    I'm not sure it's the best, I would like to have your opinion, I've found this article for the "on page load" part ;
    http://groundside.com/blog/DuncanMills.php?title=adf_executing_code_on_page_load&more=1&c=1&tb=1&pb=1
    Thanks,
    JP

  • When should use ACCESS?

    Hi all,
    I have written a java program to load some data (text file) into ACCESS database. It is fine for testing. Once I put it into my real data (about 1.3 MB), it doesn't work. After I check with my tables, some data is missing. I really don't know why. I can't see any exception error messages.
    Then, I suspected that is the problem of ACCESS, therefore, I turned autoCommit into false, and commited it finally, but it still doesn't work. So, are there any techniques can help?
    Actually, can anybody give me some suggestions, how large the data should be stored in ACCESS. When should us give up ACCESS.

    I think it is better for me to answer my question, so
    that it is helpful fo other programmers who have
    encountered same problem.
    This problem doesn't come from wrong codes, but for
    reliability of ACCESS, at least I suspect. In my case,
    although I have only one mega data for loading, this
    data involved a lot of relationship (a lot of tables).
    Therefore, It is not sufficient to just mention how
    large you raw data is. If your raw data will generate
    multiple relationships, it will be another story.
    My solution is, setting autocommit to false, and comit
    it for each 10 objects(which involved several insert
    statements for several tables). It is functionable. I
    think that ACCESS is just for development and testing.
    But, I have a question, who know the max capacity of
    ACCESS in term of MB?
    Still don't know what you are talking about. The usage I saw for MS Access was for financial transactions for banking purposes. I know that it has also been used for medical records. And it has been used extensively for small retail.
    And to my mind that means it is not just "for developement and testing."
    And if you think Oracle and MS SQL Server can't end up with corrupted databases, then you might want to do some research into that. I know that they can. And there is certainly no reason to believe that other databases are perfect in that regard.
    Most of the cases that I am familar with where there are problems with corrupt data in MS Access it can be usually be traced to poor user practices. Such as hitting the power down button instead of using shutdown. And that would undoubtly cause problems with Oracle and MS SQL Server as well, but you don't see that as much because admins deal with servers and their training usually includes enough info so that they know not to do that.

  • Attribute of setting value in request scope

    is there any adf faces tag which is used to set the value in request scope ?

    Hi ..
    No Adf faces tag but you can use request scope in JSF managed the bean classes
    <managed-bean id="__13">
    <managed-bean-name id="__16">MySampleBean</managed-bean-name>
    <managed-bean-class id="__14">bean.MySample</managed-bean-class>
    <managed-bean-scope id="__15">Request</managed-bean-scope>
    </managed-bean>

  • Problem with Commit button When Backing bean is in Request Scope...

    HI Everybody,
    I have a Backing Bean in request scope having over 1000 lines of code, And in my JSPX page I have a table binding with a view object and At run time when user select the row in table and click the edit button so user will be able to edit that selected row in the same table at run time.. but the problem is : when the user enters some data in the Editable inputTexts and then clicks save(Commit), then the save button doesn't work..but when i delete any selected row and then press save then it is working fine..
    And to test it in Session scope i made another sample page where every thing is working very fine..
    Now i want to know What is the difference between Session scope and request scope bean...
    And is there any solution to Save editable input text in Request scope?.
    Also want to know that is it safe to set the scope of my main bean class to session scope without effecting the current running functionality? which is having over 1000 lines of code and lot of component has been placed...
    Please help me to resolve this problem...
    Thanks in Advance to all of you
    Fizzz..

    Hi Frank...
    In my code i used almost same logic as Andrejus Baranovskis has explained in his Editable Table example...
    You can refer that example to see what problem I'm facing...
    http://andrejusb.blogspot.com/2007/04/create-edit-and-delete-operations-in.html
    The Bean Scope in this Example is Session scope...Save button is working fine...
    But as i Change the bean scope to Request scope then Save button is not working for Edit but it is working for Delete Action very well..
    I want that save button should work also for Edit action in Request Scope..
    Please Make me understand that why it is happened like that..
    and help me to find the solution..
    and Also if you have a better document to Explain the life cycle of Application in Different Bean Scope...So please provide me that Doc to me...
    It would be a great help for me to understand the concept of session...
    Thanks Frank
    Fizzz...

  • How to handle Valuechange events, when page bean is in request scope

    Hello balusc and forum mates,
    I want to know is there any good way to handle ValueChangeEvents events, when the page's bean in request scope.
    My problem is, I have a page having more than 1 value change event so How can I maintain page values at backing bean. My bean is request scope, I can't change to session scope.
    Please I really need it.

    Hi Frank...
    In my code i used almost same logic as Andrejus Baranovskis has explained in his Editable Table example...
    You can refer that example to see what problem I'm facing...
    http://andrejusb.blogspot.com/2007/04/create-edit-and-delete-operations-in.html
    The Bean Scope in this Example is Session scope...Save button is working fine...
    But as i Change the bean scope to Request scope then Save button is not working for Edit but it is working for Delete Action very well..
    I want that save button should work also for Edit action in Request Scope..
    Please Make me understand that why it is happened like that..
    and help me to find the solution..
    and Also if you have a better document to Explain the life cycle of Application in Different Bean Scope...So please provide me that Doc to me...
    It would be a great help for me to understand the concept of session...
    Thanks Frank
    Fizzz...

  • When we should use F-54 clear down payment

    Hi,
    When should I use T-code F-54 clear down payment? Is this necessary to perform this step?
    1. F-47 down payment request
    2. F-48 post down payment
    3. MIGO post good receipt of PO
    4. MIRO post vendor invoice
    5. F-58 payment by check (for outstanding balance)
    Any advice are welcome.
    Thanks,
    Wendy

    Dear Wendy,
    usually the steps to perform, when You're using DP,  are the following ones:
    1. F-47 Down payment request
    2. F110 Down payment
    3. FB60 Invoice
    4. F-54 Down payment Clearing
    By F-54 that is the downpayment clearing, the System will close the
    first line item of the downpaymewnt with PK 29A
    by the first line item of downpaymewnt clearing with PK 39A;
    and it opens a new vendor line item by the posting key 26.
    This means that from the financial point of view the system transforms
    the original downpaymen into a partial payment.
    Therefore the downpayment clearing has an economic value.
    It changes the Down payment (that is posted using a special G/L
    indicator) into a partial payment (that does not have any special
    G/L indicator).
    I hope this can help You.
    Mauri

  • Good afternoon. My iphone 4s used in Amerke another user. When you upgrade requests id and password. I can not get it, what to do?

    Good afternoon. My iphone 4s used in Amerke another user. When you upgrade requests id and password. I can not get it, what to do?

    As the previous owner of the phone or set up your own id and passwords.
    You should have perhaps thought about all of these things before buying the phone.

  • Using a request scope object in a javascript function

    Hello,
    is there a way to obtain a reference to a request scope attribute in a javascript function?
    or after using <jsp:useBean id="myBean" ...>, how do I pass the "myBean" object to a javascript fuction?
    Thanks for any help.
    E-

    ok, thanks...this is working for a string property of a bean... but I get an 'invalid character' error when I want to create an actual reference to the bean object itself.
    here is the jist of what I need to get working... myBean has a property 'listItems' that is a Vector of listBeans.
    function buildList() {
    var myBean = <%=request.getAttribute("mybean")%> ;
    // get referenence to the Vector property listItems
    var list = myBean.getListItems();
    // now I want to iterate the list and use the properties of the list beans
    for (x = 0 ; x < list.size() ; x++ ) {
    var listBean = list[x];
    var foo = listBean.getFoo();
    // need to use foo to populate a hierarchical list
    can I do this in JavaScript??? do I need to cast the classes to the variables?

  • When I used Safari to go to the American Express web site a request came up asking me to register my Amex card.  I thought this was strange so I called Amex and they saw it when they went online and they said it was my iPad that had been hacked.  Is there

    When I used Safari to go to the American Express web site a request came up asking me to register my Amex card.  I thought this was strange so I called Amex and they saw it when they went online and they said it was my iPad that had been hacked.  Is there an app to protect my iPad when I am online with sensitive information?

    I located some suggestions for flushing the cache.
    There are really three ways you can flush the DNS cache on your iPad.
    1) Simply turn the iPad off and on again using the power button. A simple reboot will go a long way.
    2) Turning on Airplane mode and then turning it off again will also clear the DNS cache and should be enough to fix the problem. Tap on your Settings icon, then swipe Airplane mode to On and then back off. Since Airplane mode disables the wireless features of your iPhone, iPad, or iPod touch to comply with airline regulations, this will generally do the trick.
    The third method would reset all your network settings and I'm pretty sure you don't want to do that right now.

  • Null values returned when using request.getParameters(

    I have a html form which allows the user to choose options and select a file to upload. When I use method=Post I get null values returned. When I use method=Get I get my parameter values fine.. but I get an error.
    "Posted content type isn't multipart/form-data"
    I would like to know why I am getting null values returned when using Post. I am using the following to get the values from the name=value passed to the servlet.
    String strIndustry = request.getParameter("frmIndustry");
              String strCompany = request.getParameter("frmCompany");
              String strCollabType = request.getParameter("frmCollaboration");
    I have another form where the user can search information in a database that works just fine w/ either Get or Post
    Or perhaps I am using oreilly MultipartRequest incorrectly??? but I copied it directly from another discussion.. ???
    any thoughts
    Thanks

    taybon:
    you could do it like this. in this case, you submit your form with the parameters (industry, company, collaboration), and upload your file at the same time. and in the target servlet, you can build your MultipartRequest object like this:
    MultipartRequest multi = new MultipartRequest(request, temp_location, 50 * 1024);where variable temp_location stands for a temporatory diretory for file uploading.
    and then you get your parameters, so you can build the directory with them. and after that, you can move your file to that directory using File.renameTo();
    but as i've suggested in my previous posting, i just recommend you upload your file in a separate form. and then you can perform an oridianry doPost form submit with those parameters. or you may have problems with the file uploading. (this is just my personal experiences with Multipart).
    there is one other thing i'd like to mention, file.renameTo() won't work if you need to move files to a network drive in windows. it won't work if you move files across file systems in unix.
    Song xiaofei
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • I recently bought an ipad 2 and wanted to use all the apps on my iphone4 on my ipad but have been charged when I use my apple id. What should I have done to share the apps?

    I recently bought an ipad 2 and wanted to use all the apps on my iphone4 on my ipad but have been charged for the first app I downloaded when I use the same apple id. What should I have done to share the apps and should I have been charged? 2 months ago when I got a new iphone, i was told in order to get all my apps back as I hadn't backed up my files, if I used the same apple id I would 'purchase' the app, but then would not be charged as apple would recognise that I have already purchased the app. That worked, but when I did the same thing on my ipad 2 using the same apple Id, I was charged... what should I have done and is this right as I thought the whole point of having multiple apple devices was I could share apps between devices. please help! thanks.

    Using the same Apple id and Password you should be able to download purchased apps without being charged again.
    I download to an iPad/iPad2/iPhone3 & iPhone4 with no problem.

  • Please help me!!!! my macbook pro 15 running on mountain lion is hanging a lot...sometimes when i use any app than it get freeze for some seconds...what should i do?

    please help me!!!! my macbook pro 15 running on mountain lion is hanging a lot...sometimes when i use any app than it get freeze for some seconds...what should i do?

    Hardware Information:
              MacBook Pro - model: MacBookPro8,2
              1 2.2 GHz Intel Core i7 CPU: 4 cores
              4 GB RAM
    System Software:
              OS X 10.8.2 (12C60) - Uptime: 0 days 1:17
    Disk Information:
              TOSHIBA MK5065GSXF disk0 : (500.11 GB)
                        disk0s1 (disk0s1) <not mounted>: 209.7 MB
                        Macintosh HD (disk0s2) /: 499.25 GB (424.92 GB free)
                        Recovery HD (disk0s3) <not mounted>: 650 MB
              HL-DT-ST DVDRW  GS31N 
    USB Information:
              Apple Inc. BRCM2070 Hub
                        Apple Inc. Bluetooth USB Host Controller
              Apple Inc. Apple Internal Keyboard / Trackpad
              Apple Inc. FaceTime HD Camera (Built-in)
              Apple Computer, Inc. IR Receiver
    FireWire Information:
    Kernel Extensions:
    Problem System Launch Daemons:
                     [failed] com.apple.coresymbolicationd.plist
    Problem System Launch Agents:
                     [failed] com.apple.afpstat.plist
                     [failed] com.apple.AirPlayUIAgent.plist
                     [failed] com.apple.coreservices.appleid.authentication.plist
                     [failed] com.apple.rcd.plist
    Launch Daemons:
                     [loaded] com.adobe.fpsaud.plist
                     [loaded] com.adobe.SwitchBoard.plist
                     [loaded] com.google.keystone.daemon.plist
                     [loaded] com.microsoft.office.licensing.helper.plist
    Launch Agents:
                     [loaded] com.adobe.CS5ServiceManager.plist
                     [loaded] com.google.keystone.agent.plist
    User Launch Agents:
                     [loaded] com.adobe.ARM.202f4087f2bbde52e3ac2df389f53a4f123223c9cc56a8fd83a6f7ae.plist
                     [loaded] com.facebook.videochat.Akshay.plist
                     [loaded] com.microsoft.LaunchAgent.SyncServicesAgent.plist
    User Login Items:
              Sony Ericsson Bridge Helper
              BitTorrent
              uTorrent
    3rd Party Preference Panes:
              Flash Player
              Java
    Internet Plug-ins:
              AdobePDFViewer.plugin
              AdobePDFViewerNPAPI.plugin
              Flash Player.plugin
              FlashPlayer-10.6.plugin
              googletalkbrowserplugin.plugin
              JavaAppletPlugin.plugin
              npgtpo3dautoplugin.plugin
              QuickTime Plugin.plugin
              SharePointBrowserPlugin.plugin
    User Internet Plug-ins:
              Google Earth Web Plug-in.plugin
              Picasa.plugin
    Bad Fonts:
              None
    Top Processes:
              14.6  %          WindowServer
              6.9   %          coreaudiod
              6.4   %          uTorrent
              1.9   %          WebProcess
              1.4   %          iTunes
              1.2   %          EtreCheck
              0.5   %          fontd
              0.2   %          NotificationCenter
              0.1   %          Dock
              0.0   %          Microsoft

Maybe you are looking for