How to pass a server side value to an attribute of a custom jsp tag

Hi All:
I needed to passed an integer value from the following code:
<%=ic.getTotalNumOfRecords()%>
to an attribute of a custom tag
<inquiry:tableClaimHistory numberOfRecords="5" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
The function getTotalNumOfRecords returns an int.
The attribute numberOfRecords expects an string.
Here are the different ways I tried in a jsp page but I get also the following errors:
1.)
>
<%@ include file="../common/page_imports.jsp" %>
<inquiry:tableClaimHistory numberOfRecords=<%=ic.getTotalNumOfRecords()%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
Error Message:
claimHistoryView.jsp:190:3: Unterminated tag.
<inquiry:tableClaimHistory numberOfRecords=<%=ic.getTotalNumOfRecords()%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
2.)
>
<%@ include file="../common/page_imports.jsp" %>
<inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
Error Message:
claimHistoryView.jsp:190:4: The required attribute "numberOfRecords" is missing.
<inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
3.)
>
<%@ include file="../common/page_imports.jsp" %>
<inquiry:tableClaimHistory numberOfRecords="<%ic.getTotalNumOfRecords();%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
Error Message:
java.lang.NumberFormatException: For input string: "<%ic.getTotalNumOfRecords();%>"
4.)
>
<%@ include file="../common/page_imports.jsp" %>
<%
int records1 = ic.getTotalNumOfRecords();
Integer records2 = new Integer(records1);
String numberOfRecords2 = records2.toString();
%>
<inquiry:tableClaimHistory numberOfRecords="<%numberOfRecords2;%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
error message:
java.lang.NumberFormatException: For input string: "<%numberOfRecords2;%>"
     at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1224)
     at java.lang.Double.valueOf(Double.java:447)
     at java.lang.Double.(Double.java:539)
     at com.DisplayTableClaimHistoryTag.displayTable(DisplayTableClaimHistoryTag.java:63)
5.)
>
<%
               int records1 = ic.getTotalNumOfRecords();
               Integer records2 = new Integer(records1);
               String numberOfRecords2 = records2.toString();
          %>
          <inquiry:tableClaimHistory numberOfRecords=<%numberOfRecords2;%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
error message:
claimHistoryView.jsp:194:3: Unterminated tag.
          <inquiry:tableClaimHistory numberOfRecords=<%numberOfRecords2;%> dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
In the custom tag java code called "DisplayTableClaimHistoryTag"
I tried to used the following code:
>
InquiryContext ic = InquiryContext.getContext(session);
>
The problem is that in order to get session I needed HttpSession object. I don't know how to passed HttpSession "session" object
to a custom tag. Is there a way to do this?
>
public class DisplayTableClaimHistoryTag extends InquiryTag
     String numberOfRecords;
     public void setNumberOfRecords(String numberOfRecords)
          this.numberOfRecords = numberOfRecords;
     public String getNumberOfRecords()
          return numberOfRecords;
     public int doStartTag()throws JspException
          InquiryContext context = (InquiryContext)pageContext.getSession().getAttribute(Constrain.CONTEXT);
          if(context==null)
               throw new JspException(TAG_EXCEPTION+ "InquriyContext is null.");
          String hasData = (String)context.getAttribute(Constrain.CONTROL_HAS_DATA);
          if(hasData==null)
               throw new JspException(TAG_EXCEPTION + "The hasData property can not be null.");
          boolean hd = Boolean.valueOf(hasData).booleanValue();
          Debug.println("hasData="+hd);
          Debug.println("hasDataString="+hasData);
          if(hd)
               displayTable();
          else
               disPlayError();
          return SKIP_BODY;
     private void displayTable() throws JspException
          String outString ="";
          Debug.println("dispalyTable() ********* dataAction="+ dataAction);
          JspWriter out = pageContext.getOut();
          * Minimum height height= 103,70
          * 21.7 per row
          * First row==103+21.5=124.5
          * Second row ==103+21.5*2=146
          * Third row ==103+21.5*3=167.5
          Double numberOfRecordsBigDouble = new Double(numberOfRecords);
          double numberOfRecordsDouble = 70 + 21.8*numberOfRecordsBigDouble.intValue();
          if(order==null || order.equals("0"))
          //     outString = "<iframe src=\"" + "/inquiry/" + dataAction + "?order=0"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" height=\""+numberOfRecordsDouble+"\"" +" width=\"100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
          //     outString = "<iframe src=\"" + "/inquiry/" + dataAction + "?order=0"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" style=\"height:"+numberOfRecordsDouble+"px; width:100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
          //     outString = "<iframe src=\"" + "http://www.google.ca"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" style=\"height:"+numberOfRecordsDouble+"px; width:100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
          outString = "<iframe src=\"" + "/inquiry/" + dataAction + "?order=0"+ "\"" + " name=\"dataFrame\" id=\"dataFrame\" style=\"height:"+numberOfRecordsDouble+"px; width:100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
          else
               String orderStr = "?order=" + order;
               outString = "<iframe src=\"" + "/inquiry/" + dataAction + orderStr + "\"" + " name=\"dataFrame\" id=\"dataFrame\" height=\""+numberOfRecordsDouble+"\"" +" width=\"100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
               //outString = "<iframe src=\"" + "/inquiry/" + dataAction + orderStr + "\"" + " name=\"dataFrame\" id=\"dataFrame\" height=\"161\" width=\"100%\" scrolling=\"NO\" frameborder=\"0\"></iframe>";
          Debug.println("dispalyTable() ********* outString = "+ outString);
          try {
               out.println(outString);
          } catch (IOException e) {
               this.log.error(TAG_EXCEPTION + e.toString(), e);
               throw new JspException(e);
>
Any hint would be greated appreciated.
Yours,
John Smith

Ok, couple of things
1 - ALWAYS put quotes around attributes in a custom tag. That rules out items #1 and #5 as incorrect.
2 - You were correct using the <%= expr %> tags. <% scriptlet %> tags are not used as attributes to custom tags. That rules out #3 and #4
#2 looks the closest:
2.)
<%@ include file="../common/page_imports.jsp" %>
<inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>Error Message:
claimHistoryView.jsp:190:4: The required attribute "numberOfRecords" is missing.
<inquiry:tableClaimHistory numberOfRecords="<%=ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/>
Check your spelling of that attribute. It looks right here,.
You also said that ic.getTotalNumOfRecords returns an int, while the attribute returns a String
Try
<%@ include file="../common/page_imports.jsp" %>
<inquiry:tableClaimHistory numberOfRecords="<%="" + ic.getTotalNumOfRecords()%>" dataAction="claimHistoryViewData.do" emptyKey="error.noData"/><%= "" + ic.getTotalNumOfRecords %> is the cop-out way to convert an int to a String :-)

