How to get the variable set by c:set in Scriptlet ?

Hello,
I set up some variables by <c:set> and struts tag <bean:size>, and the values should be considered as integers. How can I use the variables in math expression?
When I try to use the variables in scriptlets, I got compile errors in the getAttribute lines.
My code:
<bean:size id="listSize" name="list" /> <c:set var="pageSize" value="${20}" />
<c:set var="pageBegin" value="${param.pageBegin}" />
<%
int ls = (Integer)pageContext.getAttribute("listSize");
int ps = (Integer)pageContext.getAttribute("pageSize");
int totalPages = (int)Math.ceil((double)ls / ps);
%>

xiaoxuan_li wrote:Hello,
I set up some variables by <c:set> and struts tag <bean:size>, and the values should be considered as integers. How can I use the variables in math expression?
When I try to use the variables in scriptlets, I got compile errors in the getAttribute lines.
My code:
<bean:size id="listSize" name="list" />
<c:set var="pageSize" value="${20}" />
<c:set var="pageBegin" value="${param.pageBegin}" />
<%
bq. int ls = (Integer)pageContext.getAttribute("listSize"); \\ int ps = (Integer)pageContext.getAttribute("pageSize"); \\ int totalPages = (int)Math.ceil((double)ls / ps);
%>I finally find the errors, I change the getAttribute() lines to the following, and the program runs well, although I'm still curious of if there is a better way to get the value of totalPages by using JSTL tags, instead of scriptlets.
<%
bq. {color:#ff0000}Number {color}ls = {color:#ff0000}(Number){color}pageContext.getAttribute("listSize"); \\ {color:#ff0000}Number {color}ps = {color:#ff0000}(Number){color}pageContext.getAttribute("pageSize");
%>

Similar Messages

  • How to get the variable value of a step (ex : Step.TS.Data) with C#?

    I try hard but do not managed, I can't get the variable situaded inside a step?
    I have created my sequence object then my step object (I can get the right name of this one)
    but I didn't find in the help the method allowing to get any value of the step variables.
    Any idea? Thank you

    Hi,
    You obtain a reference to your step as an PropertyObject.
    Using this PropertyObject reference you can use the PropertObject.GetValString|GetValNumeric|GetValBoolean.
    Hope this helps.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to get the result set in batches

    I have a query which results into large data. This data i want to display in a group of 20. After every 20 records i want to add header and footer to it.
    Is it possible to get the result set data into batch of 20 ? means can i specify start and end index of query ?
    regards
    Manisha

    What I am saying is that a big query with lots of
    joins will probably be slow, and as such would be a
    ripe candidate for batching the responses, if it were
    not possible to speed/optimize it. Batching is nice
    to look at for the user, but is not a solution for
    performance problems. In essence it is irrelevant
    that it adds a little performance deficit, as it
    appears to be running a lot quicker, and gives more
    feedback to the user.Then let me say it again....
    - "Join" is a term that applies to a method of doing queries in the database....
    - Query 1 which uses a join and returns 15 rows
    - Query 2 which does not use a join and returns 1500 rows.
    Given the above then Query 1 will provide better overall performance for the system than Query 2 in a properly configured database.
    If it doesn't then the database is not set up correctly.
    And again this will be irrespective of whether the query is scrollable or not.

  • How to get the record set into array?

    Hi,
    I want to get the record set into array in the procedure and do the processing of the array later in procedure.
    below is the stored procedure i am working on:
    procedure bulk_delete_group(p_group_id in Array_GroupListID) as
    begin
    for i in p_group_id.first..p_group_id.last loop
    --Here I have to get the list of user id before deleting group
    SELECT user_id into *<SOME ARRAY>* FROM group_members WHERE group_id = p_group_id(i);
    DELETE group WHERE group_id = p_group_id(i);
    --Process the user id array after group deletion..
    end loop;
    end bulk_delete_group;
    Thanks in advance
    Aditya

    Something like this ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    13 rows selected.
    Elapsed: 00:00:02.37
    satyaki>
    satyaki>create type np is table of number;
      2  /
    Type created.
    Elapsed: 00:00:03.32
    satyaki>
    satyaki>Create or Replace Procedure myProc(myArray np)
      2  is
      3    i   number(10);  
      4    rec emp%rowtype;  
      5  Begin  
      6    for i in 1..myArray.count
      7    loop  
      8      select *  
      9      into rec 
    10      from emp 
    11      where empno = myArray(i); 
    12     
    13      dbms_output.put_line('Employee No:'||rec.empno||' Name:'||rec.ename); 
    14    end loop; 
    15  End myProc;
    16  /
    Procedure created.
    Elapsed: 00:00:00.88
    satyaki>
    satyaki>
    satyaki>declare
      2    v np:=np(9999,7777);  
      3  begin  
      4    myProc(v);  
      5  end;
      6  /
    Employee No:9999 Name:SATYAKI
    Employee No:7777 Name:SOURAV
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.30
    satyaki>Regards.
    Satyaki De.

  • 865PE NEO2 need help on findout how to get the memory set to dual and a bit of overclocking

    hello everyone all`s it is i need some advice how to find out that my motherboard is set right and my memory is set to dual. at the moment i have my memory 3200 512ram in DIMM 1 A and in DIMM 3 B can anyone tell me if this is right for my motherboard (865PE NEO2 ) and can anyone tell me the best setting to have to overclock my system at the moment i have 2.5 proccesor overclocked to 2.7.

    Your memory is in the correct location for Dual Channel.
    Btw, providing us your full system and PSU specs will be better for us to give you directions.

  • How to get the variable value in description if I am writing a condition

    I have created a query for TOP N Customers and
    and for N  I am passing as a varaible
    & I want the same value to be displayed in the description
    I tried a lot but I dont  know how to do it
    can any one tell me the solution for this
    Thx & regards

    Hi,
    You have to define a Text Variable of type customer exit and pass the value of the Variable you have created for the condition in the Exit Code.
    You have to use the correct I_Step = *.
    Cheers.
    Ranga.

  • How to get the character set which i want it to be?

    i confront a problem, when using jdbc to connect to oracle8i database on solaris; because i use getBinaryStream() to read from db in "byte" reading, seemly it would use default character set on OS or database(such as EUC,etc.), not which the client i want it to be. is there anyway to take control of such code writing(i mean to change the character set when i get byte out of database, thus the byte would use NLS_LANG the same as using sqlplus setting in user env)?

    First of all read Note 581312 - Oracle database: licensing restrictions:
    As of point 3, it follows that direct access to the Oracle database is only allowed for tools from the areas of system administration and monitoring. If other software is used, the following actions, among other things, are therefore forbidden at database level:
    Creating database users
    Create database objects
    Querying/changing/creating data in the database
    Using ODBC or other SAP external access methods
    Are you trying this on the database server itself? If yes, then you need to install the hebrew codepages as well as hebrew fonts in order to display the data correctly.
    Markus

  • How to get the variable value in a flatfile

    I have some 2 line string in a variable I wanted to see this value in a flat file.
    Thanks,
    Narthan

    Hi Narthan,
    If I understand correctly, you want to use some variables in a Flat File Connection Manager. If in this case, we can use variables in a Property of Flat File Connection Manager. For more details, please refer to the following steps:
    Click the Flat File Connection Manager in Connection Manager tab, then navigate to Properties window.
    Click “…” next to the Expressions property to open the Property Expressions Editor.
    In the Property Expressions Editor dialog box, select the corresponding property at the Property drop-down list.
    Click “…” next to the Expressions property to open the Expression Builder, then expand Variables and Parameters folder to select the variable.
    Reference:
    http://www.mssqltips.com/sqlservertip/1084/dynamic-flat-file-connections-in-sql-server-integration-services/
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to get the variable value while starting a session?

    When to execute an interface or scenario, if there are variables related, the session will keep the value of those variables in case to restart the session after failure. However I can't find where they are stored in ODI Repository. Could anyone give me a hand?
    Thanks in advance!
    Best wishes,
    Satine

    See if this helps you
    SELECT svd.var_name,
           svd.var_n AS numval,
           svd.var_d AS dateval,
           svd.var_v AS strval
    FROM snp_var_data svd,
         (SELECT sp.project_code || '.' || sv.var_name AS fullvarname
          FROM snp_project sp, snp_var sv
          WHERE sv.i_project = sp.i_project) svp,
         snp_var_sess svs
    WHERE     svd.var_name = svp.fullvarname
          AND svs.var_name = svd.var_name
          AND svs.sess_no = :sess_no

  • Where/How to get the initial set of loops

    GarageBand is displaying the initial loops greyed out, and when I click one a dialogue comes up saying they're not installed. I'm given the option to Download now, later, or from disk. Since iLife came installed on my mac I have no disc. So's I select download now, and it shuffles me over to Software Update... which informs me that there are no new updates and quits itself. Attempting to re-open the dialogue in GB gives me a message saying that the download/install is underway, but there is no evidence of such.
    So's... is there any way I can manually download and install these loops? Or, at the very least, remove the greyed out one from the library?
    I'm suspecting that I refused this update early on or something... I've had my mac for about a year and a half but no need to use GarageBand until now.

    http://www.bulletsandbones.com/GB/GBFAQ.html#noloops
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • How to get the Current Date in webdynpro java

    Hi Experts,
                 In my project i have two date input fields called
                        1)Start Date
                      2)End Date   
    and one Absence type input field is there. The user wants to set the start Date ,End date and absence type.
    How to get the user set values in my project.i.e how to get the user inputs and the started date must be current date of the system and end date must be after the 3 months.
    Can any body send code regarding this.
    Thanks in advance.
    Regards,
    Venkat.
    Edited by: Venkat5939 on Jan 11, 2011 4:46 PM

    Hello Venkat,
    Current Date:
    Date date = new Date(System.currentTimeMillis());
    For getting the date after three months refer the following threads:
    Set date in a date field
    Date Function
    date format
    Hope it helps.
    Regards
    Nizamudeen SM

  • How to get the input value as a columns headings of the kye figer

    Dear all,
    the senario is i have keyfiger heading like DESPATCHES MADE ON (0CALDAY) and CUMMULATIVE DESPATCHES FOR (0CALMONTH), the 0CALDAY is the input value of the report. so how to get the value of the 0CALDAY and 0CALMONTH in the heading name of the key figer.
    I really appreciate for any help on this.
    wil assign pts for sure...
    thanks
    regards
    Mohan

    Dear  Venkat Ambati,Sumit Singn,Masi dandavate,
    thanks for reply.....
    ya got u r value able inputs but i don't no how to get the variable value to the column heading, if u guy's having any doc's means plz send me the same, my mail id is <u><i>[email protected]</i></u> or <i><u>[email protected]</u></i>
    thanks n regards
    Mohan

  • Getting the variable name

    Hi
    May be a simple question, but I can't figure out how actually.
    When I'm doing this
    var obj:Object = new Object();
    obj.test = "My Test";
    for(var i:* in obj)
         trace(i + " : " + obj[i]);    
    The output is -> test : My Test
    My problem comes when I put an object inside the object
    var obj:Object = new Object();
    obj.test = new Object()
    obj.test.secondTest = "My Test";
    for(var i:* in obj)
         trace(i + " : " + obj[i]);    
    The output is -> test : [object Object]
    So any idea how to get the variable name instead of [object Object], just like the first output but with the second code. I have an object inside an object.
    Thanks

    The following approach will dig it's way in.  I added other variables to the main object just for demo sake...
    var obj:Object = new Object();
    obj.test1 = "test string";
    obj.test = new Object();
    obj.test.secondTest = "My Test";
    obj.test2 = new Object();
    obj.test2.secondTest2 = new Object();
    obj.test2.secondTest2.val = "deeper test";
    function traceObjectVars(obj_arg:Object):void {
          for(var i:* in obj_arg){
                if(typeof(obj_arg[i]) == "object"){
                      traceObjectVars(obj_arg[i]);
                } else {
                     trace(i + " : " + obj_arg[i]);
    traceObjectVars(obj);

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

  • How to get the results for given Bind Variable

    Hi
    Can any one help me how to get the result rows from the View Object after executing the view object query by setting bind variable?
    snippet as follows
    viewObject.setNamedWherClauseParams("name","hei");
    viewObject.executeQuery();
    How to get the results from viewObject is my question..?
    Thanks in advance

    Should be something like
    while (vo.hasNext()){
    Row r = vo.next();
    r.getAttribute....
    You might want to read the "most commonly used methods" appendix in the ADF Developer Guide.

Maybe you are looking for

  • Having trouble sending photo through messages

    I Can send a message but not photos, they are undeliverable?

  • Drop down list in Numbers

    Hey Everyone, I am currently working on a private cost center plan and stuck with this problem: In cell C2 I have a drop down list to choose a specific cost center. Now I want to have a drop down list for my types of costs in D2 but I want the option

  • 'Z_PRINT_HELP_SERVICE_ALL_DP', used web printing- in what TCode can find?

    Hello, In SAP Bw 3.0B, we implemented the display of multiple web items data onto Excel after going thru the document, "Web Printing to Excel'. While doing it we make use of the HELP_SERVICE='Z_PRINT_HELP_SERVICE_ALL_DP' . Now as we are migrating in

  • Why Does Java not see 0 or 1 as false and true

    hello, all other languages i have worked with see a 0 and 1 as a true or false value for instance...in perl this would be the case if ( 0 ) same of javas if ( false ) or if ( 1 ) same as javas if ( true ) same with javascript im am asking if there is

  • How to execute a java program in linux ternimal shell??

    currently i have write a simple culculation program, i want to know how do i can execute it in LINUX ternimal shell??? rigth now i only can execute it in JAVA program...