How to use extends attribute in jsp page directive

Can anybody tell how to extend a existing .jsp file from another .jsp file. I have tried but it gives error.
I have used Extends attribute of page directive as below:
<%@ page extends = "MyAnotherJsp.jsp"%>
I also tried : <%@ page extends = "MyAnotherJsp"%>
I am using Tomcat as a web server
Also tell where to put those files.
Thanks.

Hi I am using Netbeans 5.5, Sun Java System Application Server 9.
ABC.java
package javapackage;
public class ABC{
public String show(){
return "Sandip Gaikwad";
index.jsp
<%@ page extends="javapackage.ABC" %>
<html>
<head>
<title>JSP Page</title>
</head>
<body>
<h1>JSP Page </h1>
</body>
</html>
Above code throws following exception at runtime:-
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] F:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\Page_Extends_Attribute_Example\org\apache\jsp\index_jsp.java:36: getPageContext(javax.servlet.Servlet,javax.servlet.ServletRequest,javax.servlet.ServletResponse,java.lang.String,boolean,int,boolean) in javax.servlet.jsp.JspFactory cannot be applied to (org.apache.jsp.index_jsp,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,,boolean,int,boolean)
[javac] pageContext = _jspxFactory.getPageContext(this, request, response,
[javac] ^
[javac] 1 error
Server log
StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
[javac] F:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-modules\Page_Extends_Attribute_Example\org\apache\jsp\index_jsp.java:36: getPageContext(javax.servlet.Servlet,javax.servlet.ServletRequest,javax.servlet.ServletResponse,java.lang.String,boolean,int,boolean) in javax.servlet.jsp.JspFactory cannot be applied to (org.apache.jsp.index_jsp,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,<nulltype>,boolean,int,boolean)
[javac] pageContext = _jspxFactory.getPageContext(this, request, response,
[javac] ^
[javac] 1 error
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:94)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:384)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:461)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:528)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:507)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:495)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:530)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
If I delete the line <%@ extends="javapackage.ABC"%> it works fine. Please tell me what is wrong with this line.

