Using a java variable in jsp-Reports?

Hello everyone,
is it possible to use a java variable in the xml-definition of a report? Something like
<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %>
<% String someSqlStatement="select * from emp"; %>
<rw:report id="myReport">
<rw:objects id="myObjects">
<report DTDVersion="9000010" name="myReport">
<data>
<dataSource name="Q_1">
<select>
<![CDATA[
<%= someSQLStatement %>
]]>
</select>
It won't work that way (as the string is not evaluated and inserted into the definition, but how could it be done? Would be great to modify the report programatically that way? Any ideas?
TIA,
Marcel Jantz

To pass values to Reports, you should use the "parameters" attribute in the <rw:report> tag. In the above case you would have:
<% String myParameters="p_someSqlStatement=select%20*%20from%20emp"; %>
<rw:report id="myReport" parameters="<%= myParameters %>">
<rw:objects id="myObjects">
<report DTDVersion="9000010" name="myReport">
<data>
<dataSource name="Q_1">
<select>
<![CDATA[ &p_someSqlStatement ]]>
</select>
The body of the <rw:objects> tag isn't evaluated since the Reports Builder needs to be able to open and load the <rw:objects> tag. As the Reports builder doesn't run the .jsp on open, it only parses it, the <rw:objects> tag can't have values that need to be evaluated.

