The J2EE Tutorial (Chap 15-Custom Tags in JSP pages

The definition class "DefinitionTag" talks about putting the definition instance of "Definition" class in a page context, using the following code
// put the definition in the page context
context.setAttribute(definitionName, definition,
context.APPLICATION_SCOPE);
Now in an application where the request dispatcher servlet is forwarding the request to this template.jsp. What is the impact when we are using the same application scope variable "definitionName = bank� for all the http request(s) (multi pages /multi users). I am interested to know whether this approach is scalable or will it create a performance bottleneck when the definition scope is application level. I will appreciate any feedbacks.
Regards,
Jayesh
MCSE, MSCD, SCJP, PMP, IBM WAS ADM

I got the solution for this.
Thanks
Newtojsp

Similar Messages

  • Error when compiling the J2ee tutorial source files on win2k professional

    Hi,
    Could you help me?
    I'm trying to complete the j2ee tutorial.
    I have downloaded the example code, J2EE Sdk, J2SE and Ant from the web site (these files� name are: j2ee-1_3-doc-tutorial-draft3.zip, j2sdkee-1_3_01-win.exe, j2sdk-1_3_1_01-win.exe, jakarta-ant-1.3-bin.zip) and installed the �j2sdkee-1_3_01-win.exe, j2sdk-1_3_1_01-win.exe� and unzipped �j2ee-1_3-doc-tutorial-draft3.zip, jakarta-ant-1.3-bin.zip� to their default subdirectory.( jdk1.3.1_01,
    j2sdkee1.3,jakarta-ant-1.3)
    According to instructions, I have set the Environment Variables as the below:
    ANT_HOME=c:\jakarta-ant-1.3
    CLASSPATH=c:\sybtools\ASEP\Monclass.zip;c:\sybtools\ASEP\3pclass.zip;c:\program files\microsoft sql server 2000 jdbc\lib\mssqlserver.jar;c:\program files\microsoft sql server 2000 jdbc\lib\msbase.jar;c:\program files\microsoft sql server 2000 jdbc\lib\msutil.jar;c:\orcle\ora81\jdbc\lib\classes12.zip; c:\orcle\ora81\jdbc\lib\nls_charset12.zip;c:\program files\oracle\jdevelop 3.2.3\jdbc\lib\oracle8.1.7\classes12.zip;c:\j2sdkee1.3\lib\j2ee.jar;c:\jdk1.3.1_01\lib\tools.jar;c:\jdk1.3.1_01\lib\classes.zip;c:\jakarta-ant-1.3\lib\ant.jar
    HOMEPATH=\
    J2EE_HOME=c:\j2sdkee1.3
    JAVA_HOME=c:\jdk1.3.1_01
    OS=Windows_NT
    Os2LibPath=C:\WINNT\system32\os2\dll;
    Path=C:\oracle\ora81\bin;C:\oracle\ora81\Apache\Perl\5.00503\bin\mswin32-x86;C:\Program Files\Oracle\jre\1.1.7\bin;C:\PROGRA~1\REFLEC~1;C:\Program Files\Reflection;C:\WINNT\SYSTEM32;C:\WINNT;C:\WINNT\SYSTEM32\WBEM;C:\DMI\WIN32\BIN;C:\Program Files\Symantec\pcAnywhere\;C:\MSSQL7\BINN;C:\Sybase\DLL;C:\Sybase\BIN;C:\sybtools\WIN32;C:\sybtools\ASEP;c:\oracle\ora81\jdbc\lib;c:\j2sdkee1.3\bin;c:\jdk1.3.1_01\bin;c:\jakarta-ant-1.3\bin
    SystemRoot=C:\WINNT
    windir=C:\WINNT

    After finishing the above actions, I have started the j2ee server and deploytools successfully. But when I executed the following command( ANT CONVERTER ) under the appointed subdirectory, the error occurred.
    The information is
    �Exception in thread �main� java.lang.NoClassDefFoundError: files\Microsoft �.
    Looking forward to the answer!
    Arthur Ward
    2001-12-21

    by the way, after checking the ant_home\bin\ant.bat(see bellow)
    -------end quote----
    @echo off
    if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
    if not "%OS%"=="Windows_NT" goto win9xStart
    :winNTStart
    @setlocal
    rem %~dp0 is name of current script under NT
    set DEFAULT_ANT_HOME=%~dp0
    rem : operator works similar to make : operator
    set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
    if %ANT_HOME%a==a set ANT_HOME=%DEFAULT_ANT_HOME%
    set DEFAULT_ANT_HOME=
    rem On NT/2K grab all arguments at once
    set ANT_CMD_LINE_ARGS=%*
    goto doneStart
    :win9xStart
    rem Slurp the command line arguments. This loop allows for an unlimited number of
    rem agruments (up to the command line limit, anyway).
    set ANT_CMD_LINE_ARGS=
    :setupArgs
    if %1a==a goto doneStart
    set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
    shift
    goto setupArgs
    :doneStart
    rem This label provides a place for the argument list loop to break out
    rem and for NT handling to skip to.
    rem find ANT_HOME
    if not "%ANT_HOME%"=="" goto checkJava
    rem check for ant in Program Files on system drive
    if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
    set ANT_HOME=%SystemDrive%\Program Files\ant
    goto checkJava
    :checkSystemDrive
    rem check for ant in root directory of system drive
    if not exist "%SystemDrive%\ant" goto noAntHome
    set ANT_HOME=%SystemDrive%\ant
    goto checkJava
    :noAntHome
    echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
    goto end
    :checkJava
    set _JAVACMD=%JAVACMD%
    set LOCALCLASSPATH=%CLASSPATH%
    for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
    if "%JAVA_HOME%" == "" goto noJavaHome
    if "%_JAVACMD%" == "" set JAVACMD=%JAVAHOME%\bin\java
    if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar"
    if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat"
    "%JAVA_HOME%\lib\classes.zip"
    goto checkJikes
    :noJavaHome
    if "%_JAVACMD%" == "" set _JAVACMD=java
    echo.
    echo Warning: JAVA_HOME environment variable is not set.
    echo If build fails because sun.* classes could not be found
    echo you will need to set the JAVA_HOME environment variable
    echo to the installation directory of java.
    echo.
    :checkJikes
    if not "%JIKESPATH%" == "" goto runAntWithJikes
    :runAnt
    %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS%
    org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
    goto end
    :runAntWithJikes
    %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH%
    %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
    :end
    set LOCALCLASSPATH=
    set _JAVACMD=
    set ANT_CMD_LINE_ARGS=
    if not "%OS%"=="Windows_NT" goto mainEnd
    :winNTend
    @endlocal
    -------end quote----
    i found something is wrong with the sentence in ":runAnt".
    --------quote-----
    %_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS%
    org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
    --------end quote-----
    No value was set for %ANT_OPTS% and %ANT_CMD_LINE_ARGS%

  • Error when compiling the J2ee tutorial source files

    HI,
    I have installed ant, j2ee tomcat-3.2.2 and jdk1.3 and when i tried to compile the source file downloaded from java.sun by
    ant converter, it prompted
    "Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/main"
    I am running it on win98 with the autoexec.bat containing the followings:
    set J2EE_HOME=c:\j2sdkee1.3
    set JAVA_HOME=c:\jdk1.3.1
    set ANT_HOME=c:\jakarta-ant-1.3
    set TOMCAT_HOME=c:\tomcat\jakarta-tomcat-3.2.2
    set classpath=;.;c:\jdk1.3.1\jre\lib\rt.jar;c:\j2sdkee1.3\lib\j2ee.jar;c:\jaxp\xalan.jar;c:\jaxp\crimson.jar;c:\jaxp\jaxp.jar;c:\C:\jakarta-ant-1.3\lib\ant.jar;C:\jakarta-ant-1.3\lib\jaxp.jar;C:\jakarta-ant-1.3\lib\parser.jar
    PATH=%PATH%;"C:\Program Files\Mts";C:\PROGRA~1\ULTRAE~1;c:\jdk1.3.1\bin;c:\j2sdkee1.3\bin;c:\jakarta-ant-1.3\bin;C:\PROGRA~1\MICROS~4\80\TOOLS\BINN
    Really thx for help !!!!

    Hi.
    I am compiling the sample converter.ear downloaded from
    the j2ee tutorial bundle form java.sun. I am using jakarta-ant-1.4alpha-bin.zip downloaded from jakarta
    oh..yes it should be org.apache.tools.ant.Main ....sorryfor typo.....
    look forward to any helpful reply

  • How to use custom tag in jsp

    sir
    plz tell me how to use custom tag in jsp.plz describe it.
    i will be thankful to u

    Do you want to use taglibs or develop custom tags? Either way take a look at these:
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags.html
    http://www.stardeveloper.com/articles/display.html?article=2001081301&page=1
    http://www.onjava.com/pub/a/onjava/2000/12/15/jsp_custom_tags.html
    http://jakarta.apache.org/taglibs/tutorial.html
    http://www.ibm.com/developerworks/edu/j-dw-java-custom-i.html
    http://www.herongyang.com/jsp/tag.html

  • The content type for office excel 2007 in jsp page and the mime-type in  we

    Hi,
    In my system MS Office 2007 is installed. I am trying to generating excel sheets from JSP page by setting the content type "application/vnd.ms-excel" in jsp page and as well as in web.xml file. I am getting the below message
    The file you are trying to open, 'xxxxxxxx.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
    Then finally the excel file is opening and displaying properly. If in my system MS Office 2003 is installed , then the above message is not coming.
    I have changed the content type according to Excel 2007 <%@ page contentType= "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" %> and in web.xml file the mime type to
    <mime-mapping>
    <extension>xlsx</extension>
    <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
    </mime-mapping>
    even the content type is changed according to office excel 2007 , i am getting the same above message.
    My client is asking not to display the above message. So how to prevent that message ?
    It's very great if any body reply me as soon as possible.

    Hi Akash,
    I am not using the POI. I am generating the excel sheet using the below code.
    <jsp:directive.page import="java.util.Map" />
    <jsp:directive.page import="lehman.ra.Report.ReportDefinition" />
    <jsp:directive.page import="lehman.ra.RAUtilBean" />
    <jsp:directive.page import="java.util.ArrayList" />
    <jsp:directive.page import="lehman.util.GeneralUtil" />
    <jsp:directive.page import="lehman.admin.report.AdminHtmlReportFormatter"/>
    <jsp:directive.page import="lehman.helper.irprod.IRProdHelper"/>
    <%@ page contentType= "application/vnd.ms-excel" %>
    <jsp:directive.page import="java.util.Iterator"/>
    <jsp:directive.page import="java.util.HashMap"/>
    <%
         String strTradeDate = (String) session.getAttribute("TradingDate");
         String sContextPath = request.getContextPath();
         IRProdHelper irHelper     = new IRProdHelper();
         String  sReportFormat  = "E2E";     
         String subtab1 = request.getParameter("subtab1");
         if (subtab1 == null)
              subtab1 ="";     
         Map report_Ids    = (Map) session.getAttribute("ADMIN_E2E_REPORTS");
         AdminHtmlReportFormatter formatter = new AdminHtmlReportFormatter();
         ArrayList contentData = new ArrayList();
         ArrayList headerData  = new ArrayList();
         ArrayList metaData    = new ArrayList();
         Map resultMap            = null;
         String headerString       = "";
         String contentString  = "";
         String reportId            = "";
         int titleSpan         = 5;     
         if( report_Ids!=null && report_Ids.size() > 0){
              Object oReportObj      = null;
              Iterator rowIter = report_Ids.keySet().iterator();
              RAUtilBean raUtilBean = new RAUtilBean();
              ReportDefinition rdef = new ReportDefinition();
              while ( rowIter.hasNext() ){          
                   oReportObj = rowIter.next();     
                   reportId = oReportObj.toString();
                   System.out.println("**************reportId="+reportId);     
                   resultMap  =  (HashMap) report_Ids.get(oReportObj);
                   if(resultMap == null )
                        continue;
                   if(resultMap.size() > 0 ) {
                        contentData          = (ArrayList)resultMap.get(GeneralUtil.CONTENT_DATA);
                        headerData          = (ArrayList)resultMap.get(GeneralUtil.COL_METADATA);
                        metaData          = (ArrayList)resultMap.get(GeneralUtil.METADATA);
                        rdef = new ReportDefinition();                    
                        raUtilBean.setReportAttributes(rdef, headerData, metaData,reportId, sReportFormat);
                        titleSpan = raUtilBean.findMaxCol(contentData, rdef.getDisplayCols());
                        if("51031".equals(reportId)){                         
                             if(resultMap.get("HIDE_ETA")!=null){
                                  boolean hideETA = ((Boolean)resultMap.get("HIDE_ETA")).booleanValue();                              
                                  formatter.setHideETA(hideETA);
                                  if(hideETA){
                                       titleSpan = titleSpan-1;
                        rdef.setMaxCol(titleSpan);
                        headerString = formatter.constructHeadingForE2E(rdef, headerData);
                        contentString = formatter.constructContentForE2E(rdef, contentData, strTradeDate, sReportFormat);
    %>     
    <html xmlns:o="urn:schemas-microsoft-com:office:office"
         xmlns:x="urn:schemas-microsoft-com:office:excel"
         xmlns="http://www.w3.org/TR/REC-html40">
         <head>
         <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
         <meta name="ProgId" content="Excel.Sheet"/>
         <meta name="Generator" content="Microsoft Excel 9"/>
         <link rel="File-List" href="./Test33_files/filelist.xml"/>
         <link rel="Edit-Time-Data" href="./Test33_files/editdata.mso"/>
         <link rel="OLE-Object-Data" href="./Test33_files/oledata.mso"/>
         <link href="<%=sContextPath %>/llehman.css" rel="stylesheet" type="text/css">
         <link href="<%=sContextPath %>/llcontent.css" rel="stylesheet" type="text/css">
         <style>
         <xsl:comment>
         table
              {mso-displayed-decimal-separator:"\.";
              mso-displayed-thousand-separator:"\,";}
         .style0
              {mso-number-format:General;
              text-align:general;
              vertical-align:bottom;
              white-space:nowrap;
              mso-rotate:0;
              mso-background-source:auto;
              mso-pattern:auto;
              color:windowtext;
              font-size:10.0pt;
              font-weight:400;
              font-style:normal;
              text-decoration:none;
              font-family:Arial;
              mso-generic-font-family:auto;
              mso-font-charset:0;
              border:none;
              mso-protection:locked visible;
              mso-style-name:Normal;
              mso-style-id:0;}
         .xl21
         {mso-style-parent:style0;
         color:black;
         font-size:8.0pt;
         font-family:Arial, sans-serif;
         mso-font-charset:0;
         border-top:.5pt solid silver;
         border-right:.5pt solid silver;
         border-bottom:.5pt solid silver;
         border-left:none;}
         .xl24
              {mso-style-parent:style0;
              mso-number-format:"\#\,\#\#0\.00_\)\;\\\(\#\,\#\#0\.00\\\)";}
         .xl25
              {mso-style-parent:style0;
              mso-number-format:0%;}
         .xl26
              {mso-style-parent:style0;
              mso-number-format:"\#\,\#\#0_\)\;\\\(\#\,\#\#0\\\)";}
         .xl27
         {mso-style-parent:style0;
         background-color:#666666;
         color:#FFFFFF;
         font-size:9.0pt;     
         font-family:Arial, sans-serif;
         mso-font-charset:0;
         text-align:left;
         vertical-align:middle;
         border-top:none;
         border-right:.5 pt solid silver;
         border-bottom:.5pt  silver;
         border-left:none;
         mso-pattern:auto none;
         white-space:normal;
         .xl55
         color:black;
         font-size:8.0pt;
         font-weight:700;
         mso-style-parent:style0;
         mso-number-format:"\#\,\#\#0_\)\;\[Red\]\\\(\#\,\#\#0\\\)";
         mso-pattern:auto none;
         font-size:9.0pt;
         font-family:Arial, sans-serif;
         mso-font-charset:0;
         text-align:right;
         border-top:none;
         border-right:.5pt solid silver;
         border-bottom:.5pt solid silver;
         border-left:none;
         .xlDate{
         mso-style-parent:style0;
         mso-number-format:"yyyy\\-mm\\-dd";
         .xlDateTime{
         mso-style-parent:style0;
         mso-number-format:"yyyy\\-mm\\-dd\\ h\\:mm\\ AM\/PM";
         </xsl:comment>
         </style>
         <xml>
          <x:ExcelWorkbook>
           <x:ExcelWorksheets>
            <x:ExcelWorksheet>
              <x:Name><%=subtab1%></x:Name>
              <x:WorksheetOptions>
               <x:ProtectContents>False</x:ProtectContents>
               <x:ProtectObjects>False</x:ProtectObjects>
               <x:ProtectScenarios>False</x:ProtectScenarios>
              </x:WorksheetOptions>
            </x:ExcelWorksheet>
           </x:ExcelWorksheets>
          </x:ExcelWorkbook>
          </xml>
         </head>
    <body text="#000000" style="margin-left:5px;margin-top:5px">
          <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tr>
                  <td>
                       <table  border='0' cellpadding="0"  cellspacing='0' width="100%">
                             <tr class="xl21">
                                  <td align="left" nowrap style='font-size:11px;' colspan="<%=titleSpan%>"><b><%=subtab1%></b> -  COB  <%=irHelper.formatDate(strTradeDate)%>  </td>
                                  </tr>
                         </table>
                   </td>
                </tr>
                <tr>
                     <td> </td>
              </tr>
    <!-- Report Processing -->
              <tr>
                   <td>
                        <%=headerString%>
                        <%=contentString%>
                   </td>
              </tr>
    <%
                   }//end of if
              }//end of while
         }//end of if report_Ids     
    %>          
         </table>
    </body>
    </html>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Urgent-how to access custom tag from jsp tag

    I have a problem accessing a custom tag from a jsp expression.
    Details: I have a custom tag that returns a string variable. I need to access that variable from jsp expression <%%>.
    Can any body help me?

    Tags don't "return" values as in the normal sense.
    They can only support TEI (Tag Extra Information) that just stuffs a declared variable into the page's state.
    For example, if the tag class had a public method called getValue(), you could do the following:
    <xmp:mytag id="foo"/>
    <%
    out.println("value is " + foo.getValue());
    %>

  • Passing params to custom tag from jsp

    Hi all, I have a problem passing params back to my custom tag. The tag handler has a "getPageNumber()" method which returns a value. Initially the value is set and if a link is clicked it passes that param to the tag handler. I am trying to get this value from the tag handler to update the value on the link parameter.
    Something like this:
    // processed tag
    <a href="mypage.jsp?page=1">Next page</a>
    // clicking "Next Page"
    <a href="mypage.jsp?page=2">Next page</a>
    // jsp
    <taglib:tag param="<%=getPageNumber()%>"  />
    // in tag lib
    private pagenumber=1;
                pagenumber++;
    getPageNumber(){
    return pagenumber;
    setPageNumber(int pagenumber){
       this.pagenumber=pagenumber
    }I'm not sure if this is the best way to do this or if what I am trying to do is even possible.
    Any advice would be greatly appreciated.
    Thanks :)

    Hi all, I have a problem passing params back to my custom tag. The tag handler has a "getPageNumber()" method which returns a value. Initially the value is set and if a link is clicked it passes that param to the tag handler. I am trying to get this value from the tag handler to update the value on the link parameter.
    Something like this:
    // processed tag
    <a href="mypage.jsp?page=1">Next page</a>
    // clicking "Next Page"
    <a href="mypage.jsp?page=2">Next page</a>
    // jsp
    <taglib:tag param="<%=getPageNumber()%>"  />
    // in tag lib
    private pagenumber=1;
                pagenumber++;
    getPageNumber(){
    return pagenumber;
    setPageNumber(int pagenumber){
       this.pagenumber=pagenumber
    }I'm not sure if this is the best way to do this or if what I am trying to do is even possible.
    Any advice would be greatly appreciated.
    Thanks :)

  • Calling jsp custom tag from jsp expression

    hi there,
    I have a problem calling oracle(or any other) custom tag from inside a jsp expression.(i.e.)embeding <jbo:tagname...> into <%......%>.
    For example:
    I need to get the value of a jsp parameter, but the parameter name is dynamic (retrieved from a DataBase)
    So I though it would be something link that:
    <%=request.getParameter(<jbo:ShowValue datasource="ds" dataitem="ParamName" ></jbo:ShowValue>) %>
    where <jbo:ShowValue is an Oracle custom tab that retrieves the value of a certain dataItem(certain field).
    But it does not work.........
    if any body can tell me how to overcome, or work around it, I'll be so pleased.
    Regards,
    Remoun Anwar

    Hi,
    You get the custom tag output into a hidden variable (say 'key') and use the request.getParameter("key")
    Hope u got the answer...
    Regards
    ravi

  • Custom tag and JSP = getOutputStream error

    Hi guys. I have a custom authorization tag as follows:
    package tags;
    import stuff;
    public class AuthenticatedTag extends TagSupport {
         public int doStartTag() throws JspException {
              try {
                   pageContext.forward("login.htm");
              } catch (Exception e) {
                   e.printStackTrace();
              return EVAL_PAGE;
         public int doEndTag() throws JspException {
              return EVAL_PAGE;
    }and a jsp page using this tag:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" errorPage="error.jsp" %>
    <%@ taglib uri="/WEB-INF/tags.tld" prefix="tags" %>
    <tags:myauth />
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>stuff
    </body>
    </html>When I point my browser to this jsp I get:
    org.apache.jasper.JasperException: getOutputStream() has already been called for this response
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:476)     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:383)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    Any ideas of what could be wrong? thx

    If you forward to the login.htm page, you should stop the rest of the current page evaluating. Just because you forwarded it, doesn't stop the flow of control in this page. It is trying to evaluate both the current page and the one that you forwarded to. You can only send one response
    Returning SKIP_PAGE from the doEndTag function should do the trick.
    I'm not sure that returning EVAL_PAGE or SKIP_PAGE from the doStartTag is legal. It should return SKIP_BODY or one of the EVAL_BODY options.
    In fact I think the whole thing should probably be done in the doEndTag for that reason.
    package tags;
    import stuff;
    public class AuthenticatedTag extends TagSupport {
         public int doEndTag() throws JspException {
              try {
                   pageContext.forward("login.htm");
                            return SKIP_PAGE
              } catch (Exception e) {
                   e.printStackTrace();
              return EVAL_PAGE;
    }I presume you will be putting in some sort of check to see if you should forward to login.html instead of evaluating the current page?
    Just as an alternative suggestion, a better way IMO is to implement this sort of logic as a filter, rather than putting a tag on a JSP page.
    Cheers,
    evnafets

  • Custom Tags in JSP

    I am new to using custom tags. Is there a nice book or site which I could read on custom tags.
    Also, I kind of understand custom tags but not completely confident.
    I have a JSP that uses two custom tags, flight and segment. Basically, goes through each segment with flight tag and prints out attribute of segment with Segment tag. The code looks like this.
    <flifo:flight isParent="true" fromParent="true" >
              <td bgcolor="<%=bgcolor%>" width="94" valign="top" class="t7">
                        <%-- Print FLIGHT NUMBER --%>
                   Flight
                        <b><flifo:segment fromParent="true" attribute="flight_num" /></b>
                        <br>
    </flifo:flight>
    In the above code I just have flight_num but there are other attributes that it prints out. I want to check an attribute in segment and if it is ture then display some of the tags. How can I do it?

    This has helped me a lot in the past:
    http://java.sun.com/developer/Books/javaserverpages/cservletsjsp/chapter14.pdf
    ... and the book it's extracted from is very good too.

  • Can we modify the standard AOL Message with custom Message in Seeded Page?

    Hi,
    I have a requirement to change AOL Message with custom Message in Seeded Page.
    In a seeded OAF page when a user clicks on a submit button a standard AOL Processing Message is populated.
    I Need to change the Standard Message and call Custom Message.
    Did controller extension and found that both the messages are populating.
    called the code after super and tried to call before super also.
    Did any one face this issue and resolved it. Kindly provide the solution.
    Regards
    Chaitanya

    Hi Gyan,
    I have tried by extending a sample custom controller.
    Below is the code of TestCO calling create message
      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
        super.processFormRequest(pageContext, webBean);
          OAApplicationModule am = pageContext.getApplicationModule(webBean);
          if (pageContext.getParameter("Test") != null)
              OAException confirmMessage = new OAException("AK", "FWK_TBX_T_EMP_CREATE_CONFIRM",    null,
              OAException.CONFIRMATION, null);
              pageContext.putDialogMessage(confirmMessage);
      }Then I extending the TestCO to XXTestCO and it is calling Update Message
        public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
          super.processFormRequest(pageContext, webBean);
            OAApplicationModule am = pageContext.getApplicationModule(webBean);
            if (pageContext.getParameter("Test") != null)
                OAException confirmMessage = new OAException("AK", "FWK_TBX_T_EMP_UPDATE_CONFIRM",    null,
                OAException.CONFIRMATION, null);
                pageContext.putDialogMessage(confirmMessage);
        }got below Confirmation
    Confirmation
    Employee &EMP_NAME with the number &EMP_NUMBER has been created.
    Employee (&EMP_NAME) has been updated.
    Tried below approach also calling the message before super class
        public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
            OAApplicationModule am = pageContext.getApplicationModule(webBean);
            if (pageContext.getParameter("Test") != null)
                OAException confirmMessage = new OAException("AK", "FWK_TBX_T_EMP_UPDATE_CONFIRM",    null,
                OAException.CONFIRMATION, null);
                pageContext.putDialogMessage(confirmMessage);
          super.processFormRequest(pageContext, webBean);
        }got below Confirmation
    Confirmation
    Employee (&EMP_NAME) has been updated.
    Employee &EMP_NAME with the number &EMP_NUMBER has been created.
    My requirement is to print only the message which I have kept in Extended controller i.e. Update message
    Regards,
    chaitanya

  • Calling custom tags in jsp  with jsp:include

    Hi,
    I have a large jsp file , which uses jstl fmt tags for labels.
    Since the size of jsp was too big iand i was unable to compile it because of 64 kb class size limit,
    I removed the tag lib defination from the jsp file and put it in another jsp file. and used jsp:include to include this file inside the first jsp.
    It is compiling successfully but labels r not showing up.
    but when i use <%@include to include second jsp in the first one i get the labels properly.
    I cannot use <%@include as this starts giving me compilation error related with jsp class file size beyond 64 kb.
    Pls suggest why jsp:include is not working.
    thanks,
    Pramod

    Hi Anil,
    Ur suggestion was good but could not solve my problem.
    I have put a small sample code to illustrate the problem.
    labeldemo.jsp:
    <%-- <%@ include file="WDCComInitLabelsjunk.jsp" %> --%>
    <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
    <table width="100%" cellpadding="3" cellspacing="0" border="0" class="tablebg">
                                  <tr class="headtd">
                                       <td colspan="4"><span class="headtext"><fmt:message key="Cash_Management"/> </td>
                                  </tr>
                                  <tr> hi </tr>
                             </table>
                             </fmt:bundle>
    WDCComInitLabelsjunk.jsp:
    <%@ page language="java" %>
    <%@ page contentType="text/html"%>
    <%@ page import="com.tcs.wdc.core.*" %>
    <%@ page import="com.tcs.wdc.core.login.*" %>
    <%@ page import="com.tcs.wdc.core.service.navigation.*" %>
    <%-- Include tag library --%>
    <%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
    <%-- Get language from IDCUserSession & set it in session --%>
    <%
    /*SessionManager sm = new SessionManager(session);
    IDCUserSession ius = sm.getIDCUserSession();*/
    session.setAttribute("language","nl_NL");
    %>
    <%-- Set the locale for the language obtained --%>
    <fmt:setLocale value="${language}" />
    <fmt:bundle basename="labels" />
    If i uncomment the <%@ include file="WDCComInitLabelsjunk.jsp" %> tag in the code above it is working fine ,
    but it is not working with <jsp:include page="WDCComInitLabelsjunk.jsp" flush="true" />
    pls suggest.
    Thanks,
    Pramod

  • JavaBeans and Tags in JSP pages

    I have a java package and some code that already works but I need to "Webify" it. I have heard the words Tag Libraries and Beans to use with JSP pages instead of writing out the java code in the page. I have read the tutorial on Tag Libraries and it still makes no sense. I need some kind of beginners guide and instruction. I already have the java in the .jar file and have Tomcat setup. I know I need to make a tag library and stuff, but beyond that I'm a bit lost. I'm just not sure where to put what. Also, I did do a practice JSP page but it won't automatically find the jar file - they are in the WEB-INF/lib directory. I actually have to set the CLASSPATH separately by doing export CLASSPATH=.... which I know can't be right - is there a way to do this in the actual JSP program itself - like set the classpath just for that webpage?

    Here's a good basic tutorial that helped me when I was getting started with tags:
    http://www.theserverside.com/resources/article.jsp?l=JSP-XML3

  • To search a record from the table by providing a search button in JSP page

    Hi,
    My problem statement is:
    I have a jsp page which displays a table containing records. I have to provide a button called search and a condition in a textfield so that the record which matches the condition gets highlighted.
    Can anyone solve my problem statement. Its urgent.
    Suraj.

    Example:
    on the jsp page, read the matched value the server provides and use it to put the statement in bold using the <b> tag (I dont know the syntax for highlighting).
    <%String matchedString=(String) request.getAttribute("matchingString");%>
    Then in your list:
    <%if(matchedString.compareTo(thisRecordString)==0){%>
    <b>
    <%}%>
    //your text goes here
    <%if(matchedString.compareTo(thisRecordString)==0){%>
    </b>
    <%}%>

  • Pls help me writing logic:iterate tag in jsp page

    Hey guys , I am struck in retriving string p1,p2,p3 in the jsp page
    Pls have a look ata the code
    In DAO class:-
    StdprdDAO.java
    Public arrayList getPFP()
    ArrayList a = new ArrayList();
    While(rs.next())
         columnsVO colVO = new columnsVO;
         colVO.setProduct(rset.getString(1));//will store in String colProduct
         colVO.setFamily(rset.getString(2));//will store in String colFamily
    colVO.setPrice(rset.getString(3));//will store in String colPrice
    a.add(colVO);
    return a;
    In Action Class:-
    ArrayList final = null;
    StdprdDAO DAO = new stdprdDAO();
    final = DAO.getPFP();
    For(int i = 0; final !=null && i<final.size() ; i++)
         columnsVO VO = null;
         VO = (columnsVO)final.get(i);
         String p1 = (String) VO.getProduct();
         String p2 = (String) VO.getFamily();
         String p3 = (String) VO.getPrice();
         Request.setAttribute(“p1”,p1);
         Request.setAttribute(“p2”,p2);
         Request.setAttribute(“p3”,p3);
    In JSP PAGE:-
    id = “columnsVO”>
    <bean:write name = “columnsVO” property=”final” id=”p1”>
    but still I am doubting my above sentences in jsp page ,so pls correct them if possible.
    Instead of l;ogic:iterate can I use directly getattribute(“p1”)? <logic:iterate
    Still I m doubting I can not utilize columnsVO file in logic:iterate, I can utilize only formbean file.
    So pls help me with this.

    May I ask why have you done it?
    If it is related to printing of the list then it is of no use.But it IS of use. The objects compEmployees is in scope.
    It has the list we want to print out.
    With logic:iterate:
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <logic:iterate name="compEmployees" property="totalEmps" id="emp">
              <tr>
                <td>
                  <bean:write name="emp" property="empNo"/>
                </td>
                <td>
                  <bean:write name="emp" property="empName"/>
                </td>
              </tr>
         </logic:iterate>
    </table>or alternatively with JSTL and c:forEach
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <c:forEach items="${compEmployees.totalEmps}" var="emp">
              <tr>
                <td>
                  <c:out value="${emp.empNo}"/>
                </td>
                <td>
                  <c:out value="${emp.empName}"/>
                </td>
              </tr>
         </c:forEach>
    </table>Cheers,
    evnafets

Maybe you are looking for

  • Report load is slow after changing database servers

    Here is the problem: Crystal Reports saves the design time database connection info in the rpt.  When our application tries to run a report against a production database, the rpt takes a long time (60 sec.) to load.  After it has loaded we can change

  • Can I burn bigger-than-DVD image onto hard drive and run it off hard drive?

    I'm trying to create a DVD Kiosk of sorts. I have a series of instructional videos we have created--I would like it to play a video from the menu randomly if left alone for a period of time, and if someone moves the mouse, they will be given the DVD

  • USB to DVI devices cause dual and triple monitors to flicker

    Hello everyone! I have two T500's which are on a Lenovo docking station, using 3 external monitors.   One monitor is using the port on the docking station, which is a digital port, thus using the ATI video card within the Thinkpad.  The other two mon

  • Discount for Second line item

    Hi All While creating a sales order, the pricing should be determined based on Product line item. For Example: If Line item 10 has Product X and if the same Product X is taken again for line item 20 then the system should give discount based on prece

  • Pdf or video

    What is the better way to export a slidehow in lightroom 4, pdf or video?