Similar Messages

  • Oepe-12.1.2.1-kepler how to use ADF Templates in JSP page

    Hi all,
        I use oepe 12.1.2.1 kepler 4.3 and creating JSP page but I can't see any ADF Rich Faces Page in JSP Templates Page of Preferences Dialog. How to use ADF Templates in JSP page?
    Thanks,
    Thomas

    Select the JSP Templates link. Is the ADF Rich Faces Page template listed? Refer Creating the Login Page/4.
    Introduction to the Oracle Enterprise Pack for Eclipse (OEPE) IDE

  • How to use Session scope in jsp page

    Hello, I have login form, where user provides username and password. Then click on submit, it will forward to validation.jsp. Where it will check in database make sure username and password exit. Now i can also retrive accountid of perticular user. I want to put that username and accountid in session scope. so all other pages can use that username and accountid. How can i do that. I'm new at this, so please provide me example too. Here is my code for login.jsp and validation.jsp..
    Validation.jsp
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    //String name = request.getParameter( "username" );//
    //session.setAttribute( "accountID",accountID );//
    <%
    String connURL = "jdbc:oracle:thin:@orca.csc.ncsu.edu:1521:ORCL";
         Connection conn = null;
         Statement stmt = null;
         ResultSet rs = null;
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    conn = DriverManager.getConnection(connURL, "vapatel","pjdas");
    stmt = conn.createStatement();
    String user=request.getParameter("userName");
    String password=request.getParameter("password");
    boolean entrance=false;
    stmt.excuteQuery("SELECT AccountID From Password WHERE USERNAME='"+user+"'");
    rs = stmt.executeQuery("SELECT * FROM Password WHERE USERNAME='"+user+"' AND PASSWORD='"+password+"'");
    while(rs.next()){
    String dbUser = rs.getString("USERNAME");
    String dbPassword= rs.getString("PASSWORD");
    if ((user.equals(dbUser)) && (password.equals(dbPassword))){
    entrance=true;
    if (entrance==true){%>
    <jsp:forward page="form.jsp"/>
    <%}
    else{%>
    <jsp:forward page="login.jsp"/>
    <%}
    %>

    hi,
    to put something into session scope in a jsp page use:
    session.setAttribute("counter", Integer.toString(5));to retrieve is from a jsp page use:
    String counterAttribute = (String)session.getAttribute("counter");

  • How to use messagebar tag in jsp page

    i am working with "messagebar" control presents in the htmlb controls.
    my aim is to display the message after pressing some button. how to give link for that.
    if anybody have smple code for it please send me with component,jsp page and bean(if used)......
    ragards,
    ajoy

    Hi,
    If I understood you right, then you want to update the message shown in your messgebar, when user clicks on button.
    To achieve this, have a MessageBar with no message text. And when ever a button is clicked in the event handling method of your button set message text to your messagebar.
    public void showMessage(String message, MessageType type) {
            messageBar.setMessage(type, message);
    public void onClick(Event event) throws PageException {
          showMessage("Clicked Button", MessageType.INFO);
    Greetings,
    Praveen Gudapati
    [Points are always welcome for helpful answers]

  • How to use List String in JSP page?

    Hello All,
    I am having problem using List<String> in my JSP page. Below is my JSP code.
    <%@ page import="java.util.*, java.io.*"%>
    <html>
    <body>
    <h1 align="center">Beer Recommendations JSP</h1>
    <p>
    <%
    List<String> beerBrands = (List<String>)request.getAttribute("styles");
    Iterator<String> it = beerBrands.iterator();
    while(it.hasNext()){
         out.print("<br>try: " + it.next());
    %>
    </body>
    </html>
    When I compile the above JSP code in Eclipse 3.4 (using JBoss 4.2 as my Application Server), I get the following Warning.
    Type safety: Unchecked cast from Enumeration to Enumeration<String>
    If I add the "@SuppressWarnings("unchecked")" to the code, Eclipse does not give any Error during compilation. But, at runtime, I get the following Error.
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 10 in the jsp file: /BeerAdvice.jsp
    Syntax error, annotations are only available if source level is 5.0
    7: <p>
    8:
    9: <%
    10: @SuppressWarnings("unchecked")
    11: List<String> beerBrands = (List<String>)request.getAttribute("styles");
    12: Iterator<String> it = beerBrands.iterator();
    13: while(it.hasNext()){
    An error occurred at line: 11 in the jsp file: /BeerAdvice.jsp
    The type List is not generic; it cannot be parameterized with arguments <String>
    8:
    9: <%
    10: @SuppressWarnings("unchecked")
    11: List<String> beerBrands = (List<String>)request.getAttribute("styles");
    12: Iterator<String> it = beerBrands.iterator();
    13: while(it.hasNext()){
    14:      out.print("<br>try: " + it.next());
    An error occurred at line: 11 in the jsp file: /BeerAdvice.jsp
    Syntax error, parameterized types are only available if source level is 5.0
    8:
    9: <%
    10: @SuppressWarnings("unchecked")
    11: List<String> beerBrands = (List<String>)request.getAttribute("styles");
    12: Iterator<String> it = beerBrands.iterator();
    13: while(it.hasNext()){
    14:      out.print("<br>try: " + it.next());
    Any help is very much appreciated.
    Thank you for your help.
    Thanks,
    Chubha

    Hi anotherAikman,
    Thank you for your help. I currently have the following version of the Java.
    {color:#800000}java version "1.6.0_17"
    Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
    Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
    {color:#000000}{color:#000000}Does it mean I have Java SE Version 6 Update 17 and you are suggesting me to download the Java EE Version 6?{color} If this is correct, can you please let me know what difference does it make?
    I am now going to install the Java EE 6 and try this out.
    Thank you for your help.{color}
    {color:#000000}Thanks,
    Chubha{color}
    {color}

  • How to use java class in jsp page of JSPProvider?

    Hello everybody.
    I created simple JSPProvider channel with portal amconsole and named it "jspprov1". Then I created "jspprov"1 directory under "/ets/opt/SUNWps/desktop/sampleportal". I put "index.jsp" in it. And it worked until I add this line into "index.jsp": <% @page import="jspprov1package.aclass1" %>. Then I created directory "jspprov1package" under "/ets/opt/SUNWps/desktop/classes" and put "aclass1.class" into it and into "/ets/opt/SUNWps/desktop/classes" itself. I created "aclass1.class" on the other machine (with no installed portal) in j2sdk1.4.1_02: "javac aclass1.java". The text of this class is simple:
    "package jspprov1package;
    public class aclass1{
    public int int_field = 10;
    But the page still don't work. It writes on the portal desktop "ERROR: Content is not available".
    Does anybody know why this happened?

    Sorry, there were mistakes in jsp page and java files.
    I maked the channel "show exceptions" and found them out.

  • How to use VO attribute in a page region in valueset of flex segment

    I have a seeded oracle page - having 2 regiions
    The first region shows basic employee information like job, position etc
    The second region shows a flexfield having 4 segments.
    My requirement is to restrict the value in first segment based on the employee's job.
    e.g If employee is of Job A-, Segment 1 shoows the values as A.B.C in the poplist
    if employee if of Job X, segment 1 has to show only values as AA, BB in the poplist
    how can i use the vo attribute as paramter to my segment 1 valueset?
    Thanks,
    Lal

    One way to achieve this is:
    1.Make sgement 1 to show A.B.C in the poplist.
    2.Create a new segment which shows AA, BB in the poplist. So now total no. of segments are 5.
    3. In the second region in the page display only first 4 segments. For displaying only required segments refer "DEscriptive Flex Fields" in Dev Guide.
    4. Create another region (3rd region) which displays segments 2 to 5. i.e. this does not show segment1
    5. Using PPR display required region based on the value in Job field.
    Note: this approach is suitable when you have very less no. of options in Job field to choose from.
    -Anand

  • How to use attachemnt fucntion in JSP page using Attachemnt functionality ?

    Hi all
    I would want to know is any body worked attachement functionality to add attachements in sshr functions.I would want to add one attchement to my SIT which i created in core HR .But i need to add attachements in SSHR for these SIT.Would appreciate if anybody can throw some light on these area.Your suggestions are greatly appreciated.
    Cheers
    Kumar

    Hi Kumar
    I don't think that the attahcment functionality in SSHR links in with the attachment functionality in core! The SSHR attachments are attached to the workflow records and are usually to give the approver some more information to help the approval process.
    SSHR attachments usually get set in the review page, and this may not always equate to a single form in core.
    So, I don't think you will be able to do what you are trying to do.
    Regards
    Tim

  • How can i extended attribute of user and add attribute to ldap

    how can i extended attribute of user and add attribute to ldap
    1.
    i use spe to modified "Default User Library":add Field like
    title:nation name:accounts[Lighthouse].nation
    2.
    modified "IDM Schema Configuration"
    add <IDMAttributeConfiguration name='nation' description='default attribute from UserExtendedAttributes/UserUIConfig' syntax='STRING'/>
    in <IDMAttributeConfigurations>
    and
    add <IDMObjectClassAttributeConfiguration name='nation' queryable='true' summary='true'/> in<IDMObjectClassConfiguration>
    there is extended attribute when i create new user
    3.
    i create new resource to ldap,and i add nation in "Account Attributes" tab
    but the new attribute not add to ldap
    i am beginner,how to extended attirbute add add to ldap attribute?

    So, if I want to fill in blanks on a form where I need to add more pages to fill history, what program do I need? In Adobe Reader, I can edit and fill in blanks, but I cannot duplicate more blank pages.

  • How to print new line in jsp page

    hi
    how to print new line in jsp page
    thanks

    \n - new line character is in java specific not HTML
    specific.Well, if the correct line separator sequence (by far not always \n) would be used, it does add a new line to the HTML output. Too bad that you don't want to see HTML but formatted text. The BR tag is a formatting element for the displayed text, not a line break in HTML. ;)

  • Urgent....How can i redirect to my jsp page from servlet in init() method..

    How can i redirect to my jsp page from servlet in init() method..Becoz that servlet is calling while server startsup..so im writing some piece of code in init() method..after that i want to redirect to some jsp page ...is it possible?
    using RequestDispatcher..its not possible..becoz
    RequestDispatcher rd = sc.getRequestDispatcher("goto.jsp");
    rd.foward(req,res);
    Here the request and response are null objects..
    So mi question can frame as how can i get request/response in servlet's init method()..

    Hi guys
    did any one get a solution for this issue. calling a jsp in the startup of the servlet, i mean in the startup servlet. I do have a same req like i need to call a JSP which does some data reterival and calculations and i am putting the results in the cache. so in the jsp there in no output of HTML. when i use the URLConnection i am getting a error as below.
    java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:707)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:705)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:519)
    at com.toysrus.fns.alphablox.Startup.callJSP(Unknown Source)
    at com.toysrus.fns.alphablox.Startup.init(Unknown Source)
    at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
    so plz do let me know how to call a jsp in the start up of a servlet.
    Thanks
    Vidya

  • How to enable the EL in jsp page

    hi can u tell 'how to enable the EL in jsp page'?

    *I am getting below exception in tomcat when i inclued +<%@ page isScriptingEnabled="true" isELEnabled="true"%>+*
    org.apache.jasper.JasperException: /index.jsp(1,1) Page directive has invalid attribute: isScriptingEnabled
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:198)
         org.apache.jasper.compiler.JspUtil.checkAttributes(JspUtil.java:311)
         org.apache.jasper.compiler.Validator$DirectiveVisitor.visit(Validator.java:106)
         org.apache.jasper.compiler.Node$PageDirective.accept(Node.java:590)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2388)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2394)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2338)
         org.apache.jasper.compiler.Validator.validate(Validator.java:1700)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:178)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:306)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

  • How to Hightlight the Data in Jsp Page

    How to Hightlight the Data in Jsp Page,
    I am doing doing search page,based on values given search page those are sent to servlet,in servlet based on some conditions if particuler id i am getting then i am redirecting to Respective jsp page with highlight the data from database..
    Thanks in advance...

    "Highlighting data in JSP sounds strange".
    Without looking at your search specific algorithms I feel you are finally going to display a page (HTML content) to user which contains highlighted text. Highlighting is not directly related to server side language you use (JSP, ASP, PHP etc.). This is purely HTML and CSS. However, server side script (such as JSP) should generate HTML content for getting highlight effect.
    Following HTML shows highlighted text using background-color property on span element.
    <html>
      <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
      <body>
          <p style="font-size:1.1em">This is a long paragraph which contains <span style="background-color: yellow;">highlighted text</span> and non highlighted text.</p>
      </body>
    </html>Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 14 Jun, 2010 3:30 AM

  • Using JavaBeans in a JSP Page

    I wan't to know the advantages and disadvantages of using JavaBeans in a JSP page.
    Like for example general traditional approach for a database connection
    is to create a connection and access the database from that and close the connection
    at the end of the page, instead of the If I use a common connection bean for making connections,
    is that suggestable and then when should i close the connection then.
    One good application of JavaBeans is using a Set and Get methods for form fields in
    a registration form to get back the values.
    So may i know how best can we use the JavaBeans other than this application.
    ThanX in advance,
    kiran
    [email protected]

    I believe putting processing and query code in the JavaBean was one of the reasons for putting JavaBeans support in JSP in the first place. The original idea was to use the setXXX methods to populate the bean's data from the posted form, then do the processing (or database query), then use the getXXX methods to display the bean's data.
    Efficiency-wise, it's exactly the same as putting all the code in-line in the JSP page (actually, it might be a bit slower, because of the reflection required to do it.) Code-wise though, it makes the JSP easier to read.
    Of course, we have EJBs now too, which tie very closely and can match database queries almost one-to-one, one way to incorporate these is inside the JavaBean you reference from the JSP, another way from a servlet you redirect the JSP to, etc...

  • How to use session object in jsp

    hi all
    marry christmas
    can anyone plz tell me how to use session obect in jsp
    rachna
    Message was edited by:
    rachna_arora82

    hi rachna,
    JSP has a default(implicit) session object...... use the getSession(true) method on the session object and then going u can either get or set attributes depending on the requirement
    That was in general and now with the issue u have got..... what u can do is that the u can create session for every user who logs in and when he/she tries to login again then u can probably check for the existing session object in the JSP and perform the logic as required..... any clarifications plzzzzzzz let me know
    Thanks n Regards
    Naveen M
    Message was edited by:
    Novice_inJAVA
    Message was edited by:
    Novice_inJAVA

Maybe you are looking for

  • How to get the field COMPLETION in extract layout

    Hi, Does anyone knows How to get the field COMPLETION in extract layout? i have not been able to find it and it is imperative to have it for implementing a new evaluation. Thanks a lot for your help. CAMILO URIBE

  • Cam Optia problem with aspect ratio.

    Hello, i bought a subject camera today. And when i try to chat with my friend through some online services, which capture image from cam with 76x44 resolition my friend see video picture with incorrect aspect ratio (stretched up and down). Also i hav

  • Can my macbook pro play blu-rays?

    Can my macbook pro play blu-rays without any extra equiptment purchased?

  • WindowServer keeps crashing

    Hi, WindowServer keeps crashing, the last log: Host Name: kether Date/Time: 2007-08-09 16:55:17.092 +0200 OS Version: 10.4.10 (Build 8R2218) Report Version: 4 Command: WindowServer Path: /System/Library/Frameworks/ApplicationServices.framework/Framew

  • Listening to Sirius Canada online sub with a plug in?

    Hi all, I have a Sirius sat radio, and as part of that, we can listen to sirius online too. Just tried to do that with the Mac today, and I get the following message: The page "SIRIUS Player - 100% Commercial-free Music" has content of MIME type "app