Accessing config object in jsp page

I have been trying to access the config (implicit) object in my jsp page. In my web.xml, for my application, I have specified an init-parameter. To get the value of this parameter, I have the following code being executed
<%
     String protocol = config.getInitParameter("protocol");
     out.println("Protocol = " +protocol);
%>
The output turns out to be Protocol = null.
If I specify the init-parameter in Tomcat's web.xml in conf directory, then I do get the value. But that does not serve my purpose. I am using jakarta-tomcat-4.0-b7.
Any suggestions!!!!!!!

Try this link, http://archives2.real-time.com/rte-tomcat/2000/Apr/msg01124.html

Similar Messages

  • How can I get the "pageContext" object in jsp page?

    Hi everyone:
    I want to get struts's DataSource object in jsp page.So I should get the PageContext object in jsp page.My code is:
    ///////////////////datatest.jsp///////////////////////////////////
         DataSource ds=(DataSource)pageContext.getAttribute(Action.DATA_SOURCE_KEY);
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    Is right?But I get the "NullPointerException" error in Tomcat.The connection pool in struts-config.xml is:
    <data-sources>
    <data-source key="mydatasource">
    <set-property property="autoCommit"
    value="false"/>
    <set-property property="description"
    value="MyWebSite Data Source Configuration"/>
    <set-property property="driverClass"
    value="org.gjt.mm.mysql.Driver"/>
    <set-property property="maxCount"
    value="4"/>
    <set-property property="minCount"
    value="2"/>
    <set-property property="password"
    value="qijiashe"/>
    <set-property property="url"
    value="jdbc:mysql://localhost:3306/myweb"/>
    <set-property property="user"
    value="lyo"/>
    </data-source>
    </data-sources>
    I can query the database in servlet.
    I think the method that I get the context is not right.Had someone get the pagecontext in jsp page?help :(

    Sorry I forgot that I had change the code:
    DataSource ds=(DataSource)pageContext.getAttribute(Action.DATA_SOURCE_KEY);
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    to the code:
    DataSource ds=(DataSource)pageContext.getAttribute("mydatasource");
         conn=ds.getConnection();
              stm=conn.createStatement();
              rs=stm.executeQuery(insertsql);
    mydatasource is the struts datasource in "struts-config.xml". I couldn't work

  • How to access COM+ Objects From JSP

    Friends,
    We have a requirement to access COM+ objects from JSP. Please guide me on this.
    Thanks in advance.
    Tarani

    Sanyam wrote:
    if there is any .dll extension file, how can we read that file in labview?
    You can use Call Library Function node to call that dll file and use it in LabVIEW. Read the help and you will get more details.

  • Accessing another par file jsp pages

    Hi
    i need to access another par file JSP pages from my par file, what all i need.
    any help is appreciated.
    Thanks,
    Damodhar.

    Gandhi,
    Well..there is a very good article on how to use resources(watever resources u mentioned) of one par inside any other par file on SDN:
    Here is the document:<a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/b3c1af90-0201-0010-c0ac-c8d802d264f0">JSPs, Resources...</a>
    Xml files i worked were not property files of an iview.
    They were application specific xml files.I read these xml files on a different par(or iview).For that matter, they don need not be of type xml,could be any type of resource.
    Regards,
    P.

  • Problem accessing exception object in jsp error page - Apache Tomcat 5.0.25

    Hi all,
    I'm thoroughly confused and need some help. I've deployed a very simple web application in Apache Tomcat 5.0.25 to test exception handling - errortest.jsp and error.jsp. errortest.jsp throws a divide by zero exception if executed with default values in text fields.
    When I put the directive IsErrorPage="true" in error.jsp i get a HTTP 500 error when error.jsp is accessed. If I remove it error.jsp is displayed but I cant access the exception object - if I try to I get an exception below:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 5 in the jsp file: /error.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    E:\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\mywebapp\org\apache\jsp\error_jsp.java:46: cannot resolve symbol
    symbol : variable exception
    location: class org.apache.jsp.error_jsp
    out.print(exception.getMessage());
    ^
    1 error
    Below is the code for the two jsp pages:
    errortest.jsp:
    <%@ page errorPage="error.jsp" %>
    <html>
    <head><title>Error test</title></head>
    <body>     
         <form action="errortest.jsp" method="post">
         Enter first number:<input type="text" name="first" value="5"/><br>
         Enter second number:<input type="text" name="second" value="0"/><br>
         <input type="submit"/>
         </form>
         <%
         if (request.getMethod().equals("POST")) {
              int first = Integer.parseInt( request.getParameter( "first" ) );
              int second = Integer.parseInt( request.getParameter( "second" ) );
              int answer = first/second;
         %>
    </body>
    </html>
    NB: I am able to catch and display the exception if I use a try/catch block around the division as shown below.
    try {
    int answer = first/second;
    } catch( Exception e) {
    e.printStackTrace( new PrintWriter(out) );
    error.jsp (first draft)
    NB: HTTP 500 error occurs when directive "isErrorPage" is added:
    <%@ page isErrorPage="true" %>
    <html>
    <head><title>Error Page</title></head>
    <body>
    </body>
    </html>
    error.jsp (second draft)
    NB: directive is removed but exception thrown when implicit exception object is accessed. error.jsp displays if exception object is not accessed:
    <%@ page %>
    <html>
    <head><title>Error Page</title></head>
    <body>
    <%=exception.getMessage()%>
    </body>
    </html>
    Web server specs:
    Apache Tomcat 5.0.25
    Machine specs:
    Windows XP Pro
    Java environments:
    j2sdk1.4.2_03
    J2EE 1.4

    This works for me:
    throwError.jsp
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <%@ page language="java" errorPage="/error.jsp"
    contentType="text/html; charset=utf-8" %>
    <html>
    <head>
         <title>Throw Exception</title>
    </head>
    <body>
    Throwing exception....
    <%
    // throw ArithmeticException
    int badInt = 12/0;
    %>
    </body>
    </html>
    error.jsp
    <%@ page language="java" isErrorPage="true" %>
    <head><title>Doh!</title></head>
    An Error has occurred in this application.
    <% if (exception != null) { %>
    <pre><% exception.printStackTrace(new java.io.PrintWriter(out)); %></pre>
    <% } else { %>
    Please check your log files for further information.
    <% } %>

  • Access to a method located in view object from JSP page?

    Hi,
    How can i access a public method which is loacted in view
    object "viewobjectImpl.java" from JSP page.

    Juan,
    Either via Data tags or/and Java embedded code.(<%...%>).
    This method, suppose to execute a stored procedure.
    Thanks

  • How to update Row Object in JSP Page? urgent!!!

    HI,
    I have a JSP Page and I have used jbo:DataSource and jbo:ApplicationModuleTags.
    Step 1: I have created a oracle.jbo.ViewObject view using
    view = ds.getRowSet().getViewObject(); and executed query using view.executeQuery()
    Step 2: I access the Row Object for this view like this
    Row rs = ds.getRowSet().getCurrentRow().
    Step 3: I try to set the attributes for this Row using setAttribute methods like this
    rs.setAttribute("empName","James");
    Step 4: Now I want to update this row. How to update this???
    If i need to get a Transaction object, which object's getTransaction I should use?
    Note: Please note that I haven't used <jbo:Row > tags to access my row. I simply get the Row object from view and want to update certain attributes and commit to database.
    Thanks
    Hari

    Hi Harihara!
    I think the record pointer is still before the first row, because you just executed the query.
    Try one the following statements instead of 'Row rs = ds.getRowSet().getCurrentRow()':
    Row rs = view.first();
    or
    Row rs = ds.getRowSet().first();
    And don't forget to commit your changes if the master process doesn't take care of it already!
    Good Luck!
    Rolf van Deursen.

  • Message bundles accessed from JSF and JSP pages

    Hello, everybody!
    I'm developing a localized JSF application. It is working pretty well until now.
    These are my message files:
    mensagens.properties
    mensagens_en_US.propertiesThis is how they're configured in faces-config.xml:
    <application>
        <resource-bundle>
            <base-name>br.urca.www.biblioteca.web.mensagens</base-name>
            <var>msg</var>
        </resource-bundle>
    </application>And this is how I access the messages in a page:
    <h:outputText value="#{msg.titulo}" />Nothing new until now. But now there was a need for me to have a raw jsp page in
    my web application. This page is displaying ok but I also need to access the
    message bundles as I'm able to access in the normal jsp with the JSF components.
    As you should know I can't use something like the above code with an +<h:outputText>+
    to access the messages because this is a JSF component and I'll not be able to use
    JSF components with this raw jsp page.
    So, my question is: how do I access my localized messages from a raw jsp page? I
    suppose there should be a way to do this, but unfortunately I started programming
    to the web world in Java with JSF, not JSP, so I don't know how to do this with
    JSP.
    Thank you very much.
    Marcos

    BalusC wrote:
    Just include [jstl-1.2.jar|https://maven-repository.dev.java.net/repository/jstl/jars/] in your classpath and define the fmt taglib in your JSP. Nothing more is needed.
    Hello, BalusC. Thank you for your help. We're almost there. After I have included the jstl-1.2.jar you provided me I can use the fmt tag and access message bundles from my raw jsp page (even though I had to provide other message bundles instead of the ones that I use in the other jsf pages, but it's better than nothing).
    Now there just on problem to be fixed. The jsp page is not aware when I change the locale of my application. I change this locale in a jsf page.
    I have this component:
    <h:selectOneMenu value="#{pesquisaAcervo.idiomaAplicacao}"
        valueChangeListener="# {pesquisaAcervo.idiomaAplicacaoMudado}" onchange="submit();">
        <f:selectItems value="#{pesquisaAcervo.idiomasAplicacao}" />
    </h:selectOneMenu>that calls this event in my backing bean class:
    public void idiomaAplicacaoMudado(ValueChangeEvent e)
        fIdiomaAplicacao.liberarItens();
        Idioma idioma = Idioma.deString(e.getNewValue().toString());
        // This line is for JSF
        FacesContext.getCurrentInstance().getViewRoot().setLocale(idioma.localidade());
        // This line is for Tiles
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().
            put(org.apache.tiles.locale.impl.DefaultLocaleResolver.LOCALE_KEY, idioma.localidade());
    }So, do I have to include another line in the idiomaAplicacaoMudado event above in order for the jsp page load the correct resource bundle? Or what else do I have to do?
    Thank you.
    Marcos

  • Problem in getting an object in JSP page.

    Hi experts,
    I am forming a javabean object in the controller(servlet) and passing the object to a JSP page by setting that object as an attribute. But in that jsp page, when i compile, its not able to locate the class. At the beginning itself while typecasting the attribute as that bean object, i get an error. All the servlet, bean files are in the default package only.
    This is how i used..
    <%
    String m = (String) request.getAttribute("mode");
    //My bean object below.
    adjuster_bean res=(adjuster_bean)request.getAttribute("data");
    %>
    And i am using like, calling the bean object's get method to set values of the text boxes in the JSP page. I need help please....

    Vigsen wrote:
    Hi experts,
    I am forming a javabean object in the controller(servlet) and passing the object to a JSP page by setting that object as an attribute. But in that jsp page, when i compile, its not able to locate the class. At the beginning itself while typecasting the attribute as that bean object, i get an error. All the servlet, bean files are in the default package only.
    This is how i used..
    <%
    String m = (String) request.getAttribute("mode");
    //My bean object below.
    adjuster_bean res=(adjuster_bean)request.getAttribute("data");
    %>
    And i am using like, calling the bean object's get method to set values of the text boxes in the JSP page. I need help please....Are you importing the bean class in your jsp? Something like this...
    <%@ page import="java.util.*, yourpackage.YourBeanClass" %> Secondly, I see standards not followed in your code...
    a) Firstly, as someone else pointed out in this same post. Avoid as much as possible using java scriplets in JSPs. Instead try use JSTL and EL expressions.
    b) A java class name should always start with capital letter for every word in the class name and with no underscores. Your bean class name (adjuster_bean) should be changed to something like AdjusterBean
    If you want to become a good Java programmer then standards are essential. But, again, it is totally up to you to follow.

  • Problem with access to SipFactory from jsp-pages in JBoss environment

    Hello!
    I have an installation of the OCMS 10.1.3.3. deployed into a JBoss (jboss-4.0.5.GA) environment. Unfortunately I have a problem with accessing the SipFactory from a jps-page. Encouraged by the "messagesender" example I tried to get an instance of SipFactory from my jsp-page simply by calling:
    SipFactory sipFactory = (SipFactory) application.getAttribute(SipServlet.SIP_FACTORY);
    But unfortunately there seems to be no attribute "SipServlet.SIP_FACTORY" and I only get a null pointer. I have also tried running that code in the orignal messagesender example but it didn't work either. So I wonder if this should definetely work in a JBoss environment or if this might be a known problem. Is there anything that I could check/do regarding this problem? I suppose there must be an oracle module which should take care of making the SipFactory availabe after it is deployed. Perhaps something went wrong during the deployment?!
    Best regards,
    Tim

    Hi
    On JBoss, OCMS does not support converge applications.
    I.e the SipFactory can be retrieved from the servlet context when running on OC4J.
    Instead the SipFactory can be found in JNDI as described in the Developer's Guide:
    "External Access to SIP Servlets
    To enable convergent applications between SIP and HTTP, the OCMS Container allows you to get access to the javax.servlet.sip.SipFactory by looking it up through JNDI. The SIP Factory will be registered under the same name as the display name of your SIP servlet as illustrated in Example 2–12. The <display-name> in the sip.xml in this case must be "My sip app".
    Example 2–12 Accessing the Data for a SIP Session through JNDI
    InitialContext ic = new InitialContext();
    SipFactory sipFactory = (SipFactory)ic.lookup("sip/My sip app");"
    Cheers
    Lucas Persson

  • Accessing Translets in a JSP Page

    Hi,
    I have a Translet[already compiled XSL file] named "pr.class" and I have a XML file named "pr.xml".
    I want to transform the pr.xml to a HTML format using pr.class in a JSP page.But I am getting some errors.My code goes like this,
    xml file="d:/translets/pr.xml"
    class file="d:/translets/pr.class"
    <%@ page
    import="javax.xml.parsers.*,
    org.w3c.dom.*,
    javax.xml.transform.*,
    javax.xml.transform.stream.*,
    java.io.*,
    java.io.OutputStreamWriter,
    javax.xml.transform.Transformer,
    javax.xml.transform.TransformerFactory,
    javax.xml.transform.stream.StreamResult,
    javax.xml.transform.stream.StreamSource,
    javax.xml.transform.Templates;" %>
    <% System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
    TransformerFactory tFactory = TransformerFactory.newInstance();%>
    try {
    StreamSource xsl = new StreamSource(new FileInputStream("D:/translets/pr.class"));
    StreamSource xml = new StreamSource(new FileInputStream( "D:/translets/pr.xml"));
    StreamResult htm = new StreamResult(new FileOutputStream( "D:/birds.htm"));
    Transformer transformer =tFactory.newTransformer(xsl);
    transformer.transform(xml,htm);}
    catch(Exception e){out.println("Compilation problem");}
    %>
    My catch block is getting executed and giving the output as "Compilation problem".
    Give me a solution.Very Urgent!!.

    You are missing <% before try :-
      <%@ page
    import="javax.xml.parsers.*,
    org.w3c.dom.*,
    javax.xml.transform.*,
    javax.xml.transform.stream.*,
    java.io.*,
    java.io.OutputStreamWriter,
    javax.xml.transform.Transformer,
    javax.xml.transform.TransformerFactory,
    javax.xml.transform.stream.StreamResult,
    javax.xml.transform.stream.StreamSource,
    javax.xml.transform.Templates;" %>
    <% System.setProperty("javax.xml.transform.TransformerFactory","org.apache.xalan.xsltc.trax.TransformerFactoryImpl");
    TransformerFactory tFactory = TransformerFactory.newInstance();%>
    <%
    try {
    StreamSource xsl = new StreamSource(new FileInputStream("D:/translets/pr.class"));
    StreamSource xml = new StreamSource(new FileInputStream( "D:/translets/pr.xml"));
    StreamResult htm = new StreamResult(new FileOutputStream( "D:/birds.htm"));
    Transformer transformer =tFactory.newTransformer(xsl);
    transformer.transform(xml,htm);}
    catch(Exception e){out.println("Compilation problem");}
    %>

  • How to access class method in jsp page

    hi ,
    I am new to JSP . I want to access a method returning an arraylist
    of a class.
    this class i saved in WEB-INF>classes folder > where other classes like logonform , etc. are saved ....
    import stmt is <%@ page import="java.io.*, java.util.*, readXml " %>
    <% readXml rd= new readXml();
    Arraylist list=rd.parseDoc();
    %>
    It is not recognizing readXml class......
    Can any body help me in this regard......
    plz help .... i m in urgent need
    thanks in advance.......

    better to put class in a pkg inside webinf> classes folder ...
    but in my case constructor was not public......
    public readXml(){}
    now it works fine...... :)

  • Errors while instantiated a custom java object within jsp pages.

    I'm currently trying to role out a war file created on JavaBeans IDE 3.5.1. I have custom created classes
    that are instantiated by using:
    used.TransactionsHolder p_transactions = (used.TransactionsHolder) session.getAttribute("s_transactions");
    Where used is the package and TransactionsHolder
    is the class I am trying to create an object from. When
    I use this syntax I receive this error:
    __transactionPage.java:90: cannot resolve symbol
    symbol  : class TransactionsHolder 
    location: package used
                    used.TransactionsHolder p_transactions = (used.TransactionsHolder) session.getAttribute("s_transactions"); //[ transactionPage.jsp; Line: 12]
    ;Any suggestions?

    Can you please log a TAR with Oracle Support using Metalink to resolve this issue. They can help you collect all the log and trace files to determine the why this problem is occuring.
    Business Intelligence Beans Product Management Team
    Oracle Corporation

  • How to access servlet objects from OA page controller class

    Hi everybody!
    I need to put some value into servlet attribute in OA page controller class to read it from ordinary servlet later.
    How can i do it? Is it possible to get HttpServletRequest and HttpServletResponse objects from page controller?
    Thank you.

    I have a servlet which receives uploaded files with special attributes (something like tags for file) using POST request.
    This attributes created when user open page in standard OAF page via page controller.
    On client side I have an applet which uploads user selected file to my servlet and passes this file attributes.
    Now this attributes passes as plain text. I want to encrypt this attributes to hide attribute details from user. To do this I need to share some information between OAF page and my servlet.
    I know that OAF supports URL encryption, but to decrypt it I should use standard pageContext object.
    But in ordinary servlet I can't use it.

  • Calling a method in BPM Object from jsp page

    hi all,
    I try to call a method from BPM Object using <f:invokeUrl >
    I change server side method properties to yes.
    and then how can i get request and response object inside the BPM method.
    Thanks.

    Thanks for ur response,
    But i mention about BPM method inside BPM Object.
    i found this inside the documentation.
    methodName(Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response)
    i need to match above BPM method and <f:invokeUrl > tag. am i right?
    But i don't know how to create method with argument "Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response" inside BPM Object.
    I can't find any place to define method argument inside Oracle BPM studio.
    I don't know how to parse argument like "Fuego.Net.HttpRequest request, Fuego.Net.HttpResponse response"
    With Regards,
    Wai Phyo
    Edited by: user8729650 on Sep 9, 2009 7:03 PM
    Edited by: user8729650 on Sep 9, 2009 9:20 PM

