How To Retrieve an Object's Value Defined Using c:set ... Tag?

I have the value of a variable defined in JSP#1 (JSP#1 is not a form) using JSTL tag:
   <c:set var="id" value="${articleForm.article}" scope="session"/>Now, I have an object 'id' in the session scope. The object 'id' and all the information, which are defined in JSP#1, are forwarded to JSP#2.
JSP#2 is a form. But, the 'id' is not used in JSP#2.
JSP#2 has a submit button and then, a servlet takes over the control after that button is clicked. All the text fields in JSP#2 together with the object 'id' are forwarded to this servlet.
I have two questions:
1. I should put this object 'id' in a request scope or a session scope? Currently, it is in a session scope.
2. How to retrieve the value of this object 'id' in this servlet? (I do not want to print the value out. I want to retrieve the value and store it in a database.)
    int articleID = Integer.parseInt( session.getAttribute( "id" ) );   or, it should be retrieved in another way?

I'm not sure you understand the concept of a session object.
Java objects stay on the server. There is no transmission between the web browser and the client.
The scope just sets how long the server "remembers" that variable.
request scope - only lasts one request. Once a web page is returned to the client, the server forgets all request variables.
session scope - lasts for one user - across multiple requests/web pages.
1. I should put this object 'id' in a request scope or a session scope? Currently, it is in a session scope.From your description, you appear to have it right - your object should be in session scope.
2. How to retrieve the value of this object 'id' in this servlet? (I do not want to print the value out. I want to retrieve the value and store it in a database.)If articleForm.article is an String then that looks the right way to access it.
You might have to do it like this:
int articleID = Integer.parseInt( (String)session.getAttribute("id"));
The Integer.parseInt method takes a String as a parameter - while session.getAttribute() returns an Object.
This code will work if the object stored in the session is a String.
The object stored in the session is ${articleForm.article} What type does articletForm.getArticle() return? That is the type you need to cast it to when retrieving it from the session.
Cheers,
evnafets