Similar Messages

  • How to use standard JSTL tags in JSP report ?

    I've tried to insert <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> on the top of the report
    but report developer fails to save and run this report
    so how do i use JSTL in web-reports ?

    I've tried to insert <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> on the top of the report
    but report developer fails to save and run this report
    so how do i use JSTL in web-reports ?

  • Assigning javascript variables to java variables in JSP

    Does anyone know if it possible to assign a javascript value to a java variable in a javascript function? I want to be able to use the javascript value in a PreparedStatement call, but I can't assign the value of the javascript variable to a java variable. I know the opposite can be done using hidden variables in the form, but I need:
    javascript -> java variable in a JSP scriptlet.
    Any help would be much appreciated,
    Thanks,
    -Dave

    Can't do that.
    html/javascript is in the client side.
    jsp is in the server side.
    In order to put html/javascript values (client side) into jsp (server side) it must be submitted.
    Try remoting. Using an iframe with a jsp as the source of it and the html target pointing at it.
    -------------

  • Issue with use of shared variables in Crystal Reports 2008 Offline Viewer

    Hi,
    I have a report that contains a number of sub-reports which include drill-down functionality. The report returns data relating to an individual team with the user being able to view top level summary information in each area from the parent report and then drill into the sub-reports to view see more detail. The data returned by the sub-reports is filtered, using sub-report links, based on the team code parameter value given by the user. This parameter field resides in the main report.
    One of the values returned by the main report is the team name. This is passed to each sub-report using a shared variable and each sub-report displays this team name as part of a heading.
    This all works fine in Crystal Reports 2008, but when a report, containing data, is opened using Crystal 2008 Offline Viewer there is a problem with the shared variable. The value is displayed correctly when the user initially drills into the sub-report. However, when the user begins to drill into grouped data within the sub-report the value passed to the sub-report using the shared variable disappears. 
    How can I ensure that, when a report is viewed using Crystal Offline Viewer 2008, the value within the shared variable is not lost when users drill into grouped data within sub-reports
    Thanks
    Stuart

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551

  • How to use customer exit variable in the report

    Dear All,
    i want to use a standard customer exit variable in the report properties.
    In the Bex Query Designer right hand bottom you will find two buttons "Properties" and "Task". Click on task you will get different option. Choose properties from there and then select "variable sequence tab".
    I need to add a standard variable there. How can i achieve it?
    Appreciate your early help.

    You need to add variable to corresponding charctertic then you can get that varaible for sorting the sequence....
    If 0CUST is the varaible then you need to assign it 0CUSTOMER then 0CUST will be available for the sequence.
    Edited by: shanthi bhaskar on Apr 2, 2009 5:41 PM

  • Use of Presentation Variables in Navigated Report Title

    Hi All,
    It's regarding the presentation variable in report title. I have value interaction to another report based on Prompted values. But when we click on the value it will go to another report page and giving the results, but the title view is not changing as per the requested value. The title should change dynamically, but it is showing the P.Variables in place of prompted value.
    Below are the ways i have used the P.Variables:
    @{brand1} at @{customer}, @{sensitivity}% Sensitivity
    @{brand1}{'Prod'} at @{customer}{'CVS'}, @{sensitivity}{'15'}% Sensitivity -----(default values here)
    Version : OBIEE 11.1.1.5.0
    Could you provide me the solution for this issue.
    Thanks in Advance,

    Hi,
    You can use the presentation variable when you are passing the value from the prompt and filtering after
    clicking on the 'GO' or 'APPLY' button. So that assigns one value and is passed in the report in the
    page used.
    What you need to do is you need to have the 'is prompted' for the column used in the title
    or you can make the column is equal to @{pres_var}.
    But still if you dont use the columns in the report and you dont want to filter the report with the title columns
    then you can use narrative view with all the columns used in the title and have 'is prompted' and make its formatting similar to title view and save as a separate report
    And place the narrative view above the report
    Regards,
    MuRam

  • Trouble using an item variable in a report query

    Hi,
    Apex 4.2
    Theme: jQuery Mobile
    I have a page with 2 regions.  An html region with a select list that populates an item called P1_RESIDENT and below that a report region which will show rows dependent on what is selected in the above select list.
    My select list definition is:
    select aka as display_value, id as return_value
      from RESIDENT
    order by 1
    The query in my report is:
    select decode (two_person_lift,'Y','2 Person Lift','1 Person lift') as "2 person lift"
    from resident
    where id = :P1_RESIDENT
    My expectation is the user will select a person from the list and a name will be displayed and P1_RESIDENT will get set with the return_value of id.  The report region will then run and display rows.
    Unfortunately all I am getting in the report region is this:
    &"DECODE(TWO_PERSON_LIFT,'Y','2PERSONLIFT','1PERSONLIFT')".
    What am I doing wrong ?
    Thanks
    Steve.

    Suggest you try to reproduce the problem on apex.oracle.com where we can see it.
    What page, region, and report templates are you using?
    Are you submitting the page on change of the select list, or using a dynamic action to refresh the report? If the latter, provide full details of the DA, and Is P1_RESIDENT specified in the report region Page Items to Submit property?

  • How to use an BPM Instance Variable in JSP page

    Hi All,
    I am using the JSP Presentation, but i don't know how to use an Instance variable in JSP page, that instance already declared in the process. And Can u explain the syntax that to include the JS file into jsp page
    Regards
    Vasu.
    Edited by bpmvasu at 04/03/2007 10:43 PM

    Hi Mariano,
    I'm using JSP presentation too. In "Interactive Component Call" active i'm using "Use JSP presentation", but i only can define one instance variable, i need to add more instance variables. In "Advanced" option of this task, i have the argument mapping .. but i don't understand how to use it.
    I have a instance variable called "genders" of the type String[Int] (Associative Array) and i'm mapping this instance variable in "Arguments Show In" option of the advanced option of JSP presentation. In JSP presentation i have the code:
    <select <f:fieldName att="person.gender"/>>
                   <c:forEach var="gender" begin="0" items="${genders}" varStatus="status">
                        <c:choose>
                             <c:when test="${person.gender == gender}">
                                  <option value="<c:out value="${gender}"/>" selected="true"><c:out value="${gender}"/></option>
                             </c:when>
                             <c:otherwise>
                                  <option value="<c:out value="${gender}"/>"><c:out value="${gender}"/></option>
                             </c:otherwise>
                        </c:choose>
                   </c:forEach>
              </select>And in my screenflow i have the code:
    genders[0] = "Male"
    genders[1] = "Female"But when i run my application, i have the error: "The task could not be successfully executed. Reason: 'java.lang.ClassCastException: java.lang.Integer'."
    What's the problem?

  • Accessing java class in JSP on Tomcat 5.5 server

    Just i want to use a java class in JSP.
    Explanation in following steps :
    a. MY JSP Code - SimpleBean.jsp
    b. My Java file - test.java
    c. Path ( Root, jdk, jre , myfiles-test.java, SimpleBean.jsp )
    d. Environment Variables
    e. Error Message faced
    Now Brief explanation.
    a. MY JSP Code :
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*,test" errorPage="" %>
    <td>      
    <%! test obj = new test();
    obj.setAge(32); %>
    <%= obj.getAge(); %>
    </td>
    b. My Java file - test.java
    package test;
    class test
    private int age;
    public int getAge()
         return age;
         public void setAge(int intage)
              this.age = intage;
    c. Path ( Root, jdk, jre , myfiles-test.java, SimpleBean.jsp )
    Tomcat Root : c:\Program Files\apache\tomcat5.5\webapps\ROOT
    jdk : C:\Program Files\Java\jdk1.5.0\bin;
    jre : C:\Program Files\Java\jre1.5.0\bin;
    test.java : c:\Program Files\apache\tomcat5.5\webapps\ROOT\NRMS\test\test.java
    SimpleBean.jsp : c:\Program Files\apache\tomcat5.5\webapps\ROOT\NRMS\test\SimpleBean.jps
    d. Environment Variables :
    PATH :
    C:\Program Files\Java\jdk1.5.0\bin; C:\Program Files\Java\jre1.5.0\bin;
    CLASSPATH :
    .;C:\Program Files\Java\jre1.5.0\bin;
    e. Error Message Faced : ( on accessing url http://localhost:8080/NRMS/SimpleBean.jsp )
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    The import test cannot be resolved
    An error occurred at line: 26 in the jsp file: /NRMS/test/SimpleBean.jsp
    Generated servlet error:
    test cannot be resolved (or is not a valid type) for the field SimpleBean_jsp.obj
    An error occurred at line: 26 in the jsp file: /NRMS/test/SimpleBean.jsp
    Generated servlet error:
    test cannot be resolved or is not a type
    An error occurred at line: 26 in the jsp file: /NRMS/test/SimpleBean.jsp
    Generated servlet error:
    Syntax error on token(s), misplaced construct(s)
    An error occurred at line: 26 in the jsp file: /NRMS/test/SimpleBean.jsp
    Generated servlet error:
    Syntax error on token "32", delete this token
    An error occurred at line: 28 in the jsp file: /NRMS/test/SimpleBean.jsp
    Generated servlet error:
    Syntax error on token ";", delete this token
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:389)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:296)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
    Apache Tomcat/5.5.4
    Please explain where i am doing the mistake.
    Thanks in advance.
    Regards,
    Lax.

    >
    <%@ page contentType="text/html; charset=iso-8859-1"
    language="java" import="java.sql.*,test" errorPage=""
    %>Your class is test.test.The compiler wouldnt know what test is from your import.
    Change import as
    java.sql.*,test.test
    <%! test obj = new test();
    obj.setAge(32); %>The symbol '!' ?

  • Business Rule variable in Essbase report

    Hi,
    I need to create a report where I will use the variable (created as Business Rules variable e.g.- [BudYear],[CurrVersion] etc) but it is not working. If I use [BudYear] it is just showing the dimension name in report as 'Year'. But when I use any exxbase substitution variable (e.g.- &CurYear etc) it is working fine. So, can it be possible to use business rules variable in essbase reports?
    Can it be possible to save the essbase report in comma delimited format (I am only getting tab delimited option). Please revert back.
    Thanks & Regards.

    As John rightly said, HBR rules are only applicable within HBR. What you want is an Essbase Substitution Variable. So long as the value does not get selected interactively in the HBR, you can use a Substitution Variable instead. An example would be something like current year -- this isn't going to get changed by the users via a Planning form or a prompt.
    HBRs, Calc Scripts, member formulas, load rules, and of course Essbase report scripts can all read substitution variables. See the DBAG for more information. Personally, I only use HBR variables, local or global, for items off the POV or driven by a run-time prompt.
    Unfortunately, a comma delimted file is a pain in a report script -- you have to make your columns fixed length and then use the MASK command to put the commas in -- ugh. However tab delimited files are an option. I've never found an IT group that couldn't handle the latter format.
    You may also go with the the DATAEXPORT calc script command -- a comma delmited output is possible with that command and of course it supports Essbase substitution variables.
    Regards,
    Cameron Lackpour

  • Using the Java APIs

    I am attempting to use the java api in my reporting solution. The application that we are developing is using JSF and java. I wanted to keep the same look and feel for my reports.
    First, I created a very simple rtf template in Microsoft word using BI Publisher Desktop. This simple template is just a table layout of data. No groupings. I created my datatemplate and ran the DataProcessor, the RTFProcessor, and FOprocessor objects. This worked correctly.
    I next created another rtf template. This rtf template contains a grouping on Po_Number. I also modified my data template to group by Po_number. The DataProcessor and the RTFProcessor works fine. However, the FO Processor gives me the following message:
    XDOException <Line 43, Column 93>: XSL-1015: (Error) Function 'current-group' not found.
    However, I can successfully preview this template (with data) in Microsoft Word. Any ideas what may cause this.

    It's either a template issue or your missing some jar files (probably jar files).
    I would highly recommend you download the BIPublisherIDE. All this code and framework is already written and it's free!
    http://bipublisher.blogspot.com/2008/03/bi-publisher-bipublisheride.html
    Ike Wiggins
    http://bipublisher.blogspot.com

  • Java script in Jsp Dynpage

    Hi all,
    Can any one give me a sample code for using a java script in jsp dynpage which invokes on client click. I mean i want to call a java script function on client click.

    Hi,
    Check these:
    https://wiki.sdn.sap.com/wiki/display/Snippets/JSPDynPage-Howtohideanelementonclienteventingaswellaschangethetextofthebutton+dynamically
    Search for onClientClick in above link and you will find the corresponding javascript function that is called when user clicks the button.
    Regards,
    Praveen Gudapati

  • Using java class and variables declared in java file in jsp

    hi everyone
    i m trying to seperate business logic form web layer. i don't know i am doing in a right way or not.
    i wanted to access my own java class and its variables in jsp.
    for this i created java file like this
    package ris;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class  NewClass{
        public static void main(String args[]){
            Connection con = null;
            ResultSet rs=null;
            Statement smt=null;
            try{
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                con=DriverManager.getConnection("jdbc:mysql:///net","root", "anthony111");
                smt=con.createStatement();
               rs= smt.executeQuery("SELECT * FROM emp");
               while(rs.next()){
                String  str = rs.getString("Name");
                }catch( Exception e){
                    String msg="Exception:"+e.getMessage();
                }finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    }next i created a jsp where i want to access String str defined in java class above.
    <%--
        Document   : fisrt
        Created on : Jul 25, 2009, 3:00:38 PM
        Author     : REiSHI
    --%>
    <%@page import="ris.NewClass"%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <h1><%=str%></h1>
        </body>
    </html>I wanted to print the name field extracted from database by ResultSet.
    but it gives error cannot find symbol str.
    please help me to find right way to do this.
    i am using netbeans ide.

    Very bad approach
    1) Think if your table contains more than one NAMEs then you will get only the last one with your code.
    2) Your String is declared as local variable in the method.
    3) You have not created any object of NewClass nor called the method in JSP page. Then who will call the method to run sql?
    4) Your NewClass contains main method which will not work in web application, it's not standalone desktop application so remove main.
    Better create an ArrayList and then call the method of NewClass and then store the data into ArrayList and return the ArrayList.
    It should look like
    {code:java}
    package ris;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class  NewClass{
        public static ArrayList getNames(){
            Connection con = null;
            ResultSet rs=null;
            Statement smt=null;
            ArrayList nameList = new ArrayList();
            try{
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                con=DriverManager.getConnection("jdbc:mysql:///net","root", "anthony111");
                smt=con.createStatement();
               rs= smt.executeQuery("SELECT * FROM emp");
               while(rs.next()){
                nameList.add(rs.getString("Name"));
               return nameList;
                }catch( Exception e){
                    String msg="Exception:"+e.getMessage();
                   </code><code class="jive-code jive-java"><font>return nameList;</code><code class="jive-code jive-java">
                }finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
          </code><code>return nameList;</code>
    <code class="jive-code jive-java">    }

  • 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.

  • Passing struts-tag value to java / javascript variable in JSP

    Hello all,
    Im trying to pass the value got from the struts-tag to the java variable in the Jsp. However Im not able to get the o/p. Can u guys help me on this pls...
    <logic:notEmpty name="TreeBean" property="list">
        <logic:iterate id="Type" name="TreeBean" property="list" indexId="i">
         <br/><bean:write name="Type" />
        </logic:iterate>
    </logic:notEmpty>Here the list can be populated in the jsp page. However i want the values into jsp list. Im not able to populate the same..
    <% List jspList = null;
    %> I want the values into the jspList variable for further processing. Can u guz pls help me on this....

    Which do you want it in?
    A java variable for use in <% scriptlet code %> or a javascript variable for use on the client end?
    scriptlet:
    <jsp:useBean id="TreeBean" type="java.util.List" class="java.util.ArrayList" scope="?????" />
    Having scriptlet code on the page is considered bad coding style.
    What is it you are trying to accomplish by making the value accessible?
    What are you trying to do in java / javascript that can't be done with JSP tags?

Maybe you are looking for

  • Report not output ENGLISH character

    hi, im using 12.1.3, recently just did a customization report. but the report not output in English character, instead it outputs in Greek or Symbol font in PDF. i can see the ENGLISH output if i run it in REPORT BUILDER. my app server is RED HAT 5.

  • Waiting for Udev uevents to be proccessed forever

    After a clean install from cd arch booted properly. After updating everything and rebooting, boot hanged at waiting for Udev uevents to be proccessed for too long. I reinstalled arch but this time I updated only udev and i have the same problem. I do

  • Filter to print file names on your clips?

    I'm looking for a way to print the file name of a clip on the clip - similar to the Timecode filter in AfterEffects. Any suggestions? I could use After Effects as well if anyone knows of a suitable filter for that, either...

  • All text in caps? CS5

    For any text box I place and type text in, all my text is in all caps. I don't have caps lock on and it's like this for every font. It's the same if I copy and paste text. What am I missing here? I feel like this is something easy that I'm just overl

  • IDES ERP 2004 Database Instance

    Hi sdn gurus, I am try to install the ides erp 2004, database(MS SQL 2000 enterprise edition).The central instance installation was successful but database instance is stalling at Database load(post processing stage)with an error in the log file as s