Is possible to write a custom tag inside another custom tag ??

Hi
I�m trying to reduce the time needed to code mi app presentation layer, it uses some custom tags with certain configuration, i would like to know if its possible to do something like this inside my custom tag doAfterBody().
public int doAfterBody() throws JspException {
          JspWriter writer=bodyContent.getEnclosingWriter();
          try {
               writer.print("<customTag:myAnotherTag someEspecificConfigurationParams="someEspecificValues"/>");
          } catch (IOException e) {
               pageContext.getServletContext().log("Error: "+e.getMessage());
          }return SKIP_BODY;
     }The goal is to simplify the jsp code because the configuration params for the custom tags (css styles and similar) are allways the same.
That don�t work, it simply prints <customTag:myAnotherTag/> in screen but the tag is not evaluated, i�ve tried too something like
public int doAfterBody() throws JspException {
          if (repeat) {
               JspWriter writer = bodyContent.getEnclosingWriter();
               try {
                    writer.print("<customTag:myAnotherTag/>");
               } catch (IOException e) {
                    pageContext.getServletContext().log("Error: " + e.getMessage());
               repeat = false;
               return EVAL_BODY_AGAIN;
          return SKIP_BODY;
     }And it doesn�t worked worked. Maybe using the taghandler classes and calls to the doAfterBody could make it work, but when you need to nest tags it could be a little hell of coupling calls, so before doing it i would like to know if what i want is possible. After reading some books i tought it could work because the stack of out objects, but i can�t make it work.
Another idea is to inherit from tagHandler and override some properties in the tags, but i don�t like the idea to much.
So, can anyone help me??
Thanks.

You cannot do that and I have listed out the reason and a possible solution in this post http://forum.java.sun.com/thread.jspa?threadID=697243 from yesterday.
cheers,
ram.

Similar Messages

  • JSF tag inside another JSF tag

    Hi,
    Note: It's a bit of a long post but I will try to cut to the point without leaving behind any pertinent details.
    I've created some simple custom JSF tags in the past. The tags usually consisted of one or two attributes that would be beans. The tags would then print out the data for those beans or process them and then output the results.
    What I am trying to do now is a bit more complicated for me. I have a JSP page with a scriplet on it. It iterates over a bean containing a list of items. The loop adds those items to an HTML select menu one at a time. The outline of the code looks similar to this,
    <% extract data List from the bean and store it in variable called dataList %>
    <select>
    <%
      for (int i=0; i<dataList.size(); i++;){
        ListItem item = dataList.get(i);
        String name = item.getName();
        String value = item.getValue();
    %>
    <option value="<%=value%>">
      <%=name%>
    </option>
    <%}%>
    </select>
    <h:commandButton id="gobtn" action="go_to_page" actionListener="#{action.fetch}" value="Go"/>What I want to do is take all the above code and put it into a custom JSF tag. This tag would contain all the scriplet code, output the HTML code and also the commandButton code at the end.
    All of that is pretty easy except for the commandButton part. I am not sure how to output a commandButton from a custom JSF tag. How do I pass it the action.fetch part for the actionListener attribute? Can I create a commandButton object in my custom JSF tag and pass it this information?
    I've followed a tutorial at this site in the past but it doesn't go into too much detail
    http://www.exadel.com/tutorial/jsf/jsftutorial-customcomponents.html
    Any help is appreciated,
    Nick

    I guess I missed some information. The dataList in the bean is stored in a HashMap. So some work has to be done with the bean before hand to determine what list to pull out and then "massage" it a bit for viewer consumption. This is not easily accomplished with the standard JSF html tags, hence my going with a custom tag approach.
    Processing this bean and getting a list from the Hashmap in the bean before displaying it is easy, so is outputting the HTML. The hard part is rendering the commandButton with all the attributes I listed previously.
    Is there a way in general to have other JSF tags nested inside a custom JSF tag?

  • Insert html form tag inside another form tag

    Hi all, this is my issue. I have a xhtml page structured as following:
    <h:form id="mainForm">
    ....... some stuff........
    <form id="fileForm" action="myServlet" method="post" enctype="multipart/form-data">
         <input type="file" onchange="fileForm.submit()" />
    </form>
    </h:form>
    When uploading a file, I wanna submit only 'fileForm'. But "fileForm.submit()" doesn't work because fileFom is null. Looking at the page source, I realized that only one form is seen client-side (the mainForm):
    <form id="mainForm">
    ....... some stuff........
         <input type="file" onchange="fileForm.submit()" />
    </form>
    Any idea on how to implement it?
    Thanks in advance...

    I think so too.
    I tried creating a custom fileUploader component but, as expected, it didn't work.
    Here http://balusc.blogspot.com/2009/12/uploading-files-with-jsf-20-and-servlet.html they create a completely custom renderer which would solve my issue but it works only with j2ee6 and for company reason I must use j2ee5.
    I think I have to refactor the page and figure out a new approach.
    Thanks for your reply.

  • Why would someone use the meta utf-8 tag inside the script tag?

    I have run into a number of sites that use the <meta utf-8> tag inside the <script> tag what is the use of it.
    How dose one write the utf-8 inside the script tag?

    csteinola wrote:
    > If I CFINCLUDE that cache file, the characters come out
    munged (non-utf-8
    > encoded).
    try prepending a <cfprocessingdirective
    pageencoding="utf-8"> to the file.

  • How to use h:selectOneRadio tag  inside h:dataTable tag

    Hi All,
    Can any one tell me how to use <h:selectOneRadio> tag inside <h:dataTable> tag and how to get selected radio button value in bean ?

    JSF<h:selectOneMenu value="#{myBean.selectedItem}">
        <f:selectItems value="#{myBean.selectItems}" />
    </h:selectOneMenu>MyBeanprivate String selectedItem;
    public String getSelectedItem() {
        return selectedItem;
    public void setSelectedItem(String selectedItem) {
        this.selectedItem = selectedItem;
    public List getSelectItems() {
        List selectItems = new ArrayList();
        selectItems.add(new SelectItem("key1", "value1"));
        selectItems.add(new SelectItem("key2", "value2"));
        selectItems.add(new SelectItem("key3", "value3"));
        return selectItems;
    }String selectedItem should contain the key (key1, key2 or key3) when selected. The values (value1, value2 and value3) are the options as shown in the list.

  • Best practice - Pass data from Custom Comp to Another Custom Comp

    Hi, id like to know what would be the best practice to pass data from a custom component to another custom component. Right now I got these options:
    1st Component Custom Event - Main App - Public Properties 2nd Component
    1st Component Custom Event - Main App - Public Setter 2nd Component
    Is there another more directly way of doing it? or a better way?
    Thanks

    Hi, id like to know what would be the best practice to pass data from a custom component to another custom component. Right now I got these options:
    1st Component Custom Event - Main App - Public Properties 2nd Component
    1st Component Custom Event - Main App - Public Setter 2nd Component
    Is there another more directly way of doing it? or a better way?
    Thanks

  • One customer paying for another customer ....how is this handled in SAP

    Hi Gurus,
    Would appreciate if anyone can explain to me how SAP handles one customer paying for another customer.
    Scenario is Customer A owes us money but Customer B pays on his behalf.
    Subsequently, Customer B also pays for customer c,d, e,f etc...how do I set the relationship between customer B and all these other customers so that the payment flows automatically in SAP

    Thanks Srikanth
    How do I test the scenario...I want to see the final debits and credits happening on the paying customer and not the invoiced customer.

  • Using a custom tag inside another tag's attribute value?

    Hi all,
    I have a custom tag, mytag:link, whose use currently looks like this:<mytag:link path="/images/logo.gif"/>Nevermind what the tag does. Here's its TLD:<?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
        <tlib-version>1.1.1</tlib-version>
        <jsp-version>1.2</jsp-version>
        <short-name>My custom tags TLD</short-name>
        <tag>
            <name>link</name>
            <tag-class>test.MyLinkTag</tag-class>
            <body-content>empty</body-content>
            <description>...</description>
            <attribute>
                <name>path</name>
                <required>true</required>
                <rtexprvalue>true</rtexprvalue>
            </attribute>
        </tag>
    </taglib>I want to replace the path argument of the mytag:link tag to the result of the evaluation of another tag (a SiteMesh decorator tag) like this:<mytag:link path="<decorator:getProperty property="meta.logo"/>"/>This, of course, doesn't work, as I get the following error:org.apache.jasper.JasperException: /decorator.jsp(34,92) equal symbol expected
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:86)
         org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:193)
         org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:143)
         org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1328)
         org.apache.jasper.compiler.Parser.parseElements(Parser.java:1564)
         org.apache.jasper.compiler.Parser.parse(Parser.java:126)
         org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
         org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.opensymphony.module.sitemesh.filter.PageFilter.applyDecorator(PageFilter.java:156)
         com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:59) If I replace the call to the other tag with
    <mytag:link path="<%=someVariable%>"/>then it all works fine. This behavior seems correct, as the SiteMesh getProperty tag is writing its output to the Writer returned by pageContext.getOut() as it should. As such, this seems to be a design question, then. How are you supposed to do this?
    Thanks in advance,
    Matthew

    Note that I've also posted a question to the SiteMesh user forums about this. It has more information about the motivation of this question.
    See http://forums.opensymphony.com/thread.jspa?threadID=8561
    I'm still looking for an answer, though.
    --matthew                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • C:forEach tag inside another c:forEach tag

    Hi,
    I've got en error when I tried to use <c:forEach> inside another <c:forEach> to display a vector of String arrays.
    The error message is:
    javax.servlet.ServletException: The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.
    The concerned section of the javabean mybean.java is:
    //connect to database to get the resultset
    ResultSet rs = cst.getResultSet();
    if (rs != null) {
    myVector = new Vector();
    while (rs.next()) {
    String myArray[] = new String[10];
    myArray[0]=rs.getString(1);
    myArray[1]=rs.getString(2);
    myArray[9]=rs.getString(10);
    myVector.addElement(myArray);
    rs.close()
    The concerned jsp calling the bean is:
    <jsp:useBean id="theBean" scope="session" class="mybean" />
    <jsp:setProperty name="theBean" property="..." />
    <%
    Vector myVector=theBean.getResultFromDatabaseIntomyVector();
    pageContext.setAttribute("myVector",myVector);
    %>
    <table>
    <c:forEach var = 'vectorItem' items='${myVector}'>
    <tr>
    <c:forEach var = 'arrayItem' items='${vectorItem.value}'>
    <td><c out value='${arrayItem}'/></td>
    </c:forEach>
    </tr>
    </table>
    Can anyone show me what's the right jsp for displaying a vector of String arrays?
    Thanks in advance.
    Geraldine

    I think your problem is with the second forEach loop.
    The first for loop goes through the items in "myVector"
    Each item "vectorItem" should be of type String[]
    Accessing ${vectorItem.value} is what creates the error.
    JSTL converts this as
    vectorItem["value"] , can't turn the string "value" into an integer (to use as an array index) and thus throws an error.
    To fix: use ${vectorItem} rather than ${vectorItem.value}
    (nb you would use {vectorItem.value} if you were iterating over a Map, as the iterator exposes an object of type Map.Entry
    Also in your code, I only see one closing tag for a forEach.
    I think it should be like this (indented for readability)
    <table>
    <c:forEach var = 'vectorItem' items='${myVector}'>
    <tr>
      <c:forEach var = 'arrayItem' items='${vectorItem}'>
        <td><c out value='${arrayItem}'/></td>
      </c:forEach>
    </tr>
    </c:forEach>
    </table>Cheers,
    evnafets

  • Is it possible to write a doPost() method inside a doGet() method??

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class check extends HttpServlet
         protected void doGet ( HttpServletRequest rq, HttpServletResponse rp ) throws ServletException, IOException
              protected void doPost ( HttpServletRequest rq, HttpServletResponse rp ) throws ServletException, IOException
    }I tried the above code and failed. So, if someone could answer me, I'd be really grateful!
    Thanx in advance.

    I tried the above code and failed. So, if someone could answer me, I'd be really grateful!
    Thanx in advance.This code is simply illegal Java code. It has nothing to do with "doPost()" or "doGet()". Go back to school/books and carefully learn Java.
    If you want to write logic for GET requests, implement doGet(). If you want to write logic for POST requests, implement doPost(). Otherwise just leave it away. If you want GET and POST requests behave both the same (I have never had such an odd requirement, but that's another story .. you're the developer here), then just let them call both the same method. Add private void doSomething(req, res) and let the doGet() and doPost() call it. Simple, isn't it?

  • Using a custom Viewstack inside another gives an error

    Hi, can anybody tell me why using two custom ViewStacks components inside one another I get this (workspace log) error?
    "Custom component model has recursive definition: components.ViewStack"
    My component ViewStack.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ViewStack xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  xmlns:mx="library://ns.adobe.com/flex/mx" width="100%" height="100%">
    </mx:ViewStack>
    MyApplication.mxml
        <c:ViewStack id="views" >
            <c:ViewStack id="mainViews2" >   
            </c:ViewStack>
        </c:ViewStack>  
    Any combination involving the real mx:ViewStack works fine.
    Using FlashBuilder 4.5
    Thanks

    Thank you. This did the trick
    package components {
        import mx.containers.ViewStack;
        public class ViewStack extends mx.containers.ViewStack {
            public function ViewStack() {
                super();
                percentWidth = 100;
                percentHeight = 100;

  • Is it possible to use a seperate form inside another form?

    Hello-
    Creating a new hire vibe process. This process has many components, most of which only new hires need to complete. But there are other areas where both new hires and existing employees may need to complete. Completing a dental insurance application is an example. I currently have a dental insurance form, and a new hire form. Is it possible to add the dental insurance form within the new hire form? Under Layout Options I see an option for Form. I added it to my new hire form but it did not work
    Thanks
    Craig

    Craigcia,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • Prob when there is any HTML tag inside netui:label tag

    Hi,
    When i am displaying content in a script directly and if some HTML tag is there in the content like <b> or <i> tag then that particular property is reflected in the displayed content
    Eg: In code: <%=headline %>
    Headine=This is a <b><i>beautiful </i></b>flower
    Output: This is beautiful flower
    When I displayed same headline using <netui:label>
    Eg: In code: <netui:label value=”<%=headline %> ”>
    Headine=This is a <b><i>beautiful </i></b>flower
    Output: This is a <b><i>beautiful </i></b>flower
    So is there any workaround by which I can get same output(as for normal script) with <netui:label> tag
    Thanks

    Hi,
    When i am displaying content in a script directly and if some HTML tag is there in the content like <b> or <i> tag then that particular property is reflected in the displayed content
    Eg: In code: <%=headline %>
    Headine=This is a <b><i>beautiful </i></b>flower
    Output: This is beautiful flower
    When I displayed same headline using <netui:label>
    Eg: In code: <netui:label value=”<%=headline %> ”>
    Headine=This is a <b><i>beautiful </i></b>flower
    Output: This is a <b><i>beautiful </i></b>flower
    So is there any workaround by which I can get same output(as for normal script) with <netui:label> tag
    Thanks

  • Calling custom form from another custom form giving problem

    Hi
    my requirement is when i am populating value in one form field from LOV ,
    i wrote when-validate-item trgger
    this trigger calls in turn another form for approval
    so i use the following command in trigger
    DECLARE
    -- variable added by deepak on 16-05-2006 starts here
         --to make PROF_description enterable
         L_PROF_TERM_WARNING_AMNT NUMBER;
         L_PROF_TERM_AMNT NUMBER;
         L_PROF_DEPOSIT_PAID NUMBER;
         L_AUTORIZATION VARCHAR2(1);
         --variable added by deepak on 16-05-2006 ends here
         --code added by deepak on 16-05-2006 starts here
         BEGIN      
                        BEGIN
                             SELECT PROF_TERM_WARNING_AMNT ,PROF_TERM_AMNT ,PROF_DEPOSIT_PAID ,AUTORIZATION
                             INTO L_PROF_TERM_WARNING_AMNT,L_PROF_TERM_AMNT,L_PROF_DEPOSIT_PAID,L_AUTORIZATION
                             FROM XXPOS_CUSTOMER_PROFILES_GTB XCP
                             WHERE XCP.PROF_DESCRIPTION = :POSTPAID_DET.PROF_DESCRIPTION;
                        END;
                        BEGIN
                        IF L_AUTORIZATION ='Y' THEN
                             :GLOBAL.auth_user_id := NULL;
                             FND_FUNCTION.EXECUTE( FUNCTION_NAME=>'XXAUTHSC',
    OPEN_FLAG=>'Y',
    SESSION_FLAG=>'NO_SESSION',
    OTHER_PARAMS=>NULL,
    ACTIVATE_FLAG=>'ACTIVATE',
    BROWSER_TARGET=>NULL);
                        IF :GLOBAL.auth_user_id is not null THEN
                             :POSTPAID_DET.PROF_TERM_WARNING_AMNT := L_PROF_TERM_WARNING_AMNT ;
                        :POSTPAID_DET.PROF_TERM_AMNT := L_PROF_TERM_AMNT ;
                        :POSTPAID_DET.PROF_DEPOSIT_PAID := L_PROF_DEPOSIT_PAID ;
                        ELSE
                             RAISE Form_Trigger_Failure;
                        END IF;
                        ELSE
                        :POSTPAID_DET.PROF_TERM_WARNING_AMNT := L_PROF_TERM_WARNING_AMNT ;
                        :POSTPAID_DET.PROF_TERM_AMNT := L_PROF_TERM_AMNT ;
                        :POSTPAID_DET.PROF_DEPOSIT_PAID := L_PROF_DEPOSIT_PAID ;
                        END IF;
                        END;
              END;
    but while running it is giving error:
    it is not popup the desired second window and displaying following error
    Illegalrestricted procedure OPEN_FORM in when-validate-item trigger
    IF anyone has any idea on this, it will bw highly appreciated.
    regards
    deepak

    You can use a timer in your when-validate-item trigger. In the when-timer-expire trigger you can call the procedure open_form

  • How to do a jsp:include inside a noscript tag??

    I am new to JSP and I need help to do a <jsp:include page="pageName" /> inside a <noscript> tag. My goal is to include another jsp if the user has javascript disabled on its browser.
    I am using a JSP template that retrieves content from the Database, so I need to pass a parameter also, like:
    <noscript>
    <jsp:include page="/include/template.jsp" flush="true"/>
         <jsp:param name="pageName" value="holidays_onboard_html"/>
    </noscript>
    My code doesn't seem to work. I found an explanation that says that the noscript tag is interpreted after the servlet already tried to compose the original page, so I can't use a <jsp:include> tag inside the noscript tag. Is it true? Is there any other solution for what I am trying to accomplish?
    Thanks a lot!

    Java indeed runs at the server side, not at the client side. Java runs at the server side and produces a HTML page. HTML only runs at the client side.
    The <noscript> tag is not a Java/JSP tag, it is a HTML tag. What you want is only possible when you checked in Java if the client has JS enabled, e.g. using a request parameter, or by loading the page template using a HTML tag, e.g. <iframe>.

Maybe you are looking for

  • Empty space check for text box

    i need to verify null check for textbox fields and it sould not allow spaces as well.... is there any way like trim functions.. please help me.. Already tried with JavaScript's trim() and not working... I'm using es3

  • Apps frozen wont download

    3xapps frozen for days,  just showing message "waiting" how do I get them going again

  • How to Make ASCP to consider Primary/Substitude Components First, then Primary/Substitude PO/PR?

    Let's say, in finished good A, component C is the substitude of component B. Assuming the usage of both components in A is 1 unit. Finished Good A: Demand: 100 Primary Component B Onhand Qty :  20 PO: 20 Substitude Component C Onhand Qty: 10 PO: 10 H

  • Exporting a Slideshow with Titles

    Hi, Does anyone know if it is possible to export a slideshow from iMovie including the picture titles, but with the titles appearing as Subtitles on the DVD so that you could turn them on or off?? Seems like a simple thing but i have a feeling it can

  • Logic 9, snow and project mix

    I can make it crash at will all i have to do is work for a bit and go to file and boom, done i have to save using my key commands I also keep getting the error message syncing midi to external device no doubt maudio needs to update