JSTL: Using value of a variable in expression

All, I am stuck on this problem and I hope someone here can help. This is a real tough one for me to explain but I'l try my best.
I am try to have my includes a little more component oriented. So I wanted to use something like the following
<c:import url="/somedir/outputusers.jsp">
<c:param name="collection">users</c:param>
</c:import>
I would like to use the value of a request parameter in a JSTL expression. For example, say I have a Collection of objects implementing the User interface in the request under the name 'users'. Normally in JSTL I can reference it by ${users}. Now say I wrote a JSP page that will display any collection of objects that implement "User". I would like to use something like above to pass in the name of the variable in request scope, that points to the collection of User objects, i.e. "users". Then in the included jsp I would use JSTL to loop through the collection and output it in HTML.
The problem is I cannot find any want of doing it. It would probably look something like this:
<c:forEach var="user" items="${ ${param.collection} }">
Any ideas?
Steve

In the worst case, you could always resort to using scriptlets to retrieve the parameter. and set it up as an attribute in the local page scope.
<%
String param = (String)request.getParameter("collection");
Collection userCollection = (Collection)request.getAttribute(param);
pageContext.setAttribute("local_collection", userCollection);
%>
<forEach var="user" items="${local_collection}">
,,,I think this should work.
JSTL is great, but it can't yet replace every scriptlet, much as I would like it to.

