Using a variable as a value in jsp:param

I was wondering, I have a String variable, vid_1, and want to use a jsp:include and pass that in as one of the parameters. How can I do this? I have to do some testing to make sure vid_1 is valid and set a default if not. It contains a number referring to which video needs to be displayed.
Is there anyway I can get this value to be used in jsp:param value?
John

RahulSharna wrote:
Well,First thing you haven't pharsed your question properly.
Anyways as per my understading.
The first thing is make use of in this case as your defined requirement states you need to make use of variables of both the JSP's which need compile time include not at the runtime.use of
<%@ include file="url" %>would be more appropriate as you want to use the variable of parent jsp to the child one.
Anyways if you are thinking to apply a solution using <jsp:include/>
<jsp:include page="url">
<jsp:param name="paramName" value="<%=stringVariable>"/>
</jsp:include>and extract the paramName's corresponding value as a request parameter in other JSP.
Hope that might answer your question :)
REGARDS,
RaHuLRaHul,
Thanks for the reply. The second example you gave is what I was trying to do. I thought I did exactly what you have there and it was not working. I will check it over again and post back on here when I have a chance.
For now I was trying to use c:set to save the variable in the request and then using the EL expression ${requestScope.variable} to put it in the <jsp:param> element. I had some things working and others not when I quit. Hopefully tomorrow I can give you a full report and we can get this worked out.
Maybe my problem is something else? Look at this post of mine:
http://forum.java.sun.com/thread.jspa?threadID=5236252&tstart=10
Thanks so much for the help.
John

