C:set with dynamic variable name

Hello,
we have a litte market system.
we iterate over the articles to display them on a page
foreach article type we have to include a popup, but only once foreach article type.
So if we have more than one article of the same type, the popup should be included only one time.
<c:forEach var="article" items="#{MyArticleController.entities}">
    <c:if test="${requestScope[article.dtype] != true}">
        <!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/>  -->          
        <c:set scope="request" var="${article.dtype}" value="1" />
    </c:if>
    <!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
</c:forEach>I think the line with the c:set seems to be the problem.
How can I solve this problem. How can I set a dynamic value and test against it later?
Thanks
Dirk

You were close with your first example.
However as noted, the <c:set> tag doesn't accept a dynamic expression for the "var" attribute.
Suggested alternative: instead of using request attributes, have a seperate map
<jsp:useBean id="articleTypeUsed" class="java.util.HashMap"/>
<c:forEach var="article" items="#{MyArticleController.entities}">
    <c:if test="${not empty articleTypeUsed[article.dtype]}">
        <!-- <ui:include src="/market/details/#{article.dtype}.xhtml"/>  -->          
        <c:set target="${articleTypeUsed}" property="${article.dtype}" value="1" />
    </c:if>
    <!-- <ui:include src="/market/preview/#{article.dtype}.xhtml"/>-->
</c:forEach>That should solve your issue with translating this java code into jstl.
Whether the mix of JSTL and JSF/ui will work well together is a completely seperate issue, and one I can't really help with.