Similar Messages

  • How to pass more than one value for one column in procedure

    hi
    select id, name from col_tab where dept_name in ('ECE','CIVIL');
    when i was running this it is working well.
    CREATE OR REPLACE PACKAGE pack_str
    AS
    TYPE type_refcur IS REF CURSOR;
    PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur);
    END pack_str;
    CREATE OR REPLACE PACKAGE BODY pack_str
    AS
    PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur)
    IS
    BEGIN
    OPEN ans FOR
    select id,name from col_tab where dept_name in char_in ;
    END str;
    END pack_str;
    the package was created.
    my doubt is
    1.how to pass more than one value for char_in (e.g ('ECE','CIVIL'))
    2. when i was storing the value in string like val = 'ECE,CIVIL' ,
    how to get the id,name for ECE and CIVIL.
    plz help me

    Hi Rebekh ,
    I am recreating your packages for the desired output.
    CREATE OR REPLACE PACKAGE pack_str
    AS
         TYPE type_refcur IS REF CURSOR;
         PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur);
    END pack_str;
    CREATE OR REPLACE PACKAGE BODY pack_str
    AS
         PROCEDURE str(char_in VARCHAR2,ans OUT type_refcur)
         IS
              lv_t varchar2(200);
         BEGIN
              lv_t := REPLACE(char_in,',',''',''');
              lv_t := 'select id,name from col_tab where dept_name in (''' || lv_t || ''')' ;
              OPEN ans FOR lv_t;
         END str;
    END pack_str;
    Note:-
    Input Parameter char_in is a comma seperated value for dept_name
    -Debamalya

  • How to install owb server-side software on UNIX Solaris (SPACR-64)?

    Hi there,
    How to install owb server-side software on UNIX Solaris (SPACR-64)?
    I've read the install guide
    and it mentions
    3. Start the installer by entering the following at the prompt:
    cd mount_point
    ./runInstaller
    I don't have access to any graphical interface on the UNIX box e.g. x-windows nor any cd with the software, just the solaris software downloaded from web - does this include the runinstaller
    and is the runisnatller just a command line interface?
    I hoped I would be able to download the software from oracle website and then simply run the a setup scrip?
    Is it possible to do this? Would I simply substitute cd mount_point to cd <directory I put software)
    I've never ran oracle universall installer on UNIX before.
    Many Thanks
    Edited by: user575470 on Feb 15, 2009 7:54 AM
    Edited by: user575470 on Feb 15, 2009 8:06 AM

    Hi,
    You can install the server-side software from the downloaded software.
    You don't need the CD
    You do need an X-windows client on your computer to connect to the server OR work directly on the server.
    Without X-windows you cannot start the Oracle Universal Installer.
    Maybe there is a command line installation, I have never used this.
    I hope this helps.
    Regards,
    Emile

  • How to read a server side file in Applet?

    When I used ZipFile like this,
    ZipFile zf = new ZipFile("http://xxx.com/res.jar");
    It throwed exception about access denied, File pemission...
    How to read a server side file in Applet?

    You generally can't tell with Stream how many bytes are going to be available. You could download the whole thing into a ByteBuffer, for example, and process it from there.
    Or you can try opening an http connection explicitly (using URL and casting the connection to HttpURLConnection and see if there's a "Content-length" header.

  • How to run the Server Side Existing rule in Exchange 2010

    Hi All,
    There were requirement to create a auto forward rule for almost more than 5000 users, which we did, but the we want to apply this rules to the messages which are already in the inbox for all those users where we have created the rule.
    Right now the problem what we are facing is for each individual we have to take full access to their mailbox and execute the rule first time and then it works.
    this is becoming challenging for us to making this for all 5000 users. the other problem is those user are not regularly login to this mailbox, they are using some other Org mailbox, so even we can not communicate to all of them.
    Q1) How to run the Server Side Command which should forcefully apply whatever rules is created for that user should execute for the messages which are already in the inbox.
    Q2) or the powershell for for specific rule name, which can apply on the for all the messages which are there in the inbox.
    Any help would be appriciated!
    Thanks in adv champions!
    Ashku

    Hi Ashku,
    If these 5000 users are all users in your Exchange organization, a inbox rule can be created by the following commands:
    Get-Mailbox | foreach {New-InboxRule -Mailbox $_.Name -Name AutoForward -From [email protected] -ForwardTo UserB}
    Based on my test, the Inbox rule created in server side also cannot work on the message that have already been in the Inbox unless users click “Run Rules Now…” in their Outlook client. And the transport rule in Exchange server only works
    during the message sending process.
    Therefore, there may be no feature in Exchange server side to meet your requirement.
    Thanks for your understanding.
    Thanks,
    Winnie Liang
    TechNet Community Support

  • How to pass the FORM Fields value by Form Personalization

    Hi ALL,
    I want to pass form filds values in to procedure. I am calling this procedure through form personalization of that form..... But it's not accepting any form field's value there... when i am passing hardcoded vales procedure is executing fine...
    can any one suggest what to do???
    i tried with these syntax
    TEST_EMP_FP(:ADDR.ADDRESS_ID,'ABC')
    TEST_EMP_FP(${item.ADDR.ADDRESS_ID.value},'ABC')
    Regards
    Ravi

    Hi,
    Iam calling an SRS from forms personlization. Can any body tell me how to pass the Form field values as parameters to the Reports. (Example when they call this Concurrent request from Transact5ions screen, The invoice number should be defaulted in the report parameter).
    Regards,,
    Anil.

  • How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi
    Can anyone tell me.
    How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi Mithlesh,
    javascript runs on client side and you cannot assign the value to a Page attribute directly.
    As a workaround,you can use an Inputfield,hidden if required,and set the value using javascript.Then the form will have to be submit to be able to read the value in onInputProcessing and then can be assigned to any variable.
    In Layout
    <head>
    <script language="javascript">
    function pass()
       txt1 = document.getElementById("ip_mrf");
       txt.value = "hello" ;
    </script>
    </head>
    <htmlb:inputField  id="ip_mrf"
                               value="<%=mrf_number%>"
                               visible="FALSE"/>
    in onInputProcessing
    cha1 = request->get_form_field( 'ip_mrf' ).
    where cha1 is the page attribute
    hope this helps,
    Regards,
    Siddhartha
    Message was edited by: Siddhartha Jain

  • How to render custom JSP tags

    We have our own custom JSP tag libraries (some of them extend the Struts tags, but many do not) and want those to render correctly in the design view.
    Is that supported by NitroX Struts, or will it only work with built-in Struts tags?
    If it is supported, how does one get NitroX to run the custom tags?

    It is possible to customize many aspects of the rendering of a custom tag. This is done using a combination of an M7 specific metadata, and standard css rules.
    For example, you can change the label, icon and border of a custom tag by doing the following steps:
    1) Create a folder named "nitrox" where your tld file is located. For example if you have "/WEB-INF/app.tld" then create a
    folder "/WEB-INF/nitrox/".
    2) In the nitrox folder created above, create a file named "app.tlei" (for Tag Library Extra Information). The file name used here should match the name of the tld file. In this case "app".
    3) Paste the following content in the app.tlei file:
    <taglib-extrainfo>
    <css-uri>app.css</css-uri> <!-- an optional css file relative to this tlei file -->
    <tag name="myTag">
    <display-name>My Tag</display-name> <!-- The name displayed in the Tag Libraries view -->
    <rendering-label>{tag-name} ({name})</rendering-label> <!-- This will display the value of the "name" attribute in addition to the tag name in the tag view in the JSP design editor. -->
    <small-icon>images/myTag.gif</small-icon> <!-- The image uri relative to this tlei file. This is used in the Tag Libraries view and in the JSP design editor.-->
    </tag>
    </taglib-extrainfo>
    All customization tags are optional.
    4) Create the css file referenced from the tlei file above (in this example app.css in the same directory containing the tlei file).
    5) Paste the following content in the app.css file:
    myTag {border: 1 solid red; display: "inline"}
    This will render the tag as inline (i.e as one graphical object) even if the tag has nested content.
    In addition, you can use any standard css style property.
    You can customize other tags in the same fashion.
    If a custom tag inherits from a Struts tag, then the tag can inherit the full built-in tag customization as shown in the following example:
    Suppose you have a tag named "myText" that extends the Struts html:text form field tag. To inherit the NitroX html:text customization you follow the steps:
    1) insert the following in the tlei file described above:
    <tag name="myText">
    <inherit taglib-uid="http://jakarta.apache.org/struts/tags-html" tag-name="text" />
    </tag>
    2) Insert the following css rule in the css file referenced from the tlei file:
    myText {m7-inherit: "input-text"; display: inline}
    This will inherit the built-in css style for form text fields.
    Likewise, you can inherit the other Struts tags css styles by using the following rules:
    myPassword {m7-inherit: "input-password"; display: inline}
    myCancel {m7-inherit: "input-submit"; display: inline}
    myCheckbox {m7-inherit: "input-checkbox"; display: inline}
    myRadio {m7-inherit: "input-radio"; display: inline}
    mySelect {m7-inherit: "select"; display: inline}
    myTextarea {m7-inherit: "textarea"; display: inline}
    3) The inherited tag library file (in this example the struts-html.tld), must also be present under the WEB-INF directory.
    M7 Support

  • How to delete the server side sessions

    Hi All,
    I have a wireless application and it is accessed through ptg/rm gateway from a PDA browser. Oracle wireless AS gives default login page (when the application is accessed through ptg/rm gateway) and when user login, user information session might get stored in server side (I am not sure, if any one can pls clarify me on this also?).
    Now i have a requirement, in which my application user should get 'logoff' button in each and every page of my application. When he clicks on this button the user information session should get invalidated, so that even if the user goes back to the application (using back button of the browser) he should not able to enter the application. (This is same as any std. login/logout page logic).
    Invalidating the session which resides in client side is easy (By using session.invalide()), but how can i delete the session which resides on the server side??? Whether is it possible??
    If yes then how can i do it.
    Any help will be very usefull.
    Thanks well in adavance.
    Shrikant

    Shrikant:
    Shouldn't it be easy to invalidate the server sided sessions? Right before invalidating the client side session, send a message to the server, which should call its session.invalidate() after it has obtained the current session. If desired, a message can be sent back to the browser informing user that server side session has been deleted.

  • How to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part

    Hi,
    I want to pass multiple query string values using the same parameter in Query String (URL) Filter Web Part like mentioned below:
    http://server/pages/Default.aspx?Title=Arup&Title=Ratan
    But it always return those items whose "Title" value is "Arup". It is not returned any items whose "Title" is "Ratan".
    I have followed the
    http://office.microsoft.com/en-us/sharepointserver/HA102509991033.aspx#1
    Please suggest me.
    Thanks | Arup
    THanks! Arup R(MCTS)
    SucCeSS DoEs NOT MatTer.

    Hi DH, sorry for not being clear.
    It works when I create the connection from that web part that you want to be connected with the Query String Filter Web part. So let's say you created a web part page. Then you could connect a parameterized Excel Workbook to an Excel Web Access Web Part
    (or a Performance Point Dashboard etc.) and you insert it into your page and add
    a Query String Filter Web Part . Then you can connect them by editing the Query String Filter Web Part but also by editing the Excel Web Access Web Part. And only when I created from the latter it worked
    with multiple values for one parameter. If you have any more questions let me know. See you, Ingo

  • How to pass a run time value as a parameter to a webdynpro iview

    Hi,
    we have a webdynpro which we can call with passing a run time value in this form:
    https://xxx.yyy.zzz/sap/bc/webdynpro/sap/zfkq_inv_1?WI_ID=000000004332&sap-client=700&sap-language=EN&sap-wd-sapgui=X
    This link will be sent to many users but the WI_ID will change every time.
    It works fine but now we want to implement this webdynpro in our portal. The user shall get a link like this
    https://xxx.yyy.zzz/irj/portal/webdynpro-test?wi_id=000000004332. With this link he will navigate directly to the webdnypro (quicklink-function).
    The problem is that i don't know how to transfer the parameter WI_ID in the url to the webdynpro.
    It's no problem to fix the WI_ID in the application parameter properties but this is not what we want.
    Is it possible to transfer the url parameter to the application parameters of the webdynpro iview ?
    Thanks in advance.
    Best Regards
    Mirko Berscheidt

    Hi Mirko,
    The first thought I had is if your scenario makes sense at all. Because you might send out the links, but probably the iView will also be accessible via navigation, and in that case this additional parameter won't be there!?! (And if the iView is not accessible by navigation, then why going the way via the portal and not the direct way to the application like with your first link given?!).
    Anyhow, I think this should be possible by using the AppIntegrator, see The customer exit of the Application Integrator
    For an example about how to add individual values to users which you then can add to the URL see this discussion: App Integrator, and custom URL parameters using Customer Exits - this might be a possibility that each user can call the "same" iView but in fact the app integrator then would be fired with different URL parameters (per user).
    Hope it helps
    Detlev

  • FMS 3.5 - How to use remoting Server Side

    I am very interested in using Remoting in order to connect to a Drupal AMFPHP service module.  On the client side this is easily done and I have had limited success on the Server side, but a good guide on how to do this properly and be able to get the data being returned would be great.
    Thanks,
    Chris
    ChrisMcIntoshDesigns.com

    I don't know if Drupal's AMFPHP implementation is any different than a straight install of AMFPHP, but this article should help to get you started:
    http://www.sephiroth.it/tutorials/flashPHP/flashcomm_AMFPHP/index.php

  • How to pass an array of values to  a view criteria

    Hi all,
    How to pass mutiple values as array into a view criteria.I want to search
    based on mutiple values.
    Please help.
    Thanks

    Swapna wrote:
    I have a search panel with mutilselect combobox for attributes "a","b", & "c".
    Based on selction"a" ,I need to filter the comboboxes "b" and "c".
    This's the requirement.I'm not sure that I understand your question. Are you saying that you have three different controls in your UI? Or one control that has three possible values?
    Assuming that you have one control with three possible values, if "a" is selected, does that mean that you want all rows where some column has a value of "a"? Or does that mean that you want all rows where that column does not have a value of "a"? Or does that mean that you want all rows where that column has a value of "b" or "c" (note that the last two may be different if the column allows NULL values).
    What language is your application written in? What framework/ library are you using to access the database? Are you passing a PL/SQL collection of selected values?
    Justin

  • State machine custom task workflow how to pass one task field value to the next task field

    i am using ItemMetadata.xml to pass value from list to custom task first value its passing the but second value is showing as null
    plus how to pass one custom task value to the next custom task
    i.e one supervisor approver comments submitted field i want to see on department manager approval custom task which is the next approver from supervisor
    ows_firstfield=""
    ows_SecondField=""
    the above ows fields are from list
    in this i am unable to retrive the second value in the task form this is my first query?
    second query is that how can we pass one task field value to next approver task field value?
    any idea
    MCTS,ITIL

    What type of workflow is this?  IS this Visual Studio or SharePOint designer or third party (K2, Nintex, etc...)?  YOu should be able to get ahold of the task that was edited via the correlation token, and then grab any value you want from that
    task (wether it be a custom field or a standard worfklow task field). 
    It would help to know what you are using to build the workflow.
    Thanks!

  • How to pass the bind variable value to the sql statement of the LOV

    Hi,
    I am using Forms 10g builder.
    I have a text item which will be populated by a LOV when i press a button, but i have a bind variable in the SQL statement of the LOV. That bind variable should be replaced by a value which is derived from a radio group in the same data block.
    For Ex: ( )radio1 ( )radio2
    before i click on the push button, I'll select one of the radio button above,so my question is how to assign this radio group value to the bind variable in the sql statement in the LOV?
    Pl any hint is appreciated!
    Thanks
    Reddy

    The variable can be taken into account in the SELECT order contained in the Record Group used by the LOV.
    e.g. Select ... From ... Where column = :block.radio_group ...Francois

Maybe you are looking for