Maybe you are looking for

  • File not showing in SharePoint (IE) but visible in Explorer

    I have a document library that has a single file not showing up that I can't seem to track down.  I am hoping someone here might be able to offer something I haven't thought of.  The document library is very much 'stock'.  Verisioning is turned on an

  • Acrobat XI Pro, Surface Pro 128,  Scan to PDF not working

    I just installed the trial version of Acrobat XI onto my Surface Pro and everything works except the Scan to PDF, when I hit any of the presets I get an error message that says: Box Title: Twain Data Source  Text In box: " Program was unable to load

  • DRAG AND DROP, OR MOVE MAIL TO NEW SMART MAIL?

    HI, I DO NOT SEEM TO BE ABLE TO DRAG AND DROP OR MOVE OLD MAIL INTO NEW SMART LOCATIONS? CYFROMAYO

  • When I go in tools - options I can't open the panel "advanced", it's unactive, what's wrong?

    I have a problem with firefox because a message or error appears when I want to load certains pages: "protocol ssl is desactived". When I went to the forum I found a procedure to check the parameters of mozilla, and I had to check in tools-options-ad

  • Color Temperature

    At my work station I have both a ThinkVision L194W (LI3.6) and a ThinkVision L197W (v0.02).  However, it appears the white temperature for these two monitors has been set differently - the L197W has a significantly bluer tone than the L194W, and it's