Similar Messages

  • IMPORT statement with dynamic variable

    Friends, Need Help!!!!!!!
    Im trying IMPORT variable contents from a cluster table VARI. I can do a IMPORT without issues when I use exact name of the variable but I have issues with dynamic variable selection. Pls see code below.
    loop at objects.
       assign objects-name to <fs>.
       IMPORT <fs> to tmp_var from database vari(va) id st_key.
    endloop.
    I do not get any value to tmp_var.  Need help!
    thanks
    Bhaskar

    Try this.
    loop at objects.
    IMPORT (objects-name) to tmp_var from database vari(va) id st_key.
    endloop.
    Does it work?
    Regards,
    RIch Heilman

  • Dynamic Variable Names

    Okay, I just need to figure out how to make dynamic variable
    names. In this case, I have a loop, and inside the loop I need to
    create a new array for every iteration of the loop. Something like
    <cfloop from="0" to="10" index="i">
    <cfset LoopArray#i# = Some Value>
    </cfloop>
    But that doesn't work. How can you make dynamic variable
    named? I think it's probably something to do with evaluate or DE,
    but I don't know how to use them, and the livedocs make no sense to
    me. Thanks!

    On Thu, 22 May 2008 17:14:42 +0000 (UTC), kenji776 wrote:
    > Thank you both for your replied, I did manage to find a
    solution (the same one
    > posted by JR "Bob" Dobbs). Pretty much just looks
    like...
    >
    >
    > <cfloop from="1" to="3" index="i">
    > <cfset LinkResults["#i#"][1] = "Player 1's Move
    ID">
    > <cfset LinkResults["#i#"][2] = "Player 2's Move
    ID">
    > <cfset LinkResults["#i#"][3] = "Damage to player
    1">
    > <cfset LinkResults["#i#"][4] = "Damage to player
    2">
    > </cfloop>
    From your values, you don't want a two-dimensional array
    (which although
    you're actually building LinkResults as a struct, with the
    sequential
    numeric keys, it's basically an array), you want an array of
    structs, eg:
    LinkResults
    .player1.moveId
    LinkResults.player1.damage
    What is "i" actually counting through? IE: from 1-3 things...
    which are...
    what?
    Adam

  • Dynamic Variable Names in OpenScript

    Is there a way to use dynamic variable names? What I mean by this is that the variable name in the file could be:
    Name1, Name2, Name3, etc.
    I may want to loop through these by saying something like:
    For i = 0; i < iLoop; i++
    String sFieldName = "{{ViewList.Name" + Integer.toString(i) + "}}";
    JOptionPane.showMessageDialog(null, "sFieldName: " + "{{ViewList.{{sFieldName}}}}");
    I don't want it to use the literal string of {{ViewList.Name1}}, but rather, I want to use the value from the DataBank for Name1. Thanks.
    -John

    Nishanth,
    Thanks for your suggestion. Unfortunately, this is not a simple variable replacement. I want the name of the variable to be dynamic in nature. Imagine that I have 5 variables in the files named:
    Name
    FoodPref1
    FoodPref2
    FoodPref3
    FoodPref4
    I would like to loop through these and construct the variable name dynamically so it would be something similar to:
    for i=1 to 4; i++
    sFoodPrefVar = "FoodPref" + i;
    getVariables().set("FoodPref",sFoodPrefVar);
    JOptionPane.showMessageDialog(null, "Your Food Pref is: " + {{FoodPref}} + "\n");
    This is pseudo code, but it would theoretically loop through the 4 food preferences. Thanks.
    -John

  • Dynamic variable name

    Hi for all.
    I'm need create a object with "dynamic" name. For example
    Object ABCi = new ...
    where i is a indice.
    Please, help-me

    >
    Object ABC[] = new Object [size];
    for (int i=0; i<size;i++) {
    ABC[i] = ....
    }if you do something like this. How do you call one of the instances. How do you know how many there are??
    >
    Dynamic variable name? You're just making problems for
    yourselfIs there a better way? Because sometimes you have to have something like the above. Why is it a big problem?
    Thanks
    Brian

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • Export with dynamic file name

    Hi everyone.
    I want to know how export oracle tables with dynamic file name on windows XP platform.
    bye.

    You'd have to generate the export command-line or par file using a script -- Windows or SQL !
    It would be easy to use SQL to generate the script.
    So you could have a BATch file that
    a. Calls the SQL to generate the export command-line or parfile
    b. Executes the export
    even possibly run in a loop.
    Hemant K Chitale

  • Creating dynamic variable names

    I know there has got to a way to do this but I am not finding anything on google. I want to create a dynamic variable name like name + i so when your in a loop the names come out name1, name2 and so on till however many you want. I have tried
    int name + i = 3;
    int name[i] = 3; // which obviously won't but I had to try
    int name{i} = 3;and I am out of ideas. Thanks for all your help.

    I'd suggest using variables named j or x when posting code which uses them as array indexes.
    [i] - is for italics formatting
    [u] - is for underlined formatting
    [code] is for class Example { ... } code formatting
    etc.

  • How to auto create a global variable with specific variable name in a global vi ?

    how to auto create a global variable with specific variable name in a global vi using lv ? Because i need to add a lot of global variable in this global vi. But you know, if  i manually add them , it will be a much time-costing work. So i want to use someway to auto generate ? Can i ?? Thanks a lot !

    Hi
    what aartjan is saying is the way for you. but you can develop an utility which will actually help you create global variables. To get the details on this just have a look at VI Scripting section on LAVA forum.
    But i would like you to suggest few things
    1. If your programs have so many global variables (Thats why u want utility) then you should take out some time to read about LabVIEW design patterns. I think if programmer follows these practicess he dont need a single global variable.
    2. Their are some other ways to achieve similar functionality as of global variables (Uninitialized Shift Registers, Single Element Qs and so on) but they are much faster than global variables.
    I am Attaching Whatever Resources i am having I will also attach the template of the design pattern i generaly use in short duration
    Message Edited by Tushar Jambhekar on 10-06-2005 07:33 PM
    Message Edited by Tushar Jambhekar on 10-06-2005 07:36 PM
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog
    Attachments:
    LabVIEWDesignPatterns.zip ‏1505 KB
    Large_Code_Implementation.zip ‏522 KB
    Database Tests.zip ‏868 KB

  • Problem with Dynamic Table Name

    Hello all,
    I am having trouble using a dynamic table name. I have the following code.....
    declare l_cur sys_refcursor;
    l_ID int;
    l_tableName varchar(30);
    BEGIN
    open l_cur for
    select hkc.ColumnID, mapping from &HKAPPDB_Schema_Name..doctablemapping ddm
    inner join &HKDB_Schema_Name..HKColumns hkc on hkc.doctablemappingid = ddm.id
    where ddm.id > 0;
    LOOP
         FETCH l_cur into l_ID, l_tableName;
         EXIT WHEN l_cur%notfound;
         -- update missing VerbID in DocumentDocMapping table
         UPDATE &HKAPPDB_Schema_Name..IndexedDocument
         SET VerbID = (SELECT t.VerbID
                             FROM (SELECT DocRef, VerbID, DateUpdated
                                  FROM &HKAPPDB_Schema_Name..l_tableName dd        - this is where the dynamic table name is used
                                  WHERE dd.VerbID is not NULL))
         WHERE HKColumnID = l_ID AND VerbID is NULL;
    END loop;
    end;
    /When I try to execute this i get an error
    ORA-00942: table or view does not exist
    What am I doing wrong?
    Regards,
    Toby

    redeye wrote:
    I only started about 6 weeks ago, with no tutorials and learning it on the fly; Same here.. only my introduction was to a 12 node Oracle OPS cluster all those years ago.. and required a whole new mind set after using SQL-Server extensively. But it was fun. Still is. :-)
    but thats what you get when a company throws you in at the deep end with a ridiculous time constraint to migrate a whole MSSQL DB.Migrating SQL-Server to Oracle is not a simple thing. A lot of best practices in SQL-Server are absolutely worse practices in Oracle - they are that different. Simple example is lock escalation - an issue in SQL-Server. In Oracle, the concept of a lock being escalated into a page lock simply does not exist.
    In terms of getting the migration done as quickly and painlessly as possible I try to reuse all the logic as it appears in the MSSQL code - in this case it was using dynamic table names. I do not doubt that i am probably shooting myself in the foot in the long run.....As long as you do not splatter too much blood on us here.. not a problem :D
    Seriously though - just keep in mind that what works in SQL-Server may not work as well (or even at all) in Oracle. So do not hesitate to refactor (from design to code to SQL) mercilessly when you think it is warranted.

  • Dynamic variable names and invalid_character_err

    I'm neither an expert at structure notation nor dynamic
    variable naming conventions and would appreciate any help with the
    following. Thanks!
    This code works fine.
    <cfset idx="123">
    <cfset form.product[idx]=StructNew()>
    <cfparam name="form.product[idx].product_nm"
    default="Raspberry Jam">
    <cfform name="data_entry" method="post" format="flash"
    height="525" width="675" action="formdump.cfm">
    <cfformgroup type="tabnavigator" height="400"
    width="650">
    <cfformgroup type="page" label="Product #idx#">
    <cfinput name="static_form_name" type="text"
    label="Product" value="#form.product[idx].product_nm#" height="350"
    width="600" readonly="yes">
    </cfformgroup>
    </cfformgroup>
    </cfform>
    The following code results in the following error:
    "ORG.W3C.DOM.DOMEXCEPTION ERROR. Message: INVALID_CHARACTER_ERR: An
    invalid or illegal XML character is specified." The only change is
    in the "name" attribute of the <cfinput> tag:
    <cfset idx="123">
    <cfset form.product[idx]=StructNew()>
    <cfparam name="form.product[idx].product_nm"
    default="Raspberry Jam">
    <cfform name="data_entry" method="post" format="flash"
    height="525" width="675" action="formdump.cfm">
    <cfformgroup type="tabnavigator" height="400"
    width="650">
    <cfformgroup type="page" label="Product #idx#">
    <!--- Change value of name attribute from
    "static_form_name" to "product[idx].product_nm" --->
    <cfinput name="product[idx].product_nm" type="text"
    label="Product" value="#form.product[idx].product_nm#" height="350"
    width="600" readonly="yes">
    </cfformgroup>
    </cfformgroup>
    </cfform>
    Pam Grieger
    [email protected]

    Thanks for the info. Knowing what WON’T work is
    helpful!
    Here’s what I’m trying to do. I’m rewriting
    one of my apps, switching out conventional HTML form controls for
    <cfform> controls in Flash format. Many of the existing forms
    in my app are for updating data contained in a central database.
    When such a form is rendered to the screen, each form control is
    pre-populated with existing data. All form controls are named
    dynamically based upon the unique ID of the record being updated.
    Here’s a streamlined but typical example:
    <!--- User selected projects 14, 15, 16, and 17 for
    update. Get existing project data. --->
    <cfquery name="get_project_detail"
    datasource="#application.DataSource#">
    SELECT project_oid_nbr, project_nm
    FROM project_table
    WHERE project_oid_nbr IN (14,15,16,17)
    ORDER BY project_oid_nbr
    </cfquery>
    <!--- Initialize the project_nm form control. Form names
    are dynamic, based upon get_project_detail.project_oid_nbr. --->
    <cfloop query="get_project_detail">
    <cfparam name="form.project_nm_#project_oid_nbr#"
    default="#get_project_detail.project_nm#">
    </cfloop>
    <!--- Create HTML form control. --->
    <table>
    <cfloop query="get_project_detail">
    <tr>
    <td>
    <cfoutput>
    Project #project_oid_nbr#:
    <input type="text" name="project_nm_#project_oid_nbr#"
    value="#Evaluate("form.project_nm_#project_oid_nbr#")#">
    </cfoutput>
    </td>
    </tr>
    </cfloop>
    </table>
    This has been working just fine. However, I’m wondering
    if using the Evaluate() function is the most efficient way to go.
    Therefore I wanted to use structure notation to avoid the
    Evaluate() function, but as mentioned in my original post, this
    naming convention won’t work with <cfform> tags.
    Any suggestions as to the most efficient way to get the same
    result while still using <cfform> tags? Thanks so much!

  • Dynamic variable name generation

    Hi people,
    Is there any way of generating variable names dynamically in java in a loop? i.e.
    for(int i = 0; i<arrayLength; i++) {
    ArrayX.add(position, object)
    X++
    Where X is 0,1,2...etc. so i would have Array1 with something in it, Array2 with something in it, Array3 and so on.
    This is just a simple example but I've basically got an initial array of URL objects and then I want to call my getURL method on each link in my inital array and store the links associated to each initial URL in a different Array.
    Hope it makes sense, and i hope someone can help!
    Thanks in advance.

    Your example code is not clear to me (what is "position?"), and your description using URLs doesn't seem to need what you are asking for. I would be careful about using arrays - people sometimes use arrays when classes should be used.
    Anyway, I think you can get close to what you want by using a HashMap. You can use Strings as keys and the Strings would be "array01" "array02" etc.

  • Materialized view with dynamic column names !

    hello,
    i need some help , i'm trying ( i got no where so far :) ) to create a materialized
    view that has dynamic field name values , so every time the view is refreshed
    the fields are renamed.
    i have been asked to create a decade summary view and to assign year values to field names,the years should be table columns ( not rows !? ) and thus i should reflect this fact to the column names.
    i know its a wierd request but is there anway to do it ?
    i dunno about it at least,
    Thanks !

    ...or you could define the materialised view neutrally e.g. with columns like YEAR1, YEAR2 etc.
    Then create a dynamically-defined view on top of this view, after it's refreshed, using the relevant years as column names. SELECT year1 AS "1991", year2 AS "1992" etc.
    I still don't see how anybody is going to use these views as they won't know what the "year" columns are called.
    And if the same materialised view is going to have different sets of data each time it's refreshed i.e. different sets of years, are you re-defining the selection criteria each time? If so, why not just define separate views?
    It's a weird world out there...

  • Dynamic Variable name (for int/long) from a String variable

    Hi,
    I want to give a int/long variable name from a String.
    for ex.
    String str = lookup + "Id";
    lookup is a String variable coming from XML. Now, for instance lookup="name". So str = "nameId".
    Now I want to create a int/long variable by nameId.
    Could anybody tell me the way how to do. Please don't tell to use MAP.
    Edited by: Shah on Dec 5, 2007 3:26 PM

    Well you can't. Use a Map.
    The compiler translates variable names into slot numbers, either within an object or withing the local "stack frame" and these slot numbers are assigned names at compile time. No new slots can be created at run time. Java is not Basic.
    Reflection allows you to find existing field names and methods (not local variables), so it's possible to map, for example, XML attribute names to field names or setters in an object but the names have to be known at compile time.

  • JSP : create variable dynamic variable name and get his value.

    //HI forums.sun.com !
    //What I want to do is above :
    //out.println("<td style=\"width: "+col_width_+h+" \">")
    //Variable Declaration
    String col_width_1 = "100px";
    String col_width_2 = "150px";
    //etc String col_width_N = "XXXpx";
    //loop
    for (int h = 0; h < hrecset.getRowCount(); h++)
    //some code
    //create the variable name (exemple : col_width_0 ) with the "loop counter name" to get the value
    out.println("<td style=\"width: "+col_width_+h+" \">")//Do you understand what i mean?
    //some code
    //Variable Declaration
    String col_width_1 = "100px";
    String col_width_2 = "150px";
    //etc String col_width_N = "XXXpx";
    //loop
    for (int h = 0; h < hrecset.getRowCount(); h++)
    //some code
    //create the variable name with a concat with the loop counter variable name to get the value of the concatened variable
    out.println("<td style=\"width: "+col_width_+h+" \">")//Do you understand what i mean?
    //some code

    I apologize
    1) Sure i understand it but i click on the "code" button after i inserted the text above but it doesn't worked now it do.
    2) Because the table element need to have the total width in the HTML table TAG equal to the addition of every HTML td TAG to be W3 conform
    because i have a lot of cell where i want to adjust the width.
    so here my solution
    <%
    //Variable für Breite
    String col_width_unit = "px"; // px, cm,
    Integer total_table_width = 0;
    String[] col_width=new String[3];
    col_width[0] =  "350";
    col_width[1] =  "75";
    col_width[2] =  "50";
    %>
    <table style="page-break-inside:avoid;width:<%=gesamt_table_width+col_width_unit%>;">
    <%
    for (int h = 0; h < hrecset.getRowCount(); h++)
    out.println("               <td id =\"cell"+h+"\" class=\"tdall\"  style=\"width:"+col_width[h]+col_width_unit+"\" >");               
    %>
    </table>thank you very much

Maybe you are looking for