C:import and web.xml

Im using <c:import url="http://path_to_html" />. I want to put this value in the web.xml using context param. The problem is I don't know how my c:import tag will refer to that context param inside web.xml. Can anyone give a solution? Thanks.

web.xml
  <context-param>
    <param-name>abc</param-name>
    <param-value>http://path_to_html</param-value>
  </context-param>
JSP
<c:import url="<%= application.getInitParameter("abc") %>"></c:import>More info for c:import
http://www.onjava.com/pub/a/pub/a/onjava/2002/05/08/jstl.html?page=2
    * Absolute URL: <c:import url="http://sample.com/Welcome.html"/>
    * Relative URL (to the current context): <c:import url="/copyright.html"/>
    * Relative URL with a foreign context: <c:import url="/myLogo.html" context="/common"/>
    * FTP resource: <c:import url="ftp://ftp.sample.com/myFile"/>

Similar Messages

  • Changing the directory Structure of Jsp and web.xml files

    Hi,
    I am using the JDeveloper 11g preview. Can any one tell me how to change the Jsp and web.xml files ( not in WEB-INF directory of the application) to another directory.
    Thanks in Advance
    Gopal

    Hi Frank,
    Is it possible for me to change the folder structure which JDeveloper is providing for web project?
    By default JDeveloper is giving the following folder structure.
    In the project's root folder there is a public_html and src folder along with .jpr file.
    In public_html folder thre is an WEB-INF folder and a jsp file
    In WEB-INF folder there is an classes folder along with web.xml file.
    I need to have the following folder structure :
    The WEB-INF folder should be in root folder of project not in public_html folder
    src folder must be in WEB-INF folder.
    Thanks in Advance
    Anil Golla

  • Weblogic 10 jaas and login.jsp and web.xml/weblogic.xml security constaints

    Hello,
    I struggled through and got the examples.security.jaas.SampleCallbackHandler.java and examples.common.utils.ExampleUtils.java/ExampleConstants.java into eclipse where they compile. A bean I made can call SambleCallbackHandler like such:
    mybean.logmein(username,password,url). I can then do a mybean.getStatus() or even a mybean.returnCode(). It does seem to correctly identlify that it is authenticating me (I see in stdout logs that it shows success or failures. The problem I have is I do not know how to apply this weblogic and web.xml/weblogic.xml so that if authentication works it redirects me to the page requiring the authentication. In web.xml I have the following set up:
    <security-role>
         <role-name>Admins</role-name>
    </security-role>
    <login-config>
         <auth-method>FORM</auth-method>
         <realm-name>default</realm-name>
         <form-login-config>
              <form-login-page>/login.jsp</form-login-page>
              <form-error-page>/badlogin.html</form-error-page>
         </form-login-config>
    </login-config>
    <security-constraint>
         <web-resource-collection>
              <web-resource-name>empower</web-resource-name>
              <description>These pages are only accessible by authorized users.</description>
              <url-pattern>/admin/*</url-pattern>
              <http-method>GET</http-method>
              <http-method>POST</http-method>
         </web-resource-collection>
    <auth-constraint>
    <description>These are the roles who have access</description>
    <role-name>Administrators</role-name>
    </auth-constraint>
         <user-data-constraint>
         <description>This is how the user data must be transmitted</description>
         <transport-guarantee>NONE</transport-guarantee>
         </user-data-constraint>
    </security-constraint>
    My weblogic.xml has:
    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wls="http://www.bea.com/ns/weblogic/90" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
    <wls:security-role-assignment>
    <wls:role-name>Admins</wls:role-name>
    <wls:principal-name>Administrators</wls:principal-name>
    <wls:principal-name>dashap</wls:principal-name>
    </wls:security-role-assignment>
    </wls:weblogic-web-app>
    With this set up, if I try to go to a page in /admin folder in my application, it correctly pops up the login page. The jaas in the bean is doing a loginContext.login(), which I thought does authentication too, but it never goes back to the /admin page I was going to that needed the authentication. With jaas, can I not use the web.xml FORM security option? Do I Need to use j_security in the login.jsp's form's action= option and j_username and j_password for the input type names? How do I use j_username/j_password things if I am using jaas? I could just ignore using the web.xml security stuff and put something in the pages that need authentication, but it would be easier if I could use jaas with the security featurs without doing all that. Note that my code above is using a realm called default just because that was what was in the example I got from the web. Does that need to be something else?

    Hi John,
    I would like magic of course. However, in this case I want something special: my authentication provider uses special means and contents of headers, cookies and service from external identity management systems to determine the user's identity.
    I do not want the application to present the login dialog! I want to derive the identity and the fact that the user is logged in from whatever the authentication provider returns in terms of Subject.
    Ideally, the flow is something like:
    - user accesses an unprotected resource - resource is shown, no interaction with authentication provider
    - user presses a link or button that takes him/her to a protected resource
    - the authentication provider is contacted to work with the identity asserter to establish the identity of the current user and create a subject object for this user
    - the application can access the subject and principals
    - ADF Security recognizes the identity and the roles (based on the principals) and coordinates access based on this.
    the authentication method is client certificate. presumably this prompts WebLogic/OPS to use an identity asserter to work with custom headers and cookies ("... when you configure a web application to use CLIENT-CERT authentication. In this case, WebLogic can perform identity assertion based on values from request headers and cookies. If the header name or cookie name matches the active token type for the provider, the value is passed to the provider."). No login form should be presented to the user, as all information required to perform the authentication is already available.
    I am trying to understand what I must do to have the ADF application adopt the subject set by the authentication provider - if anything?!
    If you more ideas to share - I would love to hear them.
    best regards,
    Lucas

  • Unable To lookup .... weblogic.jobscheduler  and  web-xml resource ref

    Unable To lookup .... weblogic.jobscheduler and web-xml resource ref for timer manager
    JNDI NameNotFound Exception ....
    Do, i need to configure something get that working.
    Didn't find any thing on documentation or hosted examples.

    The default timermanager can be refered to as follows:
    <resource-ref>
        <res-ref-name>tm/default</res-ref-name>
        <res-type>commonj.timers.TimerManager</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>http://middlewaremagic.com/weblogic/?p=5569

  • Need server.xml and web.xml for connection pooling

    hi guys,
    I am having lots of problem implementing the Connection Pool. I want to use the Tomcat's Connection pool classes and not my connection pool.
    I have gone through lots of problem trying to configure it.
    I got the range of errors. Has someone worked on this. Does it work with Tomcat 4.1 and Oracle 8i. Can anyone provide any links or previous posts to help me out.
    If someone can paste their working server.xml and web.xml then that would be really grt.
    Any kind of help would be really helpful.
    Amit

    Tomcat does not have a connection pooling mechanism. I've used Apache Commons DBCP with Tomcat although with PostgreSQL. It works great.
    Nothing in my web.xml gets modified. Only server.xml needs to be updated for DBCP. The Tomcat JNDI Datasource documentation is very good and should get you through.

  • How to Modify Server.xml and web.xml inTomcat

    Hii
    i am very new to tomcat..and using servlets..so plx tell me hw i can modify the server.xml and web.xml....
    if my installables are in c:\program files\apache group\tomcat4.1
    ok...i have my servlets file in c:\program files\apache group\tomcat4.1\webapps\ap1\WEB-INF\classes..so plz advice me on modifying the server.xml and web.xml....also tell me how and what we do in mapping
    Plz tell me soon...
    thanking u in advance.
    rahul
    Take care.:)

    for web.xml you need something like this, i took this from the web.xml under the examples directory in tomcat:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>
    servletToJsp
    </servlet-name>
    <servlet-class>
    servletToJsp
    </servlet-class>
    </servlet>
    <servlet>
    <servlet-name>
    CompressionFilterTestServlet
    </servlet-name>
    <servlet-class>
    compressionFilters.CompressionFilterTestServlet
    </servlet-class>
    </servlet>
    </web-app>
    basically you need to map the servlet with a class, for servlet-name call it whatever you like, you'll be using this name in the url to access you servlet, for the class give it the name of the class, java complied class, that's it.
    server.xml is used to configure tomcat.

  • (newbie) Question about replacing .class files and web.xml file

    I'm new to servlets and I have two quick questions...
    Do I absolutely need a web.xml file to define all my servlets, or can I simply place .class files into the WEB-INF directory and expect them to run?
    If my application server (for example Tomcat) is running and I replace a servlet .class file, do I need to restart the server for the new .class file to take effect?
    ...or are both of these questions specific to the application server I'm using?

    Hi,
    From an article I read:
    With Tomcat 3.x, by default servlet container was set up to allow invoking a servet through a common mapping under the /servlet/ directory.
    A servlet could be accessed by simply using an url like this one:
    http://[domain]:[port]/[context]/servlet/[servlet full qualified name].
    The mapping was set inside the web application descriptor (web.xml), located under $TOMCAT_HOME/conf.
    With Tomcat 4.x the Jakarta developers have decided to stop allowing this by default. The <servlet-mapping> tag that sets this mapping up, has been commented inside the default web application descriptor (web.xml), located under $CATALINA_HOME/conf:
    <!-- The mapping for the invoker servlet -->
    <!--
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
    </servlet-mapping>
    -->
    A developer can simply map all the servlet inside the web application descriptor of its own web application (that is highly suggested), or simply uncomment that mapping (that is highly discouraged).
    It is important to notice that the /servlet/ isn't part of Servlet 2.3 specifications so there are no guarantee that the container will support that. So, if the developer decides to uncomment that mapping, the application will loose portabiliy.
    And declangallagher, I will use caution in future :-)

  • Web application and web.xml

    i have a web application consisting of 1 servlet and 5 jsps.
    the start point would be index.jsp
    i use firmwide login page. after login, i want the browser to display index.jsp page.
    In web.xml, i have defined -
    <welcome-file-list>          <welcome-file>/jsp/index.jsp</welcome-file>     </welcome-file-list>       <servlet>        <servlet-name>UtilitiesServlet</servlet-name>        <servlet-class>com.gs.fw.sox404.utilities.UtilitiesServlet</servlet-class>             <init-param>             <param-name>util-log4j-init-file</param-name>             <param-value>/WEB-INF/classes/util_log4j.properties</param-value>          </init-param>        <load-on-startup>1</load-on-startup>    </servlet>     <servlet-mapping>        <servlet-name>UtilitiesServlet</servlet-name>        <url-pattern>/UtilitiesServlet</url-pattern>    </servlet-mapping>if i define it as just index.jsp in the welcome file list, after successful login, it displays the dir structure of the web app.
    if i define it as jsp/index.jsp, then in some of the pages, it tries to find the servlet inside jsp folder.
    What would be the best way to get around this?

    Well, yes, it's not able to find it because you've not understood the mechanism of how it works clearly. You have to put your welcome file under every directory you want it to be used from. Like I said, it's not a path, it's a filename. So if the container sees that your request URL is for a directory, it'll look for the welcome files from the welcome file list, one by one, in the order of declaration. Whichever one it finds first, it'll serve that. If it doesn't find any, then it'll either give a 404 or a directory listing depending on the server and it's settings.
    So your problem is that you've put your index.jsp in your JSP folder but expect it to be served for all URLs. That won't happen, you'll have to put one file named index.jsp into every directory. The reasoning is pretty simple, what if you want different behaviour for each folder?
    This should fix your problem :)
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • Problem with the data source and web.xml

    I have an issue where JSC is removing my resource reference:
    <resource-ref>
    <description>Creator generated DataSource Reference</description>
    <res-ref-name>jdbc/localOracleDatabase</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    from the web.xml and sun-web.xml.
    The application has been working great in the IDE for months then wham, no more data source definition. I try and add the reference manually and the IDE takes it out. I am "NOT" adding it to the .xml's in the build area. Why is JSC removing the data source entry?

    This continues to be a problem. The only way that I can get around the problem is to drag a table from the data source onto the design pallete and then the datasource is added back to the web.xml. I can run fine for 10 or 15 runs then the entry is once again removed from the web.xml.
    Help please!

  • J_security_check and web.xml

    Hi,
    I've set up a web application with form authentication
    Here's part of my web.xml:
    <security-role>
       <description>user</description>
       <role-name>user</role-name>
    </security-role>
      <!-- Login Authentication -->
      <security-constraint>
        <display-name>Secure User Pages</display-name>
        <web-resource-collection>
          <web-resource-name>SecureUserPages</web-resource-name>
          <url-pattern>/jsp/welcome.jsp</url-pattern>
        </web-resource-collection>
        <auth-constraint>
             <description>user</description>
             <role-name>user</role-name>
        </auth-constraint>
      </security-constraint>
      <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
          <form-login-page>/jsp/login.jsp</form-login-page>
          <form-error-page>/jsp/loginError.jsp</form-error-page>
        </form-login-config>
      </login-config>When I request welcome.jsp, I'm taken to login.jsp.
    If I enter an incorrect login/password combo, the contents of loginError.jsp show up, but the url says http://hostname:port/appname/jsp/j_security_check
    How can I make it so that the url does not show 'j_security_check', but 'loginError.jsp'?
    Second, if I enter a correct login/password combo, I am not taken to the page I requested - I stay on the login page, but the information in the form fields gets wiped out. According to my logs, it says that I logged in correctly.
    Can someone shed some light on these one or both of these issues?
    Thanks in advance,
    C

    To answer you,
    1. j_security_check servlet forwards the request to loginError.jsp on login failure. Hence you don't see any change in URL at the address bar. Use redirect at your application level to see the change in URL at the address bar.
    If you want to attain some more flexibility at the login level, probably JAAS can help you out.
    2. _"Second, if I enter a correct login/password combo, I am not taken to the page I requested - I stay on the login page, but the information in the form fields gets wiped out. According to my logs, it says that I logged in correctly"_
    If you're really sure about correctness of your log, i think, you have directly invoked login.jsp from your browser and then you must have entered a valid username/password.May be this is the reason you get to see login.jsp again on successful login.
    Solution, would be to directly invoke welcome.jsp from browser.Provide valid username and password and then see whether you really get to see welcome.jsp or not?

  • Import and export xml file in Oracle

    Hi Gurus,
    Can any one explain , how can we Import and export an XML file in Oracle Please
    Thanks

    Some examples can be found on this {thread:id=410714} forum and also on [Marco&apos;s blog|http://www.liberidu.com/blog/] (He's an Oracle Ace in the {forum:id=34} forum)

  • Servicegen and web.xml

    I want to implement Basic Authentication for the webservice.
    My problem is servicegen creates the web.xml file. How do I replace the web.xml file created by servicegen with the one created by me.
    Is there any attribute like warfile in servicegen
    Thanks in advance

    Hi Matt,
    You can unzip the ear and then unzip the war produced by servicegen. Then replace the deployement descriptors with your own files and re-zip the whole thing.
    Emmanuel.

  • Eclipse, WTP, Servlets and Web.xml

    I wonder if you could help me.
    I am using Eclipse and Web Tools Platform.
    In eclipse, when I create a Servlet, I believe the servlet details (such as name, class, url-pattern) should be included into web.xml file automatically. However, this is not happening.
    Would you know how I can configure Eclipse and WTP to automatically write Servlets details into web.xml files.
    Thanls

    Thanks for the reply
    I have Eclipse 3.2 and WTP 1.5
    Yes, I am creating my Servlet in a project under the Dynamic Web Projects.
    I deploy my WAR file using the 'Export' menu.
    Now, I have manually added the servlet details into the web.xml file:
    <servlet>
    <servlet-name>HelloWorld</servlet-name>
    <servlet-class>com.mycom.HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorld</servlet-name>
    <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>
    I am accessing the servlet as:
    http://localhost:9090/MyFirstServlet/HelloWorld
    But I still get HTTP 404 error when accessign HelloWorld servlet. I am not sure what I am missing.
    Thanks

  • SessionListener and web.xml help

    Hello everyone.
    I'm having trouble getting a sessionListener to work in a tomcat3.1 environment.
    Everything works okay in my win2k developer setup.
    Here's the web.xml file I am using:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    <web-app>
    <display-name>slp</display-name>
    <description> sessionlistener problem </description>
    <listener>
    <listener-class>headrunner.listeners.HRSessionListener</listener-class>
    </listener>
    <context-param>
    <param-name>test value</param-name>
    <param-value>hello</param-value>
    </context-param>
    <context-param>
    <param-name>test value2</param-name>
    <param-value>hello</param-value>
    </context-param>
    <servlet>
    <servlet-name>hr/servlet-name>
    <display-name>hr</display-name>
    <servlet-class>hr</servlet-class>
    </servlet>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    </web-app>
    Could it be that the sessionlistener is inside a package?, or the order of the components in the web.xml ?
    Has anyone got a working web.xml file with the setup of a session-listener?
    Thanks in advance for any feedback

    The SessionListener interface is part of the 2.3 Servlet API. I may be wrong, but I believe Tomcat 4+ is required to run the 2.3 API.

  • Importing and Searching XML Text

    I am new to Flash programming, but have done some work in
    PHP, ASP and Frontier. I am trying to build a Flash file that
    imports an XML price list and then allows the user to input a
    four-digit part number. When a button is clicked, I'd return from
    that XML list the items that match the input along with their
    prices. The XML file would look something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <prodlist>
    <item>
    <id>1001121</id>
    <prod>7558-02</prod>
    <um></um>
    <price>10.56</price>
    <index>Y</index>
    </item>
    <item>
    <id>1001181</id>
    <prod>7557-02</prod>
    <um></um>
    <price>18.49</price>
    <index>Y</index>
    </item>
    <item>
    <id>1001191</id>
    <prod>7557-04</prod>
    <um></um>
    <price>20.69</price>
    <index>Y</index>
    </item>
    </prodlist>
    Naturally, I'd have to parse the six-digit part numbers down
    to four, and I think I can figure that one out.
    I have been able to read in the XML file, but can't figure
    out how to access it via a button click and return the
    searched-upon items. I know this may be a bit of a broad request,
    but I was hoping someone might at least point me in a direction so
    I can figure this out. I also can't seem to figure out how to tie
    an external .AS file to a particular .FLA file.
    Flash 3.0 seems really cool and robust, but boy, for a newbie
    like me there is quite the learning curve!

    Ok, playing around with this, but it appears that the only
    item being returned to the text field is the LAST one in the XML
    file. So, when I do a search for 7557, although it DOES run through
    the loop twice, only part #7557-04 is being written to the text
    field. And if I do a search on 7558 (the first part in the XML), I
    get the "part not found message". So I'm guessing that for some
    reason the script is only addressing the last XML item being
    searched. Here's my code:
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("test.xml"));
    function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    ParseBooks(xmlData);
    function ParseBooks(bookInput:XML):void {
    var prodList:XMLList = bookInput.item;
    for (var i:int = 0; i < prodList.length(); i++) {
    var prodItem = bookInput.item.prod.text()
    var priceItem = bookInput.item.price.text();
    var hyphenPos = prodItem.indexOf("-");
    var finalProd = prodItem.slice(0,hyphenPos);
    var inputfield = new TextField( );
    inputfield.text = "";
    inputfield.width = 150;
    inputfield.height = 30;
    inputfield.border = true;
    inputfield.background = true;
    inputfield.type = TextFieldType.INPUT;
    addChild(inputfield);
    var t:TextField = new TextField( );
    t.background = true;
    t.backgroundColor = 0xCCCCCC;
    t.border = true;
    t.borderColor = 0x333333;
    t.autoSize = TextFieldAutoSize.LEFT;
    t.wordWrap = true;
    t.y=200;
    addChild(t);
    function makeCircle():Sprite {
    var circle:Sprite = new Sprite();
    circle.name = name;
    circle.graphics.lineStyle(0);
    circle.graphics.beginFill(0xFF8080);
    circle.graphics.drawCircle(50, 50, 50);
    return circle;
    var circle:Sprite = makeCircle();
    circle.x=100;
    circle.y=100;
    addChild(circle);
    circle.addEventListener(MouseEvent.MOUSE_DOWN, click);
    function click(e) {
    for (var obj in xmlData.children()) {
    var prodItem = xmlData.children()[obj].prod.text()
    var hyphenPos = prodItem.indexOf("-");
    var finalProd = prodItem.slice(0,hyphenPos);
    if (finalProd==inputfield.text) {
    t.text=xmlData.children()[obj].prod.text()+"\n"
    +"\n"+xmlData.children()[obj].price.text();
    } else {
    t.text="The part you searched for was not found";
    }

Maybe you are looking for