Similar Messages

  • How to retrieve BASIC-auth username value when using JDBCRealm constraint?

    I have a web application that uses a JDBCRealm security constraint configured as thus in my server.xml and web.xml for the context:
    http://pastebin.ca/41635 (pastebin'ed to be brief)
    After a user enters their BASIC credentials, how can I retrieve the username they logged in with?
    For example, I have in mind something like this that I want to display in my JSP in the application:
    Welcome back, <% out.print(request.getAuthUsername()); %>!
    But there doesn't seem to be a ServletRequest method in the API to get this information.
    Is this possible?

    Answer:
    <c:out value="${pageContext.request.remoteUser}"/>

  • How to retrieve a page item value in another page?

    Hi,
    how to retrieve a page item value in another page?
    say P55_COURSES_TO_EVALUATE is my page item name and it is a select list.Based on the value selected,in the next page i shd show details related to the selected value and for this i need P55_COURSES_TO_EVALUATE value in the next page.How Do I get it?When I try to retrieve the values it simply returns nothing.
    Any pointers would be really helpful.
    Thanks in advance.

    Hi,
    Could you please tell how you try use it ?
    If you set value to item P55_COURSES_TO_EVALUATE and submit page, value is saved to session state.
    Then you can use that item in any page like
    :P55_COURSES_TO_EVALUATEYou can not access page value in javascript/jQuery from other pages like
    $v('P55_COURSES_TO_EVALUATE')
    document.getElementbyID('P55_COURSES_TO_EVALUATE')
    $(#P55_COURSES_TO_EVALUATE)Because item is not in other pages. In javascript from other pages you can use
    var a = '&P55_COURSES_TO_EVALUATE.';Regards,
    Jari

  • How to retrieve data from domain(Value Range)  of the table

    hi
    how to retrieve data from domain(Value Range)  of the table
    thanks

    Hello,
    You can try using the FM: DOMAIN_VALUE_GET TB_DOMAINVALUES_GET.
    BR,
    Suhas
    Edited by: Suhas Saha on Mar 24, 2009 10:08 AM

  • How to retrieve the Last sequence value of a sequence ?

    Can anybody help me out regarding how to retrieve the last executed number or value of a sequence ? As dba_sequence.last_number does not show the original picture of that last value ?

    Rajesh Lathwal wrote:
    Last Number Selected From Sequence :
    SELECT sequence_name, last_number
    FROM user_sequences;That's wrong, this is taking the CACHE in account :
    SQL> create sequence seq ;
    Sequence created.
    SQL> select seq.nextval from dual;
       NEXTVAL
             1
    SQL> SELECT sequence_name, last_number
      2  FROM user_sequences where sequence_name='SEQ';
    SEQUENCE_NAME                  LAST_NUMBER
    SEQ                                     21
    SQL> select seq.currval from dual;
       CURRVAL
             1
    SQL>Nicolas.

  • How to Retrieve Purchase order TAX value price

    Hi,
    I want to retrieve Purchase order TAX value price from the purchase order is there any function module to retrieve this value.  Or from which table we can retrieve this value using purchase order no.
    Thanks in advance

    Hi Pradeep,
    Have you looked BAPI <b>BAPI_PRICES_CONDITIONS</b>?
    Hope this will help.
    Regards,
    Ferry Lianto

  • How to decide which Object has to be used while maintianing TBD62

    Hi ,
    I was trying  configure ECC for transfer of customer master data changes to GTS , i came to know that i need to maintain table TDB62 using Tcode BD52 for the table and field name then only pointer to Table BDCP will be created.
    I did maintain entries in TBD62 and the changes transfer for customer master data worked.
    Now My Question how i will decide against what object i will define the table and field name in TBD62 for a particular message type.
    I am trying to know about mesage type /SAPSLL/DEBMAS_SLL  this is to transfer any changes to customer master data to GTS.
    Kind Regards,
    Sameer

    Hi Thiru,
    Go thur these
    http://help.sap.com/saphelp_erp2005/helpdata/en/fa/097119543b11d1898e0000e8322d00/frameset.htm
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/BDC_tutorial.html
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sap-img.com/bdc.htm
    http://www.sap-img.com/abap/learning-bdc-programming.htm
    http://www.sapdevelopment.co.uk/bdc/bdchome.htm
    http://www.planetsap.com/bdc_main_page.htm
    May be the difference helps you understand:
    -     The most important aspects of the Batch session interface are:
    1) Asynchronous processing
    2) Transfers data for multiple transactions
    3)Synchronous database update
        During processing, no transaction is started until the previous transaction 
        has been written to the database.
    4)     A batch input processing log is generated for each session           
    5)     Sessions cannot be generated in parallel
    The most important aspects of the CALL TRANSACTION USING interface are:
    1) Synchronous processing
    2) Transfers data for a single transaction
    3) Synchronous and asynchronous database updating both possible
    The program specifies which kind of updating is desired.
    4) Separate LUW for the transaction : The system performs a database commit immediately before and after the CALL TRANSACTION USING statement.
       5) No batch input processing log is generated
    <b>See the below article, which will show which is one is better</b>
    http://www.itcserver.com/blog/2006/06/30/batch-input-vs-call-transaction/
    <b>Reward points if this helps.
    Manish</b>

  • How to retrieve public/ private from iKey token using Sun PKCS#11 provider

    Dear all,
    I'm trying to access one rainbow iKey 2032 token in Java 1.5 (Windows Environment) using Sun PKCS#11 provider. Token is stored with certificate. There is no problem to logging into the token using java.
         Provider p = new sun.security.pkcs11.SunPKCS11(configName);
         Security.addProvider(p);
         KeyStore ks = null;
         try{
              char[] pin = {'P','A','S','S','W','O','R','D'};
              ks = KeyStore.getInstance("pkcs11");
              ks.load(null,pin);
    catch(Exception e) {}
    Now I am wondering how to retrieve a public and private from token, so that I can encrypt and decrypt a plain text file. Could anyone give me a sample program for this?
    Your help is very much appreciated!!

    Hi Fred13
    1. I have the same pkcs.cfg and get the following trace. Can you help me understand? Does this imply a bad dkck201.dll? I would really like to get this working for my implementation. tia.
    lException in thread "main" java.security.ProviderException: Initialization failed
         at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:175)
         at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:76)
         at com.mkp.jce.chap1.ProviderDetail.main(ProviderDetail.java:38)
    Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_TOKEN_NOT_RECOGNIZED
         at sun.security.pkcs11.wrapper.PKCS11.C_GetTokenInfo(Native Method)
         at sun.security.pkcs11.Token.<init>(Token.java:105)
         at sun.security.pkcs11.SunPKCS11.initToken(SunPKCS11.java:555)
         at sun.security.pkcs11.SunPKCS11.<init>(SunPKCS11.java:169)
    2. (If I can be so indulgent of your time) Can you provide more information on cbp? I have done a search and there is little on it. It appears to be a new authentication framework tied in with sasl unique to 1.5. Any links for self education would be appreciated.

  • How to retrieve system Information on client machine Using Applets

    How to retrieve video card information on client machine using applets and JNI, please suggest me on this
    Thanks
    GReddy

    1. Research platform specific OS API to do whatever you want with video cards
    2. Write C/C++ code to wrap the functionality in 1 into something looks closer to what you want to see in java
    3. Write a class that models the functionality of 2 with native methods.
    4. Write the native methods of 3 such that they call the methods of 2.
    Note that steps 1 and 2 have NOTHING to do with jni nor java. So you start by looking somewhere else for the answers to that.

  • How to get Implicit Dimensions/Dimension Values in the result set?

    Hi All,
    How does endeca return implicitly selected dimensions in the result set? For example, consider a dimension set up for Television data as below.
    Brand
    Samsung
    LG
    Philips
    Type
    LEDs
    LCDs
    Plasma
    Lets say, I refine the result set by brand, by selecting Philips. Now lets assume that there were 2 results returned for philips and both the results were of Type - Plasma. In this case, Endeca does not return the Type dimension in the result set, as we cannot drill down the 2 results further based on LED or LCD.
    How does Endeca return these implicit dimensions in the result set in such scenarios? Suppose if there was a requirement to show to the user that both the results were of Type - Plasma, how do we get this information from Endeca, by default?
    Thanks in advance :)

    How does Endeca return these implicit dimensions in the result set in such scenarios?Check out: Navigation.getCompleteDimensions() or Navigation.getCompleteDimGroups()
    http://docs.oracle.com/cd/E28910_01/PresentationAPI.622/apidoc/javadoc/navigation/index.html

  • How to fix "Must be literal" error when using a4j:keepAlive tag?

    Hi everybody,
    When I use <a4j:keepAlive> tag of Richfaces like this:
    <a4j:keepAlive beanName="#{templateController.currentType}"/>I got the an error like this:
    /templates.xhtml @20,91 <a4j:keepAlive beanName="#{templateController.currentType}"> Must be literalIn my class, I have declared as:
    class TemplateController{
        private TemplateType currentType;
        public void setCurrentType(TemplateType type) {
        public TemplateType getCurrentType() {
    }I implemented as guide from Richfaces document but don't know why this happened.
    Could anyone tell me why? Please help me to fix it.
    I really appreciate it,
    Ringo
    Edited by: Ringo.CS on Jun 19, 2008 3:42 AM
    Edited by: Ringo.CS on Jun 19, 2008 3:43 AM

    No, the error message says that the value must be a literal and thus not an EL. I don't know anything about Ajax4jsf (you're in the wrong place to ask questions about it, rather use the forums of the Ajax4jsf manfacturer at jboss.com), but the attributename and errormessage together makes it logical to put just the raw managed bean name in there. If this is not what you're after, then just consult their documentation and forums at jboss.com.

  • Problem retrieving mapped objects after SQL defined readAllQuery

    Working with toplink 9.0.4 I am trying to implement a retrieval mechanism where a number of toplink read queries are created, and are then executed all together in a UnitOfWork. Most of the queries are built up using expression builder or just by getting mapped properties from a base object. However, one of the queries is too complex for expression builder and is therefore defined with raw SQL something like this:
    String theSQL = "SELECT otherPeople.* FROM PEOPLE otherPeople, /* several more tables */ WHERE /*horribly complex where clause */";
    ReadAllQuery formQuery = new ReadAllQuery(Person.class, new SQLCall(theSQL));
    When this query is executed it returns a List of Person objects with the correct primary key (Id) fields.
    The problem is that when an attempt is made to retrieve properties mapped from the Person objects, toplink issues a query which is lacking the foreign key = specific value (e.g. PERSON_ID='437216' ) part of the where clause. This, of course tries to retrieve an entire table ending with an OutOfMemory error.
    My question is how do the objects retrieved by the SQL based ReadAllQuery differ from those retrieved by an expression builder based query, since mapped properties on those work correctly.
    I feel sure that I am missing something quite simple.
    Any thoughts ?
    Mike

    Relationship queries should work correctly when the original object is read through custom SQL.
    My guess would be that either batch reading has been specified with the read all query, or the object has a relationship that has been marked to always be batch read in the mapping. Batch reading is not supported with custom SQL queries, so you must not use batch reading if using custom SQL.
    You can also try contacting Oracle technical support to see if a patch is available that either throws an exception when batch reading with custom SQL is attempted, or ignores the batch setting with custom SQL.

  • How to retrieve unchecked default remind value in exchange web service

    I can get the default remind minutes value from user configuration dictionary property ('piRemindDefault'). How do I get the value from EWS if I uncheck the Default reminder checkbox in outlook calendar option. Thanks.
    The 'piRemindDefault' properity always return value even I unchecked the 'Default Reminders:' checkbox in calendar option.
     

    The piRemindDefault is just the default reminder period (which is 15 minutes by default) so even when you untick reminders its not going to change the value. You looking at the Calendar Config object to get the reminders option you need to look at the OWA.UserOptions
    config object in the root of Mailbox eg
    FolderId RootFolderi = new FolderId(WellKnownFolderName.Root, "[email protected]");
    UserConfiguration usConfig = UserConfiguration.Bind(service, "OWA.UserOptions", RootFolderi, UserConfigurationProperties.All);
    if (usConfig.Dictionary.ContainsKey("enablereminders"))
    Console.WriteLine(usConfig.Dictionary["enablereminders"]);
    Cheers
    Glen

  • How to retrieve the data/property value from portalapp.xml

    Hi I would like to retrive the some common data from the portalapp.xml file
    <application>
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
          </application-config>
      <components>
        <component name="DynZMMGR">
          <component-config>
            <property name="ClassName" value="DynZMMGR"/>
            <property name="SecurityZone" value="DynZMMGR/high_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/DynJspZMMGR.jsp"/>
          </component-config>
          <component-profile/>
        </component>
        <component name="dynpagedel">
          <component-config>
            <property name="ClassName" value="dynpagedel"/>
          </component-config>
          <component-profile/>
        </component>
        <component name="VARIANTLIST">
          <component-config>
            <property name="ClassName" value="com.sap.ep.r3rpts.VARIANTLIST"/>
            <property name="SecurityZone" value="com.sap.ep.r3rpts.VARIANTLIST/high_safety"/>
          </component-config>
          <component-profile/>
        </component>
        <component name="DynZMM33">
          <component-config>
            <property name="ClassName" value="DynZMM33"/>
            <property name="SecurityZone" value="DynZMM33/high_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/DynJspZMM33.jsp"/>
          </component-config>
          <component-profile/>
        </component>
      </components>
      <services/>
    </application>
    The above is my portalapp.xml file .
    I want to retrieve the common data across the component.
    These  datas are common across the components .
    I kmow by putting the data inside the
    component name="DynZMM33">
          <component-config>
            <property name="ClassName" value="DynZMM33"/>
            <property name="SecurityZone" value="DynZMM33/high_safety"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/DynJspZMM33.jsp"/>
          </component-config>
    <component-profile>
       <property name="UserID" value="userid"/>
       <property name="password" value="password"/>
    </component-profile>
    </component>
    this becoms component specific ... which I can retriev the by using
    String ClientVal = request.getComponentContext().getProfile().getProperty("Client");
    in doContent()  method ..
    But this way i have to specify these properties in all the component.. which is repetetive in nature.
    I would rather put it in common location and want to retrieve the info from the portalapp.xml...
    How to achieve this
    I am using "AbstractPortalComponent"  .
    thanks
    pkiran

    Hi Prashanth,
    see Reading another iView's profile personalized values and Validate PCD URI
    Anyhow, maybe you should implement a service which returns the values (from the service profile). This would be more clean for accessing global values.
    Hope it helps
    Detlev

  • How to retrieve a jsf component value of portlet based Faces JSP ?

    In my JSF JSR 168 spec application, I need to perform Javascript client-side validations like null-check etc. in my Faces JSP.
    In my JSP, I have a text field and a button which calls the validate method.
    <f:view>
    <h:form styleClass="form" id="schedulerForm" >
    <hx:scriptCollector id="scriptCollector1">
    <h:inputText styleClass="inputText" id="eventName"  required="true" value="#{schedulerBean.eventName}">
    </h:inputText>
    <h:commandButton id="TestButton" value="Validate" onclick="validate();"></h:commandButton>and the javascript method is :
    <script language="JavaScript">
         function validate(){
            var form = document.schedulerForm;
            alert(form.eventName.value);
          return false;
    </script>
    </hx:scriptCollector>
    </h:form>But I am get the alert "Undefined".
    All I want is to check if the eventName field is null. So when the button is clicked, the eventName field should be checked against null condition. But since this is running in JSF JSR 168 portal,I think the form gets encoded, and in the view source, I could see that form id is encoded.
    So how can I get the encoded formname in my Javascript, inorder to access the components?.
    In Struts we use PortletApiUtils class to retrieve the encoded bean name, similarly is there any class that we can use to get the encoded form name in Faces Portlets JSP?.
    Please help me.

    Thanks for the IDea, but although the code compiles and seems to work fine, the real result is that the ID of <f:subiew> is still the same as designed in the "logo.tag" file. In other words - setting ID at run time has no effect.
    Actually I'm trying to solve the problem when I use the tag more than once - I would like to have access to all "f" and "h" controls in every tag. But waht happens when the tags are placed dynamically? Let's say I have "<h:dataTable>" with unknown number of rows and in every row I would like to place such a tag (or something else with ID). How do you solve such situations?

Maybe you are looking for