How to read Standard JSR Portlet Web.xml's context-param

Hi
I am completely new to Java.
I want to keep some configuration in Web.xml in Context param. My Web.xml looks like
<context-param>
<param-name>ConfigUrl</param-name>
<param-value>http://localhost:8083/</param-value>
</context-param>
How can I read these values? Can I read these values directly in my JSP file or will I have to read it in my Portlet Class in some function.
Thanks

As soon as I use portletConfig, it gives me NullPointerException. I am definitely using <portlet:defineObjects/>
My Jsp looks as :
<%@ page contentType = "text/html; charset=windows-1252"
pageEncoding = "windows-1252"
import = "javax.portlet.*, java.util.*, port.Port, port.resource.PortBundle,javax.portlet.PortletContext"%>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<portlet:defineObjects/>
<%
PortletContext ctx = portletConfig.getPortletContext();
String configpath = "Hello";
%>
<label>Welcome</label>
<label><%=configpath%></label>

Similar Messages

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to read configuration data from an xml file (not web.xml)?

    Hi,
    I want to separate the application specific configuration parameters in a separate xml file and read them as and when they are needed? I know that I can use the wb.xml but I want to separate them in a different xml file because I don't want the web.xml file to be played around later after deployment. If any change is needed then it should be done in the application-config.xml.
    How can I read the parameters from this xml file in my jsp code and also what should be the location of this file if I have
    ../webapps/Root/application
    directoty structure ?
    Any help is greatly appreciated.

    can you give an example of a property file and also
    it is loaded in the jsp ?Hmm... loading properties in a JSP is not a very good idea. You should do it in a separate class, rather than mixing the logic with the display logic.
    Properties properties = new Properties();
    properties.load(UtilClass.class.getResourceAsStream("config.properties"));
    // Add a try - catch block around the load
    // for IOException...

  • How to configure IP address thrugh web.xml doubts

    Hello there
    I want to configure my web application. How can i initialise the IP Address and ports through web.xml file?
    thanks!

    ashish.251985 wrote:
    I want to configure my web application. How can i initialise the IP Address and ports through web.xml file?You cannot do that in the web.xml.
    At least the port can be configured in one of the configuration files in the /conf directory of the application server. The exact details and procedure depends on the application server implementation. Read its documentations.

  • How to read text from a web page

    I want to read text from a web page. Can any body tell me how to do it.

    Ok i tell you detail. visit the site " http://seriouswheels.com/" you will a index from A to Z which are basically car name index i want to read each page get car name and its model and store it in data base. I you can provide me the code i will be very thankful.

  • How to give relative path in web.xml?

    Hi All,
    Im creating a servlet which has to load the properties file.
    I don't want to give the location of the properties file as ABSOLUTE PATH. But I'm unable to provide the same as RELATIVE PATH.
    When I give the path is given as ABSOLUTE PATH (drive:/dir/) it is working. But if I give the RELATIVE PATH(../), the same is not working.
    Kindly help me in this.
    Regards,
    Kumar Madhavan.
    My web.xml file is:
    <?xml version="1.0"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
         <display-name>NGT - ASCII</display-name>
         <description>Application for Safety Critical Information vIew.</description>
         <welcome-file-list>
              <welcome-file>ASCII.html</welcome-file>
         </welcome-file-list>
         <context-param>
              <param-name>asciifiledir</param-name>
    <!-- This is the tag in which I would like to
              <param-value>../</param-value>
         </context-param>
    </web-app

    Hi.
    Exclude the directory path from the <param-value/> in
    the web.xml and just keep the property file name.
    Place the property file in the classpath and load it
    like this from the servlet:
    Properties props = new Properties();
    String propFileName = "" // Read param-value from web.xml
    try {
    InputStream is = TheServlet.class.getResourceAsStream(propFileName);
    props.load(is);
    } catch (Exception ex) {
    System.out.println("Prop file not in classpath!");
    /Jesper

  • How to read an attribute of an xml tag in jsp.

    hi guys,
    This is murali krishna. i have a small problem,
    i have one xml file (books.xml)
    <?xml version="1.0" encoding="iso-8859-1"?>
    <library>
    <book id="1">
    <name>Head First Java, 2nd Edition</name>
    <author>Kathy Sierra and Bert Bates</author>
    <publication-date>09-Feb-2005</publication-date>
    </book>
    <book id="2">
    <name>Effective Java</name>
    <author>Joshua Bloch</author>
    <publication-date>28-May-2008</publication-date>
    </book>
    <book id="3">
    <name>Java How to Program, 7th Edition</name>
    <author>Harvey M. Deitel and Paul J. Deitel</author>
    <publication-date>6-Jan-2007</publication-date>
    </book>
    </library>
    I tried to read this xml file in jsp as shown below
    <%@ page language="java" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="javax.xml.parsers.DocumentBuilder" %>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory" %>
    <%
    DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
    DocumentBuilder db =dbf.newDocumentBuilder();
    Document doc=db.parse("c:\\books.xml");
    NodeList nl = doc.getElementsByTagName("book");
    %>
    <html>
    <head>
    <title>How to read XML file in JAVA</title>
    </head>
    <body>
    <%
    for(int i=0;i<nl.getLength();i++)
    NodeList nameNlc= doc.getElementsByTagName("name");
    Element nameElements=(Element)nameNlc.item(i);
    String nameTagValue=nameElements.getChildNodes().item(0).getNodeValue();
    NodeList authorNlc= doc.getElementsByTagName("author");
    Element authorElements=(Element)authorNlc.item(i);
    String authorTagValue=authorElements.getChildNodes().item(0).getNodeValue();
    NodeList dateNlc= doc.getElementsByTagName("publication-date");
    Element dateElements=(Element)dateNlc.item(i);
    String dateTagValue=dateElements.getChildNodes().item(0).getNodeValue();
    out.println("name :"+nameTagValue+"<br>");
    out.println("author :"+authorTagValue+"<br>");
    out.println("publication-date :"+dateTagValue+"<br><br>");
    %>
    </body>
    </html>
    so, my problem is I was unable to read the attribute of the tag book , that is "id".
    can any one tell me how to read this "id" attribute.
    Murali Krishna
    [email protected]

    hi,
    U r retriving the elements by tag name.So it just chks the tag name ie.<book> & gives u array of elements.But u need retrive d attribute of <book> tag itself.
    =Solution =====
    Add one more statement ----> var[]= doc.getElementsByName("book");
    Now u hav book elements as an array & can retrive id in for loop
    for(var; var.length;var++)
    doc.element[var].id.value

  • How to read Data of a Webi Report

    Hello Friends,
    I have a task where I need to read data of a Webi Report, how can it be done?
    Basically I have a trigger report which runs every day and get the latest RACN number from the database. I am trying to get that RACN number from trigger report using BOBJ SDK.
    I really appreciate your suggestions on this.
    Regards,
    Rakhy. 

    Hi Rakhy,
    Is the RACN Number a column or dimension in your webi report? Is it a universe object(webi based on universe)
    Also what version of BusinessObjects you are using?
    If you are using XI 3.1 and you need to retrieve objects from a webi report it can be done using the ReportEngine SDKs.
    Please refer to the developers guide and API referrence guide available at
    http://help.sap.com/businessobject/product_guides/boexir31/en/resdk_java_dg_12_en.zip
    http://help.sap.com/businessobject/product_guides/boexir31/en/resdk_java_apiRef_12_en.zip
    Also refer to the document at
    http://scn.sap.com/docs/DOC-38618 for better understanding the workflow.
    An example snippet of how to retrieve an object is below
    =========================================
    DocumentInstance wiDoc = widocRepEngine.openDocument(oInfoObject.getID());
    ReportDictionary reportDictionary=wiDoc.getDictionary();
    for(int a=0;a<reportDictionary.getChildCount() ;a++)
    String name=reportDictionary.getChildAt(a).getName();
    out.println(name);
    =========================================
    -Prithvi

  • How can I change application's web.xml in NetWeaver CE 7.1?

    Hello Experts,
    Please help me. I need to configure a J2EE application on NetWeaver 7.1, but I don't know how I can change the web.xml of the application.
    The web.xml of the app needs to be modified during the configuration. This can be achieved via single-file-update in VA in Netweaver 6.4 or 7.0. But I cannot figure out how to do that in NW 7.1.
    Please show me how to do that or at least give me some hints.
    Thank you!
    Jack

    Hi Jack,
    In SAP NetWeaver 7.1 and later, you use the SAP NetWeaver Administrator instead of Visual Administrator.
    To get some information on how to configure web applications, try [THIS|http://help.sap.com/saphelp_nwce10/helpdata/en/45/48a60a528608d1e10000000a11466f/frameset.htm] piece of documentation.
    I hope it helps.
    Best,
    Yordan

  • How I can edit the file web.xml in JSC2??

    this is my only quiestion again...

    Use "Files" view of project (if isnt visible, go to menu "View" and select "Files"), then expand web node, then WEB-INF node and here you will found web.xml.
    Regards.

  • How to read the attribute of the xml file using jaxb

    Thanks,
    Buddy as i have a issue i have to read the xml file using jaxb and xml file contains this data and i have read the attribute like name , desc and action for a particular menu name pls tell the code how to do this it will be a great favour to me
    thanx in advance
    Rasool
    <contextmenu>
    <menu name='Lead' >
    <menuitem name='newlead' desc='New Lead' action='/leads.do?dispatch=insert' />
    <menuitem name='editlead' desc='Edit Lead' action='' />
    <menuitem name='leadinfo' desc='Lead Information' action='' />
    </menu>
    <menu name='Cases' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    <menu name='Contact' >
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    <menuitem name='' desc='' action='' />
    </menu>
    </contextmenu>

    What my program do is to get the encoding of XML files and convert them to UTF-8 encoding files, while I need this "encoding" information of the original XML document thus I can convert...
    After reading specifications and JDOM docs, the truth turns to be disappointed, no function is provided to get this information in JDOM level 2(the current released one), while it's promissed that this function will be provided in JDOM level API....
    Thanx all for your help and attention!!!

  • How to call standard report in web dynpro abap.

    Hi All,
       I need the output of one standard report e.g RHXSTR00 on web dynpro abap.
       How can I achieve this?
       Please help!!! Points will be rewarded.
       Thanks in advance!
    Cheers,
    Darshna.

    Hi Darshna,
    The report result is ALV and in most of the cases we generally do not have function modules or any other easy way to get the output.
    In such cases the best approach which we follow is, to run this in background mode and generate the spool and display the ouput in PDF.
    But if intertactive form is not present in your requirement then we need to debug the logic of the report (if no FM or class present) and get the results and display it in the View.
    Best regards,
    Suresh

  • How to implement STANDARD Picklists in Web ADIs

    Hi,
    I have been developing, configuring and implementing Custom Web ADIs in Oracle HRMS and I have used Excel 2000 as the third party tool and were able to implenment CREATE and UPDATE type of Integrators.
    Also I am able to implement 'Standalone Queries'.
    Using BEN_INTERFACE_COLS_B Table I am able to implement POPLISTs which is one among the two types of LOVs supported by Web ADI.
    The other type is 'STANDARD' LOVs. I was trying to implement STANDARD LOVs, by using BNE_COMPONENTS_B Table.
    But I got struckup at this point on,
    1. Will Oracle Web ADI support user defined Java Class components?
    2. If so after developing the Java componenet, what all updations are required other than updating BNE_COMPONENETS_B Table?
    (How to integrate this java component with the integrator, I knew that VAL_COMPONENT_APP_ID & VAL_COMPONENT_CODE in the
    Table BEN_INTERFACE_COLS_B has to be updated but will this be enough? )
    3. Where to put the Java class component file in the Unix box to be used by the Custom Web ADIs.
    Please Advice
    thanks in Advance..
    Anil Krishnan
    [email protected]

    Hi,
    I tried updating bne_interface_cols_b for an existing column.
    In launch Journal wizard, the 'Expense Type' or 'Segment3' has some LOV attached to it. I need to point that LOV to my custom table somehow.
    I tried updating the table with the given values
    UPDATE bne_interface_cols_b
    SET val_id_col = 'VAR_FIXED',
    val_mean_col = 'MEANING',
    val_type = 'TABLE',
    lov_type = 'POPLIST',
    val_obj_name = 'MY_TABLE_NAME',
    OFFLINE_LOV_ENABLED_FLAG='Y',
    GROUP_NAME=NULL,
    SEGMENT_NUMBER=NULL
    WHERE interface_col_name = 'SEGMENT3'
    AND application_id = 101
    AND interface_code = 'GL_INTERFACE_120'
    But I am not able to see any change when i run the 'launch Journal Wizard' ADI. It still displays the old lov
    Can you please help

  • How to read values from the following XML?

    I have been using "extractValue" to get the values from a xmltype field and no problems until now.
    The xmltype now is like:
    <a>1</a>
    <b>2</b>
    <c>1221</c>
    <c>1412</c>
    <d>11111</d>
    <e>3333</e>
    I'm able to read values from 'a,b,d,e' but not from 'c'.
    Questions:
    1)- Is posible to read the values of field c?. How?
    2)- If is not posible to read the field values, Is posible to transfor the xmlfield to:
    Where I will be able to use xmltable columns and loop getting the values.
    <a>1</a>
    <b>2</b>
    <k>
    <c>1221</c>
    <c>1412</c>
    </k>
    <d>11111</d>
    <e>3333</e>
    Like always
    Thank you in advance for your help.
    Jose Galan

    SQL> with XML as
      2  (
      3   select xmltype(
      4  '<root>
      5    <a>1</a>
      6    <b>2</b>
      7    <c>1221</c>
      8    <c>1412</c>
      9    <d>11111</d>
    10    <e>3333</e>
    11  </root>'
    12  ) XMLDOC
    13    from dual
    14  )
    15  select a, b,c, d, e
    16    from XML,
    17         XMLTABLE
    18         (
    19            '/root'
    20            passing XMLDOC
    21            columns
    22            A number(5) path 'a',
    23            B number(5) path 'b',
    24            D number(5) path 'd',
    25            E number(5) path 'e',
    26            C_XML_FRAG xmltype path 'c'
    27         ),
    28         XMLTABLE
    29         (
    30           '/c'
    31           passing C_XML_FRAG
    32           columns
    33           C number(5) path '.'
    34         )
    35  /
             A          B          C          D          E
             1          2       1221      11111       3333
             1          2       1412      11111       3333
    SQL>

  • How to read and parse a remote XML file with Java

    Hi.
    Using J2SE v1.4.2, I'd like to read and parse a remote file:
    http://foo.com/file.xml
    Is it possible with Java? I'd be extremely grateful if someone could provide me any webpage showing a very simple code.
    Thank you very much.

    How about the following?
         import java.io.InputStream;
         import java.net.URL;
         import javax.xml.parsers.DocumentBuilder;
         import javax.xml.parsers.DocumentBuilderFactory;
         import org.w3c.dom.Document;
         public static void main(String[] args) throws Exception {
              DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
              DocumentBuilder db = dbf.newDocumentBuilder();
              URL url = new URL("http://foo.com/file.xml");
              InputStream inputStream = url.openStream();
              Document document = db.parse(inputStream);
              inputStream.close();
         }-Blaise

Maybe you are looking for