Similar Messages

  • Using value of  a variable in XML fragment

    Hi,
    I am assigning an xml fragment to a webservice variable. The XML fragment is as mentioned below:
    <ns2:ArrayOfKeyValuePair xmlns:ns2="http://www.themindelectric.com/package/com.taw.cca.common/"
    xsi:type="soapenc:Array"
    soapenc:arrayType="ns2:KeyValuePair[1]"
    xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
    <item xsi:type="ns2:KeyValuePair">
    <key xsi:type="xsd:string">key</key>
    *<value xsi:type="xsd:string" > 1234</value>*
    </item>
    </ns2:ArrayOfKeyValuePair>
    In the above mentioned xml fragment, for the tag value I need to pass the data of a variable instead of the hardcoded string 1234. How can I resolve my issue?
    Thanks

    In the worst case, you could always resort to using scriptlets to retrieve the parameter. and set it up as an attribute in the local page scope.
    <%
    String param = (String)request.getParameter("collection");
    Collection userCollection = (Collection)request.getAttribute(param);
    pageContext.setAttribute("local_collection", userCollection);
    %>
    <forEach var="user" items="${local_collection}">
    ,,,I think this should work.
    JSTL is great, but it can't yet replace every scriptlet, much as I would like it to.

  • How to use the date repository variable in filter expression

    Hi Gurus
    I am getting error in using the date repository variable in Filter expression. I am using the below formula
    filter( Fact.calls USING  "Dim Time"."Fiscal Month End Date" = VALUEOF("month_start") )
    I am getting below error
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22024] A comparison is being carried out between non-compatible types. (HY000)
    SQL Issued: SELECT filter( fact.Calls using "Dim Time"."Fiscal Month End Date" =VALUEOF("month_start")) FROM "Call Data"
    Then i tryed the below format i am getting still the error
    filter( Fact.calls USING  "Dim Time"."Fiscal Month End Date" = DATE'(VALUEOF("month_start"))' )
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 46047] Datetime value (VALUEOF("month_start")) from (VALUEOF("month_start")) does not match the specified format. (HY000)
    SQL Issued: SELECT filter( Fact.Calls using "Dim Time"."Fiscal Month End Date" =DATE'(VALUEOF("month_start"))') FROM "Call Data"
    Please let me know what i am missing or what is the correct syntax for fitler using the date repository variable.
    Thanks in advance
    Regards
    @li

    Hi @li,
    Syntax-1 is fine it will work,What kind of Variable is it?
    Static or Dynamic
    Thanks,

  • Can we use the value of a variable in an alert message

    I have a variable in forms6i. I want to use the value of this variable in an alert message. How is this possible?

    Gul wrote:
    I have a variable in forms6i. I want to use the value of this variable in an alert message. How is this possible?Try
    DECLARE err_txt VARCHAR2(200) t;
    al_id ALERT;
    al_button Number;
    BEGIN
    al_id := FIND_ALERT('My_Error_Alert');
    SET_ALERT_PROPERTY(al_id, alert_message_text, 'Hello how are you mr. variable '||:variable_name );
    al_button := SHOW_ALERT( al_id );
    END; Hope it works..
    Hamid

  • Use varialbe as a value in substitution variable

    Hi there,I incrementaly update my cube day by day.And I set a user variable in autoexec.bat to get the current date,eg '2003-06-23'.Could I use such variable as a variable's value in substition variable ?My platform is 6.5 on w2k.Regards,luau

    You can use that in a MAXL script to set the substitution variable.the MAXL script would be something like:Alter database $4 drop variable $5;alter database $4 add variable $5 $7 ;where: $4 is the app.cub $5 is the substitution variable name $7 is the value of the subs. variableRich Sullivan - Beacon Analytics

  • How to use one variable as a default value for another variable?

    Hi Experts,
    Is it possible to use one variable as a default value for another variable?
    For example:
    Variable 1 = current calendar year month
    Variable 2 = mandatory input ready variable for calendar year month
    I want to use variable 1 as default value for variable 2, but also have the ability to change the month if required.
    Thanks!
    Kathryn

    u can use replacement path variable
    in that case u can replace the values of 1 variable with the another variable...
    but  u cannot do this setting
    u cannot make variable 2 as mandatory
    u cannot enter value for variable 2
    because by default it will take the value of variable 1
    u have to make follow settings
    variable 2
    name , technical name
    processing by = replacement path
    infoobject = ocalmonth
    next tab
    replaced by another variable
    variable name
    offset start , offset lenght
    save and hit okey

  • Change the value of a variable used in a View query

    I am using JDeveloper 11g to develop a simple portlet application which displays data loaded from database. I am displaying the data by dragging the ViewObject from the AppModuleDataControl to the View.jspx page and selecting the option ADF Read-only Table. My ViewObject has a single variable :empId. Now is it possible to change the value of this variable with a value that comes from the request object. On the internet I found the following code:
            FacesContext facesContext = FacesContext.getCurrentInstance();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            ValueExpression valueExp =
            elFactory.createValueExpression(elContext, "#{data.AppModuleDataControl.dataProvider}",
            Object.class);
            ApplicationModule am = (ApplicationModule)valueExp.getValue(elContext);
            ViewObject emplVO;
            emplVO = am.findViewObject("EmployeeView1");
            emplVO.setNamedWhereClauseParam("empId", "1");I have put this code in the public void processAction(ActionRequest request, ActionResponse response) method. However this does not work when I deploy it.
    Does anyone know if the above code is correct in this case and if there is a better way how I can set this up?

    Hi there:
    Did you add a break point and debug the code to see what is the value for the :empid parameters passed in to your view object?
    If you are sure you have passed in the correct value for ":empid" parameter, then do the following:
    String amDef = "yourAmDef";
    String config = "yourConfig";
    ApplicationModule am =
    Configuration.createRootApplicationModule(amDef,config);
    ViewObject emplVO;
    emplVO = am.findViewObject("EmployeeView1");
    emplVO.setNamedWhereClauseParam("empId", "1");
    empVO.executeQuery();
    which will execute your view object with the new bind variable value and refresh the view.
    Please mark my answer as 'Correct' if it solves your problem, or 'Helpful' if it does.
    Thanks,
    Alex
    Edited by: Alexbie on 27-Aug-2010 8:52 AM

  • How to use the value of a variable to set another variable

    Hello Experts,
    Is it possible to access the value of variable set by the user and set the default value of another variable using the user entered value for the first variable? Example:
    Date variable
    Week variable
    Month variable
    User enters one of those and the other two are automatically prefilled with the correct values?
    Thanks
    Rado

    Hi Rado,
    Gothrough following code
    Which reads year from user input and converts it to factory calendar week , following which you should able to convert user inputs to required parameters.
    DATA:  v_year1 TYPE i,
            v_int   TYPE i,
            v_week1 TYPE kweek,
            v_qurt  TYPE i,
            v_perd  TYPE /bi0/oifiscper,
            v_iweek TYPE i,
            v_periv TYPE periv VALUE 'Z4'.
    DATA : v_vweeks  TYPE /bi0/oicalweek,
            v_vperd   TYPE /bi0/oifiscper,
            v_vperiv  TYPE /bi0/oifiscvarnt VALUE 'Z4'.
    DATA : vit_weeks LIKE /bi0/scalweek OCCURS 0 WITH HEADER LINE.
    DATA : v_perd1   TYPE umc_y_fiscper,
            v_weeks   TYPE umc_ys_dimvals,
            v_pweeks  TYPE i.
    CASE i_vnam.
       WHEN 'WPIYWEEK'.                "Variable name of char. in Bex
    *Check for Step 2 (After user gives inputs on selection screen)
         CHECK i_step = c_after.                                "Step:2
         CLEAR :  v_year1,
                  v_week1,
                  v_iweek.
    *Read the value of variable which used has entered on sel. screen
         READ TABLE i_t_var_range INTO wa_var_range
                                     WITH KEY vnam = 'WPIFYEAR'.
         v_year1 = wa_var_range-low.
         CALL FUNCTION 'TIME_GET_LAST_WEEK'
           EXPORTING
             if_year     = v_year1
           IMPORTING
             ef_week     = v_week1
           EXCEPTIONS
             fatal_error = 1
             OTHERS      = 2.
         IF sy-subrc <> 0.
    *           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
    *Get the no. of week from YYYYWW format
         v_iweek = v_week1+4(2).
         l_s_range-low  = v_iweek.
         l_s_range-sign = c_include.
         l_s_range-opt  = c_equal.
         APPEND l_s_range TO e_t_range.  "This is the output structure in which u have to add the result
    Endcase.
    Hope that helps.
    Regards
    Mr Kapadia
    Assigning points is the way to say thanks in SDN.

  • How to use Value Variable in Report Painter Column defined as Formula

    Hi Gurus,
    In report painter, how can I add one field (exchange rate) in selection screen, so that user can provide the exchange rate to be used, then execute the report, the exchange rate will used to multiple local currency amount.
    The reason for this is we want use provided exchange rate to convert the amount from once currency to the other currency.
    Alternatively I am studying the functionality of "Value Variable" and found that I can perform the task from this. I have created the value variable but when I am using the variable in Report Painter columns as "&ZVALVAR", system is giving me error. I read the help and it states that use the variable with "&" and do it as it is mentioned.
    Can anybody suggest what I need to do to make it workable.
    Thanks

    I did try using the presentation variable, but that does not work too. I am setting session variable in the dashboard prompt (select 'request variable'). When I use presentation variable, it hard codes the value of the variable name.
    sql is
    select date from work_order where facility = @{p_facility}
    the physical log sql is
    select date from work_order where facility = 'p_facility'

  • Can you assign the value of a jstl:out value to a jstl:set variable?

    Basically can you do the following?
    <jstl:set var="journeyVisit"
    value="<jstl:out value=${journeyVisits.stopPoint.description} />" />
    Basically we have our own independent markup language and I need to use our own href tag to wrap the 'journeyVisit' tag.
    Any ideas?
    Thanks.

    <jstl:set var="journeyVisit" value="${journeyVisits.stopPoint.description} " />

  • Values of same Variable(used in diff reports) shud be retained in a session

    Hello,
    We have an application cockpit. There are 12 to 13 different reports being used in that cockpit. Most of the reports use the same characteristic variables in the report.
    When we used to execute these reports in Ver 3.x, the variables used to retain their values in the same session. i.e. if for 0Material, user gave : 'TIP120' as a value in selection criteria in one report, then, if he executed another report after that, which uses the same variable on 0Material, then it retained its previous value: 'TIP120'. 
    Recently we have migrated to BW 7.0. Now, the variables no longer retain their values in the same session and the user has to type the value again. (personalization is an option but we want the variable should retain the values in same session).
    Any help/advise on this will be of great importance as the user is not very comfortable putting values again, each time he runs the report.
    Warm Regards,
    Sumita

    Hi,
    Although this may not be the ideal answer for your question. This is another solution for your Question.(Personalizing Variables)
    Go through this link... This will help you for sure
    http://help.sap.com/saphelp_nw04/helpdata/en/3f/30ae3d47afd652e10000000a114084/frameset.htm
    Hope This Helps,
    Regards,
    rik

  • Maintain values for the variables in using Transaction SM30_SSM_VAR

    Greetings
    I’m trying to start a customizing transaction of SRM from Transaction Solar02 in the Solution manager, and this message appears:
    Maintain values for the variables in <> using Transaction SM30_SSM_VAR
    I start the transaction SM30_SSM_VAR but there are no values maintained. I don't know which values have to be set.
    Please if anybody could help me, I will be much appreciated
    Regards
    Henry
    appreciated.
    Regards
    Henry

    Hi Henry,
    you probably clicked an URL that has some <value> brackets inside? In this case you need to create a variable in SM30_SSM_VAR with the name "value" and maintain as attribute the e.g. the SRM-server you want to be replaced in the URL.
    Regards
    Andreas

  • How to assign a value to ODI Variable using ODI Procedure

    Hi ,
    Is it possible to assign a value to a ODI Variable using ODI Procedure ?
    If it is possible how we can do that.
    BEGIN
    IF #Counter=1
    Then
    #Next_Increment:=#Counter+1;
    End if;
    END;
    In my example I have 2 ODI Variables #counter and #Next_increment.
    I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
    thanks
    prasanna

    Prasanna,
    I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
    Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
    Please help.

  • Using HttpHeader to set value for session variables

    Hi,
    We want to set values for 2 session variables (USER and ROLEID) using HttpHeader in obiee 11g. Has anyone tried this? How can we achieve this?
    I found the below note on the forum for setting value for the USER session variable. how can we set the ROLEID session variable also? is it possible to set values for 2 variables?
    for setting the USER session variable,
    You should add this in $BI_HOME/bifoundation/web/display/authenticationschemas.xml:
    <SchemaKeyVariable source="httpHeader" nameInSource="Proxy-Remote-User" forceValue="SSO"/>
    <AuthenticationSchema name="SSO" displayName="Single Sign On" userID="IMPERSONATE" proxyUserID="NQ_SESSION.RUNAS" options="noLogoffUI noLogonUI">
    <RequestVariable source="httpHeader" type="auth" nameInSource="Proxy-Remote-User" biVariableName="IMPERSONATE" options="required"/>
    </AuthenticationSchema>
    Please suggest.
    Thanks.

    I think maybe your SnmpValue type or value is not corrent.
    1.3.6.1.4.1.7064.201.1.200.100.0 is Enum control type
    when I use
    SnmpValue val = new SnmpString("0");
    It doesn't work, but when I use
    SnmpValue val = new SnmpInt(0);
    It works. I think the JDMK should give some warning message when the type is not correct. :)
    The code is following:
    final SnmpVarBindList setList = new SnmpVarBindList(" set varbind list ");
    SnmpOid oid = new SnmpOid("1.3.6.1.4.1.7064.201.1.200.100.0");
    SnmpValue val = new SnmpInt(0);
    SnmpVarBind valueBind = new SnmpVarBind(oid, val);
    setList.addVarBind( valueBind );
    SnmpRequest setRequest = session.snmpSetRequest(null, setList);

  • Using value variables throw public functions

    He all!!
    I'm trying to use value variables throw public functions in
    the same class.
    Is there any possible to do it?
    I'll explain:
    What i whant is in tha FLA file to get the songName of the
    mp3 like trace(musica.nomeMusica);
    quote:
    //AS Code
    package Mp3Player{
    import flash.media.Sound;
    import flash.media.SoundLoaderContext;
    import flash.media.SoundChannel;
    import flash.media.ID3Info;
    import flash.net.URLRequest;
    import flash.events.Event;
    public class Mp3Player {
    private var sound:Sound;
    private var req:URLRequest;
    private var context:SoundLoaderContext;
    private var channel:SoundChannel;
    private var id3:ID3Info;
    private var nomeMusica:String;
    public function tocarMusica(file) {
    sound=new Sound ;
    req=new URLRequest(file);
    context=new SoundLoaderContext(8000,true);
    sound.load(req,context);
    channel=sound.play();
    trace("A tocar");
    sound.addEventListener(Event.ID3,id3Info);
    public function id3Info(event:Event):void {
    id3=event.target.id3;
    nomeMusica=id3.songName;
    public function get getNome():String {
    return nomeMusica;
    //FLA Code
    import Mp3Player.Mp3Player;
    var musica:Mp3Player = new Mp3Player();
    var nome:String = musica.getNome;
    musica.tocarMusica("Saia_Indiscreta.mp3");
    trace(nome);
    The trace of my code is:
    quote:
    A tocar
    Null
    What i'm doing wrong or is missing?

    Tnks all for the reply but none of them give me any answer :(
    Making the question in other way.
    Using the code above, how can i set a funcion to call the
    musicaNome value from FLA file?
    quote:
    //AS Code
    package Mp3Player{
    import flash.media.Sound;
    import flash.media.SoundLoaderContext;
    import flash.media.SoundChannel;
    import flash.media.ID3Info;
    import flash.net.URLRequest;
    import flash.events.Event;
    public class Mp3Player {
    private var sound:Sound;
    private var req:URLRequest;
    private var context:SoundLoaderContext;
    private var channel:SoundChannel;
    private var id3:ID3Info;
    private var nomeMusica:String;
    public function tocarMusica(file) {
    sound=new Sound ;
    req=new URLRequest(file);
    context=new SoundLoaderContext(8000,true);
    sound.load(req,context);
    channel=sound.play();
    trace("A tocar");
    sound.addEventListener(Event.ID3,id3Info);
    public function id3Info(event:Event):void {
    id3=event.target.id3;
    nomeMusica=id3.songName;

Maybe you are looking for

  • How to remove spaces in the output of an PL/SQL report

    Hi, The requirement is to develop a SQL report. The sample code is like this Select 'Order Number Header Id' from dual; ( This is the heading in the output of the report.) Select order_number , header_id from oe_order_headers_all; The output is displ

  • ORA-00600: internal error code, arguments: [4194]

    When startup database, I can see internal error. ORA-00600: internal error code, arguments: [4194], [65], [51], [], [], [], [], [] When I googled, people saying that I need to create undo tablespace and replace it to old one. But problem is I can not

  • Error message after opening Microsoft Ecosystem Metadata Exchange Powershell Module

    Hi, I am running into issue who I launch the Microsoft Ecosystem Metadata Exchange Powershell Module Here is the error message: Import-Module : Could not load file or assembly 'file:///C:\Program Files (x86) \Microsoft Ecosystem Metadata Exchange\Met

  • CIC win client to web client migration

    Hi all, I am new to CRM CIC. We are on CRM 5.0 and we need to migrate the CIC win client to web client. Can anyone please let me know how should we start. Are there any documents/sequence of steps for the migration? Regards, Nag Reddy

  • Migrating to a new MacBook Pro

    I've just got a new MBP and am wondering whether it will be easy to transfer all previously installed programms from my old MBP to the new one(including Parallel Desktop and Windows Vista)? The old MBP has Tiger and the new one has Leopard(I suppose)