Similar Messages

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • Report script - using substitution variable with multiple values

    Hi All,
    Substitution variable with multiple values is not working correctly with Report scripts. Can you please let me know what is the syntax to assign multiple values to a sub variable using maxl:
    alter database samp.samp set variable 'ExtractQuarter' 'Q1,Q2,Q3,Q4';
    alter database Samp.Samp set variable 'ExtractQuarter' 'Q1:Q4';
    I tried both of the above but they are errored out with the below error:
    Error: 1001005 - Unknown Member [Q1:Q4] in Report.
    my requirement is different for both Actual and forecast data extract so i would like to make use of this variable to extract whole year data for Forecast and current quarter data for Actual with out duplicating the report scripts for both processes.
    Thanks,
    PRaveen

    Hi,
    Please refer following thread,
    range of months in report script?
    Hope it helps.
    Regards

  • Passing javascript value to jsp param

    Hi all,
    I want to be able to pass the return value of function getUrl() to jsp param...Is this a correct way? it's not working.... What should I assign to the value of param?
    <HTML>
    <HEAD>
    </HEAD>
    <script language="javascript">
    function getUrl()
         var url=window.location;
         return url;
    </script>
    <BODY>
    <jsp:include page='GetFileServlet' flush="true" >
    <jsp:param name="url" value= "return getUrl()"/>
    </jsp:include>
    </BODY>
    </HTML>
    thank you for your time and assistance

    Hi all,
    I want to be able to pass the return value of
    function getUrl() to jsp param...Is this a correct
    way? it's not working.... What should I assign to
    the value of param?
    <HTML>
    <HEAD>
    </HEAD>
    <script language="javascript">
    function getUrl()
         var url=window.location;
         return url;
    </script>
    <BODY>
    <jsp:include page='GetFileServlet' flush="true" >
    <jsp:param name="url" value= "return getUrl()"/>
    </jsp:include>
    </BODY>
    </HTML>
    thank you for your time and assistanceThis can't be done, since the jsp call will be exercised on the server, before the page gets sent to the user, while the javascript gets performed on the client (well after the jsp is done its job).
    An all server-side solution would be what you needed:
    <HTML>
        <HEAD>
        </HEAD>
        <BODY>
            <jsp:include page='GetFileServlet' flush="true" >
                <jsp:param name="url" value= "<%=request.getRequestURL()%>"/>
            </jsp:include>
        </BODY>
    </HTML>

  • Using substitution variable with multiple values in Maxl Command

    Hi All,
    Is there any option to use multiple values in 1 substitution variable and use them in a Maxl command.
    alter database $app_name.$db_name clear data in region '{CrossJoin(CrossJoin(CrossJoin({StrTOMbr(&Months)},{XXX, YYY}),{StrTOMbr(&CURYR)}), {ZZZ})}'physical;
    In the above case
    Maxl is not working if I have multiple months in &Months Substitution variable.
    Let me know if there is an alternate option to implement this.
    Thanks
    Sathish

    What is the value of &Months?
    If you put that exact value into the code, does it work?
    Regards,
    Cameron Lackpour

  • Need to reference a cell using a variable or cell value.

    Hi.
    I am trying to build a master sheet and then have sub sheets that detail the information from the master. My master sheet looks like this:
    1 | 101 | Bob | Smith |
    2 | 104 | Sally | Jones |
    3 | 108 | Tim | Abbott |
    Then on separate sheets I want a summary for each line like this:
    1 | Name | Bob |
    2 | ID | 101 |
    Now, I know I could just build this by creating references to the master sheet, but in reality my sheets are far more complex and I really need to be able to reference them by line number. So I would like to have a hidden cell (say AA1) on each summary which designates the line and then reference Master:B{AA1}. I did this years ago on excel but have no idea how I did it or howo to do it in Numbers.
    Any help is greatly appreciated.
    Thom

    Hi 86,
    Rearrange your table then add another table to find the result:
    A2 in Table 1-1 will find the earliest date in Table 1 without having to sort Table 1.
    A2 contains this formula
    =MIN(Table 1::A)
    B2 in Table 1-1 uses VLOOKUP to find which ID matches that MIN date.
    The reason for rearranging your table (Table 1) is that VLOOKUP compares a search value to the values in the leftmost column of a specified collection.
    (in this case, it looks in the leftmost column of the range Table1::A:B, then returns a match from column 2 of that range).
    I forgot to include "Exact Match" in the VLOOKUP formula. Is that what you want, or "Close Match"?
    Edit: I don't suppose that matters because MIN will always give an exact match. Duh!
    Regards,
    Ian.

  • Web Forms using substitution variables with multiple values

    Hi,
    I am trying to select a substitution variable in a webform (Hyperion Planning 11.1.1.3) with multiple values in EAS, but is not working does somebody knows if this an expected behaviour.
    I allready try ex.
    &Months = "Jan","Feb", "Mar"
    &Months = Jan, Feb, Mar
    &Months = Jan:Mar
    Please let me know something, since as far as I recall in previous versions of Hyperion Planning this was possible.
    Kind Regards

    We experienced the same issue, our requirement was that for the first half of the year the substitution variable was = Oct and for the second part of the year Jan:Dec. We were lucky that for the second scenario we had a Total Year member as well (that at the bottom level is Jan:Dec). So on web form we picked Level0 descendants of the substitution variable. That worked fine but not the range.

  • Using jsp:param

    hi,
    i am new to java and jsp programming and i am trying to use jsp:param nested in my
    jsp:forward statement.
    if i specify a value in jsp:param my page would display properly. however when i passed a variable in my jsp:param i get the error:
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\star\jsp\Meeting_CreateMinutes_jsp.java:135: cannot resolve symbol
    symbol : method encode (long)
    location: class java.net.URLEncoder
    pageContext.forward("Meeting_ActionItems.jsp" + "?" + "docno=" + java.net.URLEncoder.encode( carno ) + "&" + "formmode=" + "Add");
    ^
    1 error
    this is the snippet in my jsp page that (i suspect) caused the error:
    <% long carno = newcar.getDocno(); %>
    <jsp:forward page="Meeting_ActionItems.jsp">
    <jsp:param name="docno" value="<%= carno %>"/>
         <jsp:param name="formmode" value="Add"/>
    </jsp:forward>
    my question is : does jsp:param do not accept variables as values?
    thanks in advance.
    best regards,
    noynoy

    <% long carno = newcar.getDocno(); %>Change this part as
    <% String carno = ""+newcar.getDocno(); %>
    Hafizur Rahman
    SCJPhi Hafizur,
    Thanks a lot. It solved my problem on the jsp:param error
    More power!!!
    rgds,
    noynoy

  • Use of variables in obiee

    Hello!!!
    I m new to the forum and wanna your help,next week i have to give a presentation on variables , i know how to create them and about their scope but wanna implement its use.(use of all types of variables ie,(repo sitory(static and dynamic),session(system and non system) and presentation.
    Furthermore i wanna know about the use and what are presentation variable
    So pls help, asap
    Regards,
    Priyanka

    And what do you don't know?
    How to set a presentation variable in dasboard? Answer: use a prompt see in here: http://gerardnico.com/wiki/dat/obiee/presentation_variable
    How to use a variable after is set? It is very well described in http://shivabizint.wordpress.com/2008/10/02/oracle-bi-ee-variables-overview/ @{var_name}{defaultvalue}
    you can filter data:
    - static 'col = value'
    - is prompted (in this case it will be filtered on value that comes from navigation or from a prompt)
    - on other request
    - finally from a variable
    you can use variable to make for example topn and the user wants to modify number of topn
    so you set a variable from a prompt and use that variable on topn(value, @{var_nr_values})
    you can find a lot of docs on this topic, kart give you some links...
    Make research, and when you have a problem please come back with the isue and we happily try to help...
    Regards
    Nicolae

  • Howto pass dynamic jsp:param value to applet

    Hi.
    I have a JSP page with 3 to 4 links... and an applet with jsp:plugin .
    So i want to pass the URL behind the link to the applet as a Request Param..
    My JSP code looks like
    <a link href="www.google.com">Google</a>
    <a link href="www.oracle.com">Oracle</a>
    <a link href="www.gmail.com">Gmail</a>
    <jsp:plugin type="applet"
                                code="MyApplet"
                                height="0" codebase="../../jars/" width="0"
                                name="MyApplet"
                                align="bottom">
                            <jsp:params>
                                    <jsp:param name="applicationURL"
                                               value="this should be the "/>
                            </jsp:params>
                            <jsp:fallback>
                                    <p>This feature should run on applet supported
                                       browser.</p>
                            </jsp:fallback>
                    </jsp:plugin>and my applet code looks like
    init()
              String appURL = getParameter("applicationURL");
                    System.out.println(appURL);
              }I have a similar thread in Java forums... Howto pass dynamic jsp:param value to applet
    Thanks,
    Murali.

    My JSP code looks like
    <jsp:plugin type="applet"
                                code="MyApplet"
                                height="0" codebase="../../jars/" width="0"
                                name="MyApplet"
                                align="bottom">
                            <jsp:params>
                                    <jsp:param name="applicationURL"
                                               value="applicationURL"/>
                            </jsp:params>
                            <jsp:fallback>
                                    <p>This feature should run on applet supported
                                       browser.</p>
                            </jsp:fallback>
                    </jsp:plugin>and my applet code looks like
    init()
              String appURL = getParameter("applicationURL");
                    System.out.println(appURL);
              }Now i want to have links on JSP pages clicking on which corresponsing url will be displayed in applet.
    Edited by: 635237 on Jan 24, 2011 10:44 AM
    Edited by: 635237 on Jan 24, 2011 10:45 AM

  • Jsp:params help urgent

    hi all,
    i need to pass a lot of values to a applet from a JSP program and i came accross a method for it like Param in Applet Tag : example :
    <PARAM NAME="data" VALUE="
    3624 41.3
    6315 66.7
    4530 58.1
    3378 39.9
    5114 62.6
    4884 63.9
    5348 56.0
    4809 54.6
    4815 52.6
    4091 40.6
    4963 61.9
    4119 59.5
    5107 52.6
    4458 52.9
    4628 59.0
    4669 59.9
    3712 38.5
    3545 42.2
    3694 54.7
    5299 52.3
    4755 58.5
    4751 52.8
    4675 57.6
    3098 41.0
    4254 48.8
    4347 59.2
    4508 59.3
    5149 65.2
    4281 57.6
    5237 52.5
    3601 55.2
    4903 52.7
    3875 38.5
    5087 50.3
    4561 53.2
    3983 51.6
    4660 60.0
    4449 50.2
    4558 46.4
    3635 37.8
    4167 53.3
    3821 41.8
    4188 47.4
    4022 67.3
    3907 57.1
    4701 47.8
    4864 63.5
    3617 41.6
    4468 54.5
    4566 62.9
    ">But i do not have any idea of how do i retrive them in the applet . The number of values will differ each time the applet id loaded .Please help me with this ..Very Urgent. Thanks in advance .
    Chandooo

    hi , i am able to pass the data to the applet through the StringBuffer Object .Here is the JSP code which does the same :
    [ code ]
    <%
    int len =0;
    StringBuffer data = new StringBuffer();
    String ginfo = new String();
    if (r1>r2)
    loop:
    while(sub2.next()){
    while( sub1.next()){
    if(sub1.getString(1).equals(sub2.getString(1))){
    ginfo = sub1.getString(1)+"@"+ sub1.getString(2)+"@"+sub1.getString(3)+"@"+ sub2.getString(3)+"@"+sub1.getString(4);
    data.append(ginfo);
    data.append("\n");
    len++;
    sub1.beforeFirst();
    continue loop;
    sub1.beforeFirst();
    else
    loop1:
    while(sub1.next()){
    while( sub2.next()){
    if(sub2.getString(1).equals(sub1.getString(1))){
    ginfo = sub1.getString(1)+"@"+ sub1.getString(2)+"@"+sub1.getString(3)+"@"+ sub2.getString(3)+"@"+sub1.getString(4);
    data.append(ginfo);
    data.append("\n");
    len++;
    sub2.beforeFirst();
    continue loop1;
    sub2.beforeFirst();
    sub1.close();
    sub2.close();
    %>
    <jsp:plugin type="applet" code="Dot.class" width="500" height="500" align="center">
    <jsp:params>
    <jsp:param name="sub1" value="<%=s1%>" />
    <jsp:param name="sub2" value="<%=s2%>" />
    <jsp:param name="max" value="<%=max%>"/>
    <jsp:param name="len" value="<%=len%>"/>
    <jsp:param name="data" value="<%=data%>"/>
    </jsp:params>
    <jsp:fallback>
    Plugin tag OBJECT or EMBED not supported by browser, So please Download and Install the Plugin
    </jsp:fallback>
    </jsp:plugin>
    But the problem is ..the applet doesn't paint. the applet code is :
    double interval,xinterval1,yinterval1;
    double max;
    int len ;
    private String message = "Initializing";
    int x =0,i=0;
    String sub1,sub2,data;
    public void init() {
    sub1=getParameter("sub1");
    sub2=getParameter("sub2");
    max = Double.valueOf(getParameter("max")).doubleValue();
    data = getParameter("data");
    len = Integer.parseInt(getParameter("len"));
    interval = max/5;
    public void paint (Graphics g){
    String [][]xyf = new String [len][5];
    StringTokenizer tokenizer = new StringTokenizer(data);
    while(tokenizer.hasMoreTokens()){
    String valueOne = tokenizer.nextToken();
    StringTokenizer singleginfo = new StringTokenizer(valueOne,"@");
    x=0;
    while (singleginfo.hasMoreTokens()) {
    xyf[x++]=singleginfo.nextToken();
    i++;
    [/ code ]
    Can please tell me whats wrong with this ...

  • How to use jstl variable in a jsp page

    Hi all,
    I am new to JSTL and i want to access the value of jstl in jsp.
    when i use the tag like below it is displaying the value ""
    <c:out value="${ack}"/>
    But as ack is string, i want to convert it into int. and i have written like
    <c:set var="ackvalue" value="${ack}"/>
    and int ack = Integer.parseInt(ackvalue);
    But it is showing error like varialbe can not be resolved: ackvalue
    can anybody please help me regarding this?
    Waiting for your warm response.
    Thanks in advance

    Hi,
    Thanks for your immediate reply.
    I am able to display the ackvalue when i am using
    <c:set var="ackvalue" value="${ack}"/>
    and <c:out value="${ackvalue}"/>
    But my actual requirement is to use the ack value in
    switch statement. if i can assign the value to a
    String variable, then it si easy for me to proceed.
    Please help me in this regard.
    Thanks,You can use the c:choose, c:when and c:otherwise tags
    <c:choose>
        <c:when test = "${ackvalue == 1}">
               //do stuff
        </c:when>
        <c:when test = "${ackvalue == 2}">
               //do some other stuff
        </c:when>   
       <c:otherwise>
              //stuff
        </c:otherwise>
    </c:choose>ram.

  • Using JSTL variables in JSP or Javascript. Possible ?

    Hi All,
    Is it possible to share or use the variables which are declared are used by JSTL in JSP expression or scriplet code and in Java Script.
    Example:
    This Works:
    <fmt:set var="test" value="JSTL" />
    <fmt:out value="${test}" />
    But, this gives error:
    <% out.println(test) %>
    And passing the value of variable 'test' to Java Script code also gives error.
    How to use JSTL variables in JSP and in Javascript ?
    Yours,
    Sankar.B

    By default, JSTL variables are kept in servlet
    attributes. Default is to store it in the page
    context. You can make it request/session/application
    scope as required by an attribute of the set tag.Hi there,
    Can anyone advise how to access JSP variables in JSTL?
    Can it be done as the same method through request/session/application scope?
    Thnks...

  • Passing JavaScript values to JSP variables

    Can any body correct the follwing code
    <Script language="JavaScript">
    function test( x )
    <%
    int num = x;
    num = num * 2;
    %>
    v.value = "<%out.print(num);%>";
    <input type="button" name="b" value="test" onClick="test(5)">
    <input type="text" name="v" value="0">
    In short, I am trying to pass JavaScript value to JSP variable. I hope that it is possible to do that. If it is possible then how can I do it. I want to assing the variable x passed to the JavaScript function called test to the JSP variable called num.
    Regards,
    Ageel

    Thank you for your reply,,,
    I think then the only way to do it is to post the
    value on the server and then use request.getParameter
    method in jsp code
    but the question now how can I post values to the
    server using JavaScript without reloading the pageyes... you can to it by create a new popup window which will submit the value to server after page was loaded... then, server return a value to the same window in html/jsp page which then using javascript to set it back to the opener and close up the window... however, this is not a good choice unless you have no other alternative...
    >
    There is other possible solution
    if I can get the text field value from the same page
    without reloading it that would work fine and will
    solve my problem, is it possible?yes... you can get the value from the textfield...
    for example :
    function showValueInTextField()
        alert(document.forms[0].elements["mytextfieldname"].value);
    >
    My final question> can jsp change things on the same
    page without reloading it. I mean can it work like
    JavaScript so that I can use it's internal functions
    instead of using java script :S
    not really know what you trying to say here...

  • Using drop down list value in jsp with AJAX

    Hi All,
    I am having a jsp page , which contains a dropdown list.
    When user selects an item from the list, I've to pass this value to my java class to access other related information to be displayed on the same page without refreshing/submiting the page.
    Now the problem is, i am getting selected value in java script function but how to use this variable & pass it to java class.
    I googled a lot and found that AJAX could be used for it. Please suggest me that -
    1) Whether AJAX is the only approch ? I am affraid of it bcoz I hvn't work on it.
    2) Is there any other workaround by which i can use that value & call my java class method, without refreshing the page?
    3) If I've to use AJAX, plz help me if u've similar example. I went through the w3 scool, but not getting much idea.
    Kindly help me, the problem is very urgent with the strict timeline.
    Thanks & Regards,
    Sneha

    sneha wrote:
    1) Whether AJAX is the only approch ? I am affraid of it bcoz I hvn't work on it.Wait for it...
    2) Is there any other workaround by which i can use that value & call my java class method, without refreshing the page?Yes, Ajax!
    3) If I've to use AJAX, plz help me if u've similar example. I went through the w3 scool, but not getting much idea.Well then you'll have to do more work. Do a Google search, research more. Ajax is such a broadly discussed topic, you have to be very bad at your work if you cannot find decent resources for it in the context of your problem domain.
    To give you a hint, I suggest you look into JQuery. It is quite a popular Ajax javascript toolkit.

Maybe you are looking for

  • Sync iCal across two computers?

    Hi there - I just bought a router, and it's working beautifully. I was wondering if it is possible to sync my iCal from my home desktop iMac to my iBook (without using .Mac or a palm device) through my router?

  • XML diff - ignoring order

    I'm working a project which basically involves producing a diff of 2 XML files. I recently discovered XDK and though that this would be the best way to do this. However, after I implemented the XDK solution, I found that it makes a distinction betwee

  • User Defined Fields greyed out for one user

    Hi Experts, One of our users is a Super User but on the Business Partner Master Data screen, the User Defined Fields are greyed out. This is user specific as the issue is happening for the same user on 2 seperate PCs. Other users can update these UDF

  • System copy R/3 Enterprise 4.7

    I need to make a system copy of a system R / 3 Enterprise 4.7 110, is a homogeneous copy, but I doubt if I have to make with the tool I can make a R3load or attach / dettach a homogenous system? Thank you

  • Photoshop 12.0.2 and Camera Raw 6.3 updates available

    http://www.adobe.com/downloads/updates/ Camera Raw 6.3 update details here:http://blogs.adobe.com/lightroomjournal/2010/12/lightroom-3-3-and-came ra-raw-6-3-now-available.html