IllegalStateException using custom tag

I'm receiving the following exception when trying to use a custom tag we are developing to allow us to provide localized content based on the users browser language/country settings:
     java.lang.IllegalStateException: WEB3025: Cannot reset after response has been committedThe thing is - the tag works perfectly when the page is using JSP includes:
     <jsp:include page="/components/headers/global.jsp" />but we get the exception when using our tag:
     <core:localizedInclude page="/components/headers/global.jsp" />and we make a call to our servlet:
     <jsp:forward page='/servlet/MyServlet' />Here is the line in the custom tag Java code that pulls in the file:
     pageContext.include(localizedPage);Any ideas what we can do to fix this? What are the differences between the <jsp:include> and our <core:LocalizedInclude> in this case?
Bob

The pagecontext 's include method flushes the buffer before a call to this method. This means the call to your tag from the jsp should be the first line in your jsp as headers have to be set first before writing any html response.
Here's the relevant javadoc.
blah..blah..
The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include.
blah..blah..You could try the overloaded pageContext.include("path", false) which according to javadoc
blah..blah..
If flush is true, The current JspWriter "out" for this JSP is flushed as a side-effect of this call, prior to processing the include. Otherwise, the JspWriter "out" is not flushed.
blah..blah..cheers,
ram.

Similar Messages

  • How to use custome tag lib in the JSP page?

    How to use custome tag lib in the JSP page?...with JDeveloper

    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtTopicFile.working_with_jsp_pages%7Cjsp_ptagsregistering~html/

  • 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

  • Can i use Custom Tags for Database retrieval (as per MVC pattern)?

    In our project we are dealing with database, and i've used the Cutom Tags for database retrieval (as per the Article from Mr Faisal Khan) and it is working fine. But i have a doubt if it affects the performance in any way . I wanted to know if its recommendable to use Custom Tags for the DB retrieval as per MVC Pattern or shall i create a intermediate bean and then call the bean in custom tag.
    Thanks
    Prakash

    Putting database code in your JSPs certainly couples your view to the database. That's usually not good.
    If it's a simple app, it might be justified.
    When you start having lots of pages and complex business logic it becomes less attractive. - MOD

  • Can i make own formatted textbox using custom tag

    Hai,
    Can i create own format textbox similar to vb activex control.for example i want make own formatted textbox for enter only numeric value if entry any alpha value it's show error.Is this possible using custom tag

    Hai,
    Can i create own format textbox similar to vb
    activex control.for example i want make own
    formatted textbox for enter only numeric value if
    entry any alpha value it's show error.Is this
    possible using custom tag
    If you mean a custom text box in a web page without an applet (in other words an html component), then Java has nothing to do with it. And by mentioning activex (even only in a 'like' comparison), and custom tag, you are once again hinting that you want an html component. I think you need to place your request to a JavaScript Forum, which, once again, has absolutely nothing to do with Java.
    A "custom tag" in JSP is not an HTML Tag. It may look a little like an html or xml tag, but it is evaluated on the server side. The control you need must be executed on the client side, which, once again, tells me you need to post to a JavaScript forum.

  • How to use Custom Tags for Theme and Base Map Definitions

    In Mapviewer documentation I've found the following new feature:
    The XML definition of a theme or base map now supports application-specific
    attribute tags. You can use the Custom Tags option in the theme definition in Map
    Builder to specify tags and their values, which can be interpreted by your application
    but are ignored by MapViewer itself.
    I'm able to define a custom tag in Mapbuilder, but how can I use it in my Application?
    Thanks.

    As he said, you have to use as Platform service to create adapter in OIM.
    tcUserOperationsIntf service = Platform.getService(Thor.API.Operations.tcUserOperationsIntf.class);
    HashMap<String,String> searchmap=new HashMap<String,String>();
    searchmap.put("Users.User ID", userID);
    tcResultSet searchset=service.findAllUsers(searchmap);

  • Creating drop down menus in JSP using custom tags

    Hi, i am working on a JSP which has custom tags for displaying menubar and menus, now i want to have these menus converted into drop down menus, and the submenus displayed onmouseover event. I am getting solutions with pure html page calling javascript functions.But i dont need this, i want the work done by my TagHandler class which sends the output to output stream, which in turn is transformed in to actual HTML by a XSLT embedded in my JSP.
    Please help as i am new to custom tags, and desperately in need of help.
    If possible give some sample code or useful links.
    I will be highly grateful.
    Thankx in advance

    that's fine, but the tag has to, ultimately, generate the HTML/Javascript stuff like you've already seen.

  • Simultaneous Client and Server Form Validation using Custom Tag Library

    I am developing a custom tag library for validator tags
    which are capable of doing client side validation (Javascript)
    and server side (Java). My problem is with the development
    of a regular expression based validator. Because of differences
    in the way Javascript and Java handle regular expressions
    i can not use the same regular expression for both types of
    validation. Is there any way to convert a valid regular
    expression from the java.util.regex format into the Javascript
    format or vice versa? My major problems are with the (or, ||)
    statements and the user of backslashes.

    If you are speaking of RE syntax flavours, they are basically the same(namely perl5 flavour). Any expression that works in JS should work in j.u.regex too.
    Though, their usage is quite different.
    So, there is no need for convertion of expressions.
    But porting the code may be not so trivial.

  • Error Using Custom Tag

    I am trying to use a custom tag but receive an error when I use it on a jsp page.
    I have a tag handler class file, tag library descriptor file, specified the path to the .tld in the web.xml file.
    The error implies that it cannot find the SimpleTag.class file, though I put it in the \webapps\examples\WEB-INF\classes\ directory.
    Here is the error. Does anyone know what else it could be?
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    C:\jakarta-tomcat-4.0.1\work\localhost\examples\jsp\jspVisual\ch10\using_0005ftag$jsp.java:63: Class org.apache.SimpleTag not found.
    SimpleTag_jspx_th_myFirstTag_SimpleTag_0 = new SimpleTag();

    I could not see any obvious mistakes. But what you could try, in order to isolate the problem, is to bypass the web.xml. In other words access the TLD directly by doing this in your JSP
    <%@ taglib uri="/WEB-INF/jsp/tag_library_descriptor.tld" prefix="myFirstTag" %>
    if that does work then move the your TLD out of the jsp folder and into WEB-INF , then try
    <%@ taglib uri="/WEB-INF/tag_library_descriptor.tld" prefix="myFirstTag" %>
    Maybe someone else has better idea.

  • Problem using custom tag library in portlet's jsp

    Hi,
    I created a custom portlet (a JSR 168 portlet) and I'm using a tag library that I previously developed. Normally it works fine, but sometimes I get a ClassCastException. Once I redeploy the portlet everything works again. This is Oracle Portal 10.1.4.
    Has anybody encountered similar problems?
    Here's the exception:
    taglib exception:
    java.lang.ClassCastException at timecardreminderportlet.html._view._jspService(_view.java:201) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824) at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121) at oracle.webdb.wsrp.server.RequestDispatcherImpl.include(Unknown Source) at org.mitre.isis.trs.reminder.portlet.TimecardReminderPortlet.doDispatch(TimecardReminderPortlet.java:108) at javax.portlet.GenericPortlet.render(Unknown Source) at oracle.webdb.wsrp.server.Server.getMarkup(Unknown Source) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.invoke_getMarkup(WSRP_v1_Markup_PortType_Tie.java:224) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.processingHook(WSRP_v1_Markup_PortType_Tie.java:499) at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230) at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153) at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)

    Hi,
    I created a custom portlet (a JSR 168 portlet) and I'm using a tag library that I previously developed. Normally it works fine, but sometimes I get a ClassCastException. Once I redeploy the portlet everything works again. This is Oracle Portal 10.1.4.
    Has anybody encountered similar problems?
    Here's the exception:
    taglib exception:
    java.lang.ClassCastException at timecardreminderportlet.html._view._jspService(_view.java:201) at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824) at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121) at oracle.webdb.wsrp.server.RequestDispatcherImpl.include(Unknown Source) at org.mitre.isis.trs.reminder.portlet.TimecardReminderPortlet.doDispatch(TimecardReminderPortlet.java:108) at javax.portlet.GenericPortlet.render(Unknown Source) at oracle.webdb.wsrp.server.Server.getMarkup(Unknown Source) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.invoke_getMarkup(WSRP_v1_Markup_PortType_Tie.java:224) at oracle.webdb.wsrp.WSRP_v1_Markup_PortType_Tie.processingHook(WSRP_v1_Markup_PortType_Tie.java:499) at com.sun.xml.rpc.server.StreamingHandler.handle(StreamingHandler.java:230) at com.sun.xml.rpc.server.http.ea.JAXRPCServletDelegate.doPost(JAXRPCServletDelegate.java:153) at com.sun.xml.rpc.server.http.JAXRPCServlet.doPost(JAXRPCServlet.java:69) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at oracle.webdb.wsrp.server.ContextFilter.doFilter(Unknown Source) at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663) at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330) at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224) at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133) at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192) at java.lang.Thread.run(Thread.java:534)

  • Navigate using custom tag

    Hello folks,
    I am trying to navigate to a servlet from a jsp using the navigate() javascript method. Within the method I am using a custom tag to supply the web context root. If I use request.getContextPath() everything is fine, but if I use the custom tag (which is what I want), I get an "Object Expected" error. Code snippet below. Any help would be appreciated.
    <SCRIPT type="text/JavaScript">
       function doSomething() {
          navigate('<context:GetWebContextRoot/>/servlet/framework.components.LogonControllerServlet?command=logoff');
    </SCRIPT>

    If <context:GetWebContextRoot/> is indeed a
    JSP tag , what is it doing inside a javascript
    string? Put it outside the single quotes (and add it
    to the js string), otherwise it won't be processed by
    the server.Tried that already,
    navigate(<context:GetWebContextRoot/> + '/servlet/framework.components.LogonControllerServlet?command=logoff');here is the resulting source:
    navigate(/MyApp  '/servlet/framework.components.LogonControllerServlet?command=logoff');Same error.

  • Problem deploying and using custom Tags in jar files

    I am trying to create a custom tag library of Java classes, package them in a JAR file, and use them in another web application. Here is the JAR file structure, named mytags.jar:
    META-INF
    META-INF/manifest.mf
    META-INF/taglib.tld
    mytags/FooBar.class
    mytags/Another.class
    ...Here is the taglib.tld file:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <taglib xmlns="http://java.sun.com/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
    version="2.0">
       <tlib-version>1.0</tlib-version>
       <short-name>foo</short-name>
       <uri>fooTags</uri>
       <info>My tags</info>
       <tag>
         <name>fooBar</name>
         <tag-class>mytags.FooBar</tag-class>
         <body-content>empty</body-content>
         <attribute>
           <name>name</name>
           <required>false</required>
           <rtexprvalue>true</rtexprvalue>
         </attribute>
      </tag>
    </taglib>The FooBar class has getName(String) and setName() methods.
    In the web application, I have copied mytags.jar into the WEB-INF/lib directory. I've verified that it lands in the corresponding directory for my appserver (I'm using Tomcat 6.0.10).
    Here's the header for my JSP:
    <%@ page language="java" contentType="text/html;charset=UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="fooTags" prefix="foo" %>
    <foo:fooBar name="dummy" />
    ...When I access my page, the browser sits there and spins, not able to do anything. I know that some of the content is executed, but it is not able to get to the fooTags. I have tried replacing fooTags with WEB-INF/lib/mytags.jar, to no effect.
    According to the docs, I should not need to include anything in web.xml to reference the fooTags. The tag library classes are valid, since I used them as local tags prior to moving them into a Jar library.
    Any help would be appreciated

    Take the code of the jsp file :
    <%@ page language="java" %>
    <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
    <html>
       <head>
         <title> First Struts Application </title>
       </head>
         <body>
            <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
            </tr>
            <tr bgcolor="#36566E">
              <td height="68" width="48%">
                <div align="left">
                  <img src="images/hht.gif" width="220" height="74">
                </div>
              </td>
            </tr>
            <tr>
             <td> </td>
            </tr>     
           </table>
           <html:form action="Lookup"
                      name="lookupForm"
                      type="wiley.LookupForm" >
           <table width="45%" border="0">
            <tr>
              <td>Symbol:</td>
              <td><html:text property="symbol" /> </td>
            </tr>
             <tr>       
              <td colspan="2" align="center"><html:submit/> </td>
             </tr>       
            </table>              
          </html:form>
         </body>
    </html>

  • Using custom tags - not a "how to do my homework" question.

    Hi, I havn't done a heap of JSP and I'm experimenting with custom tags. I understand this may be elementary to some. I also expect there is probably some ready-to-go libary out there that would do this for me, I just wanted to do it from scratch, mostly as a learning exercise.
    So I've got a servlet which runs a query, and sends two arrays of objects to a JSP, one is an array of column headings, the other is an array of arrays representing the rows of data.
    The intention of the JSP is simply to display the data in a table.
    I guess one question I have is:
    What is the best way to apply styles to my table? Obviously I don't want to have to recompile the tag code to add/change styles. Is the best way to do it is to have another property of the tag that accepts the name of a style class?
    So when I place the tag in my JSP it will looks like <test:report-table headings="..." rows="..." style="blue"/> and in the tag code it will look something like out.write("<table class=\" + classname + \"");I appreciate any comments on how good/bad my code/theory is. Any recomended additions/omissions?
    The tag in the JSP looks like this.
            <test:report-table
                headings="<%= (Object[])request.getAttribute(\"columns\")%>"
                rows="<%= (Object[])request.getAttribute(\"rows\")%>"
            />The tag class looks like this.
    bar.foo.test;
    import java.io.IOException;
    import javax.servlet.jsp.JspWriter;
    import javax.servlet.jsp.tagext.TagSupport;
    public class ReportTable extends TagSupport
        private Object[] headings;
        public Object[] getHeadings() { return headings; }
        public void setHeadings(Object[] o) { this.headings = o; }
        private Object[] rows;
        public Object[] getRows() { return rows; }
        public void setRows(Object[] o) { this.rows = o; }
        public int doStartTag()
            JspWriter out = pageContext.getOut();
            try
                out.write("<table>");
                out.write("<tr>");
                for (int i = 0; i < headings.length; i++ )
                    out.write("<td>" + headings[i] + "</td>");
                out.write("</tr>");
                for (int i = 0; i < rows.length; i++)
                    out.write("<tr>");
                    Object[] row = (Object[])rows;
    for (int j = 0; j < row.length; j++)
    out.write("<td>" + row[j] + "</td>");
    out.write("</tr>");
    out.write("</table>");
    catch (IOException e)
    e.printStackTrace();
    return 0;
    The tag definition in my tld looks like this
        <tag>
            <name>report-table</name>
            <tagclass>bar.foo.ReportTable</tagclass>
            <bodycontent>empty</bodycontent>
            <info> Report Table </info>
            <attribute>
                <name>headings</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
                <type>java.util.Object[]</type>
            </attribute>
            <attribute>
                <name>rows</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
                <type>java.util.Object[]</type>
            </attribute>
        </tag>

    TimSparq wrote:
    Cool, thanks for the input/advice, evanfets.
    Yeah, my plan was now that I have a basic understanding of the mechanics of what's going on in the tags, I'll go and look into what ready-made stuff there is out there (like you suggest, JSTL).
    And thanks for the advice regarding styles, exceptions and the return value. All appreciated.
    I'll be taking a look into the tag files too.
    Thanks again.Just another option on the styles. One thing I have done in similar situations is to generate a lot of class names and automatically apply them to the correct spot. Example:
    <table class="reportTable">
      <thead class="reportTableHead">
        <tr class="rtHeadRow"><th class="rtOddColumn">...</th><th class="rtEvenColumn">...</th></tr>
      <thead>
      <tbody class="reportTableBody">
        <tr class="rtOddRow"><td class="rtOddColumn">...</td><td class="rtEvenColumn">...</td></tr>
        <tr class="rtEvenRow"><td class="rtOddColumn">...</td><td class="rtEvenColumn">...</td></tr>
      </tbody>
    </table>This gives the web developer a large selection of selectors to work on:
    table.reportTable -> Edit the entire table
    table.reportTable tr -> Configure all rows in the table
    table.reportTable tr.rtOddRow -> Configure the odd rows in the table
    table.reportTable tr.rtOddRow td.rtEvenColumn -> Configure just the even columns in an odd row
    etc...
    You just communicate the class names that can be used and then the web designer generates a CSS to fit his needs.

  • How to use custom tags for integrating FCK Editor?

    Hi All,
    I am looking for the integrating the FCK Editor in my jsp page. any one can please provide the procedure of How to create fckeditor in jsp?
    I have the jar file of fck editor but i am confusing while creating the custom tag for that editor.
    I want like this:
    <FCKeditor:fck ?> like this
    Regards,
    Sateesh

    google answers it all..
    [http://www.jroller.com/coreteam/entry/using_fckeditor_in_jsp_web]
    [http://java.fckeditor.net/properties.html]
    [http://java.fckeditor.net/java-core/tagreference.html]

  • JSPs using Custom Tag with Boolean attribute cannot compile

    Hi,
    In Oracle9iAS(9.0.3), a jsp using a tag extension, which has a Boolean attribute, caused the following compile error, although the jsp is valid in other web containers.
    ERROR:
    /opt/oracle/j2ee/home/application-deployments/simple/simple/persistence/_pages/_test.java:56: Method toBoolean(java.lang.Boolean) not found in class _test.
    __jsp_taghandler_1.setExists( OracleJspRuntime.toBooleanObject( toBoolean( b)));
    JSP:
    <%@ page language="java" %>
    <%@ page errorPage="error.jsp" %>
    <%@ taglib prefix="jnpr" uri="/WEB-INF/testtag.tld" %>
    <%
    Boolean b = Boolean.valueOf("true");
    %>
    <jnpr:TestTag exists="<%= b%>"/>
    The boolean value is <%= b %>
    Tag Handler:
    package defaultpak;
    import javax.servlet.jsp.tagext.*;
    import javax.servlet.jsp.*;
    public class TestTag extends TagSupport{
    private Boolean exists = null;
    private java.lang.Boolean getExists() {
    return exists;
    public void setExists(java.lang.Boolean newExists) {
    exists = newExists;
    public int doStartTag() throws JspException {
    return super.doStartTag();
    Is this a known problem? Is there a way to get around this?
    Thanks in advance.
    Fred

    This is a known issue with 903, fixed in coming 904.
    In 903 the workaround is to use primitive type "boolean" instead of Object type "java.lang.Boolean" in user's getter and setter code for the taglib.
    -Prasad

Maybe you are looking for

  • Filesystem goes read-only

    Hi, all Yesterday, OVM Server3.1.1 was crashed. due to ovspoolfs.img was corrupted. I recovered ovspoolfs.img.(but OVM Manager didn't recognize that server.) Main problem is that Filesystem goes read-only. I checked out /var/log/messages. but There a

  • Why object M_MATE_NEU?

    Hi together In different Retail systems we have (now) the object M_MATE_NEU which is used o.e. in transaction mm41. Until now we inserted the object in the roles whit mm41 because is needed to create new products, etc... But in my opinion this object

  • DB13 Online Backup

    Hi, I am taking daily online backup from BRTOOLS on a disk(BACKUP SEVER).If I want to take the online backup through DB13 in the disk what is the procedure to be used(step by step) Server     ECC5.0 ORACLE  9.2.0.7.0 Regards AAA

  • Web based Auto dialer in java

    Hi, I have assigned the work that implementation of "web based auto dialer in java". The problem is I have a button on the web page . when I click on that button . I have to call to particular number (fixed number). I have search a lot . I didn't get

  • Java newbie & text files

    I want to create a simple program that will read a text file and put it in a variable to use later in the program. I can't figure out how to assign characters from the text file to a variable. Please bear with me, this is my latest attempt: import ja