Using TAG Attributes within JSF Tags

I'm using some .tag files for templating purposes. I'm using two tag attributes via <@% attribute %> directive. How can i access this attribute to do something like follows.
<%@ tag display-name="Area de Trabajo" language="java" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>
<%@ attribute name="title" required="true"%>
<%@ attribute name="location" %>
<t:div styleClass="zonaArea#{(not empty location) ? location : 'Global'}">
  <h:panelGrid columns="1">
    <h:outputText value="#{title}" />
  </h:panelGrid>
  <jsp:doBody />
</t:div>

Hola Alberto.
Any luck? Did you worked that around?
I'm just trying to do the same thing...
Tried to do something like:
<%@attribute name="enabled" type="java.lang.String" %>
<h:outputText value="test: #{requestScope['enabled']}" style="font-weight: bold;" /> to no avail...
Let me know, please!
Hi,
Manrico

Similar Messages

  • Use request attributes in JSF

    Is there a way we can pass data from one form bean to the other using request attributes insted of session attributes?
    I am able to work with session attributes using
    HttpSession mySession = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true); and setting attributes to it, but getting null pointers(occassionally) when I retrieve the atribute and work with it.
    getSession(false) isnt helping either.
    Looks like facesServlet is creating a new request when it forwards to next page. Any idea on how to get the Faces Servlet do something like request despatcher forward, for navigation so I can work with request attributes?
    Appreciate your input.

    Can I have just one backing bean and use it for all jsps in the app? App has 4 flows from home page and mutiple jsps in each flow. Each jsp has multiple form fields. Is that OK?
    Any way to passing data/objects between different backing beans - other than using session attributes? I had similar problems working on Struts app as well.

  • Using JSPWiki Servlet within JSF

    I have got the fundamentals of my JSF webApp working
    Now I want to incorporate a JSPWiki page within my JSF page
    What is the best way of sorting this out
    I have been thinking along the lines of creating an application scope managed bean in which I can initalise a WikiEngine reference
    public static WikiEngine getInstance(javax.servlet.ServletContext context,
    java.util.Properties props)
    OR
    public static WikiEngine getInstance(javax.servlet.ServletConfig config,
    java.util.Properties props)
    How do I obtain ServletContext for the WikiEngine from inside my JSF ManagedBean
    Obviously my web.xml has
    <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    and
    <servlet>
    <servlet-name>WikiServlet</servlet-name>
    <servlet-class>com.ecyrd.jspwiki.WikiServlet</servlet-class>
    </servlet>
    But I can't find anything in the JSF Javadocs that is the equivalent of
    public ServletContext getServletContext()
    in the Servlet APIs
    I'd appreciate some clues
    Thanks

    Try this to get the ServletContext in your ManagedBean:
    FacesContext facesCtx = FacesContext.getCurrentInstance();
    ExternalContext extCtx = facesCtx.getExternalContext();
    ServletContext servletCtx = (ServletContext) extCts.getContext();I think that will do it.

  • Read from a .db file and use the values within a program

    each account has 3 values.. (password, balance,id_number)
    my .db file contains the following.
    pass201 250 9885 pass202 300 5547 pass203 700 1123
    (this is 3 accounts)
    I need to be able to read from this file and use each attribute within my program... HELP!

    String[][] accounts = null;
    try
         // Open a file input stream
         FileInputStream fileContents = new FileInputStream("filename");
         byte[] data = new byte[fileContents.available()];
         fileContents.read(data);
         fileContents.close();
         String contents = new String(data);
         StringTokenizer values = new StringTokenizer(data); // using space character as delimiter
         // Using 3 values per line
         int lines = (int)(values.countTokens()/3);
         int columns = 3;
         accounts = new String[lines][columns];
         for(int i=0; i<lines; i++)
              for(int j=0; j<columns; j++)
                   accounts[i][j] = values.nextToken();
    catch(Exception error)
         // debug stuff
    }

  • Using jsp variables within JSP tag

    I have a variable defined within a JSP:
    <%
    String cust_id = request.getParameter("cust_id");
    %>
    I want to use this variable as a parameter to a custom tag:
    <%@ taglib uri="/tlds/DBTags.tld" prefix="db" %>
    <db:MultiColumnSelect columns="c.id, c.po" name="ccar_id" table_name="ccar_headers c, ccar_rmas r" selectString="r.ccar_id = c.id AND c.cust_id = <%= cust_id %>"/>
    The selectString value that is passed to my tag is:
    r.ccar_id = c.id AND c.cust_id = <%= cust_id %>
    The <%= cust_id %> is not replaced by the actual variable value.
    How would I accomplish using this variable within my JSP tag?

    Your definition of the selectString attribute must indicate that it can accept runtime expressions.
    <%
    String cust_id = request.getParameter("cust_id");
    String selectString = new String("r.ccar_id = c.id AND c.cust_id = " + cust_id);
    %>
    <%@ taglib uri="/tlds/DBTags.tld" prefix="db" %>
    <db:MultiColumnSelect columns="c.id, c.po" name="ccar_id" table_name="ccar_headers c, ccar_rmas r"
    selectString="<%= selectString %>"/>

  • Pass two parameters using extraParams attribute in protlet:createWebFlowURL tag

    Ho do I pass two parameters using extraParams attribute in portlet:createWebFlowURL?

    <portlet:createWebFlowURL event="RTFM" extraParams="read=manual&do=you">
    "Linda" <[email protected]> wrote:
    >
    Ho do I pass two parameters using extraParams attribute in portlet:createWebFlowURL?

  • Bolding rows in RTF template using tags

    In an rtf template, is there a way to bold an entire row in the table using tags rather than building two rows (one bold, one unbold) and put them in a if condition?
    if
    [BOLD ROW]
    else
    [UNBOLD ROW]
    end if

    This should do it
    <?if@row:number(EMPNUM)=10003?>
    <?attribute@incontext:font-weight;'bold'?>
    <?end if?>
    slot this into a cell on the table row
    Tim

  • Moving Pages using Tags

    I have always found moving pages around in Acrobat documents to be a pain. I thought I might be able to use tags or some other form of document structure to move pages around.
    In the help section related to tagging, the help states:
    Add tagged bookmarks
    Tagged bookmarks give you greater control over page
    content than do regular bookmarks. Because tagged
    bookmarks use the underlying structural information of the
    document elements (for example, heading levels,
    paragraphs, table titles), you can use them to edit the
    document, **such as rearranging their corresponding pages in
    the PDF**, or deleting pages. If you move or delete a parent
    tagged bookmark, its children tagged bookmarks are
    moved or deleted along with it.
    However, under the page movement help section, it states
    Move or copy a page
    You can use page thumbnails to copy or move pages within
    a document and between documents.
    When you drag a page thumbnail in a Pages panel, a bar
    appears near other thumbnails, indicating the position in
    which it will appear in the PDF. This bar appears at the
    bottom or top when the thumbnails are in a single column,
    or to the left or right if more than one column of
    thumbnails is displayed.
    Note: Tagged bookmarks affect the order that reading
    devices follow, such as devices for the visually impaired.
    Tagged bookmarks do not change the sequence of pages in
    a PDF.
    Is there really a way that you can move actual pages around in a document in a structure way, rather than just crudely selected a range of pages in the pages view?
    Mark

    I am using Adobe Acrobate Pro 7.0.

  • Using Tags, Can i Search for Multiple Tags in One Search Folder?

    Hi forum,
    i would like to set a Search Folder and search using Tags. I would liek to use one such folder and search for everythign i haver tagged last week. How cna i search for 'TAG A' and 'TAG B' in one Search Folder?

    Hi mumbles2701,
    All you need to do is to briefly type in your tag in the search bar and in the drop down menu, you should be able to select a tag, press enter and just repeat this process for as many tags as you like
    Hope I helped!

  • Error in using tag library

              I am using Weblogic server 8.1 and have a struts app. I am using the random taglib
              from jarkarta and recieving this error while using weblogic. With the same setup
              in tomcat everything works fine. What do I need to do special for weblogic?
              ERROR FROM WEBLOGIC
              /control/register/newMember.jsp(1): Error in using tag library uri='http://jakarta.apache.org/taglibs/random-1.0'
              prefix='randME': For tag 'string', cannot load extra info class 'org.apache.taglibs.random.RandomStrgTEI'
              probably occurred due to an error in /control/register/newMember.jsp line 1:
              <%@ taglib uri="http://jakarta.apache.org/taglibs/random-1.0" prefix="randME"
              %>
              taglibs-random.jar is in WEB-INF/lib
              random.tld is in WEB-INF
              the taglib include in my jsp looks like this:
              <%@ taglib uri="http://jakarta.apache.org/taglibs/random-1.0" prefix="randME"
              %>
              the call in my jsp looks like this:
              <randME:number id="random1" range="10000000-99999999"/>
              my web.xml looks like this:
              <taglib>
              <taglib-uri>http://jakarta.apache.org/taglibs/random-1.0</taglib-uri>
              <taglib-location>/WEB-INF/random.tld</taglib-location>
              </taglib>
              any help would be appreciated
              

    This may not solve your problem, but WL8.1 SP1 seems to have a problem with
              closing tags.
              Where you are using:
              <randME:number id="random1" range="10000000-99999999"/>
              ...try this instead:
              <randME:number id="random1" range="10000000-99999999"></randME:number>
              This problem is fixed in SP2.
              -- Craig
              "ssandy" <[email protected]> wrote in message news:[email protected]...
              >
              > I am using Weblogic server 8.1 and have a struts app. I am using the
              random taglib
              > from jarkarta and recieving this error while using weblogic. With the
              same setup
              > in tomcat everything works fine. What do I need to do special for
              weblogic?
              >
              > ERROR FROM WEBLOGIC
              >
              > /control/register/newMember.jsp(1): Error in using tag library
              uri='http://jakarta.apache.org/taglibs/random-1.0'
              > prefix='randME': For tag 'string', cannot load extra info class
              'org.apache.taglibs.random.RandomStrgTEI'
              > probably occurred due to an error in /control/register/newMember.jsp line
              1:
              > <%@ taglib uri="http://jakarta.apache.org/taglibs/random-1.0"
              prefix="randME"
              > %>
              >
              > taglibs-random.jar is in WEB-INF/lib
              > random.tld is in WEB-INF
              >
              > the taglib include in my jsp looks like this:
              > <%@ taglib uri="http://jakarta.apache.org/taglibs/random-1.0"
              prefix="randME"
              > %>
              >
              > the call in my jsp looks like this:
              > <randME:number id="random1" range="10000000-99999999"/>
              >
              > my web.xml looks like this:
              > <taglib>
              > <taglib-uri>http://jakarta.apache.org/taglibs/random-1.0</taglib-uri>
              > <taglib-location>/WEB-INF/random.tld</taglib-location>
              > </taglib>
              >
              > any help would be appreciated
              

  • Error in using tag library uri='weblogic.tld'

    Hmmm...
    I'm trying to config my userprofile by creating it in the tools application (myserver/tools/index.jsp),
    but when I try to access the Unified Profile Types I get an Error 500 Internal
    Server Error in my webbrowser. The weblogic.log prints out an errormessage that
    sounds something like this:
    ####<30-Aug-01 16:30:14 CEST> <Error> <HTTP> <Ast-WT01> <server01> <ExecuteThread:
    '14' for queue: 'default'> <system> <> <101020> <[WebAppServletContext(3530676,tools)]
    Servlet failed with Exception>
    weblogic.servlet.jsp.JspException: (line 24): Error in using tag library uri='weblogic.tld'
    prefix='wl': For tag 'repeat', cannot load extra info class 'weblogicx.jsp.tags.RepeatTagInfo'
    I'm running weblogic 6.0 and wlcs 3.5. I'm sure of that the tag libraries are
    correct and they are located under tools/web-inf.

    Hmmm...
    I'm trying to config my userprofile by creating it in the tools application (myserver/tools/index.jsp),
    but when I try to access the Unified Profile Types I get an Error 500 Internal
    Server Error in my webbrowser. The weblogic.log prints out an errormessage that
    sounds something like this:
    ####<30-Aug-01 16:30:14 CEST> <Error> <HTTP> <Ast-WT01> <server01> <ExecuteThread:
    '14' for queue: 'default'> <system> <> <101020> <[WebAppServletContext(3530676,tools)]
    Servlet failed with Exception>
    weblogic.servlet.jsp.JspException: (line 24): Error in using tag library uri='weblogic.tld'
    prefix='wl': For tag 'repeat', cannot load extra info class 'weblogicx.jsp.tags.RepeatTagInfo'
    I'm running weblogic 6.0 and wlcs 3.5. I'm sure of that the tag libraries are
    correct and they are located under tools/web-inf.

  • Importing URLs using tagged text

    I'm trying to import tagged text with URLs into InDesign. InDesign sees the links, but does not seem to know that the links are URLs (rather than text anchors or page links). I have nearly 1500 hyperlinked pieces of text I want to import, so I can't manually create Destination Definitions for all of them. When I try to send definitions in using tagged text, InDesign (CS2) crashes. Any help very much appreciated.

    There are many ways of "tagging" information in an InDesign document. For what you're doing, I'd suggest a unique paragraph style used only for this purpose, then you can search for text in it and use the contents.
    Dave

  • Justifications needed for using tags in JSP, Please reply

    Hi forum
    My question is to those java people who have also done JSP. I m sound in java server side (servlet programming), now I have asked by my project manager to do server side programming in JSP using tagLibraries (as these are used by those ppl who didnt have much java knowledge). I have worked inserver side java, then my question is y should I start working on tags,
    On the other hand I can do all the work in java embedding in JSP (on some extent, seperated by diffrent helper/util classes to reduce the thickness of JSP page).
    so I want to ask u ppl that should a java programmer needs to use tag libraries to code a JSP page, however he can code it in java directly.
    I will feal great pleasure if u will write ur opinions and help me to ease my life.
    thanx in advance
    Best Regards
    Tahir

    You should use tag libraries whenever you can because:
    1) They increase code re-useability. You can insert the same tag in many pages using just a few lines to do complex tasks, as opposed to writing a lot of scriptlet code in each JSP.
    2) Enhance your ability to seperate logic from display. Everything in your tags is logic. Everything in your JSP is display - with the tags bridging the logic to the display.
    3) Make the JSPs cleaner and easier to maintain. They read easier with tags than with a lot of scriptlets. Non-java people can be used to update the look and feel of the web page, or to debug the HTML later on, relieving the Java programmers for the tag work, or other jobs more suited to them.
    4) Your boss said to do tags, so do tags.

  • Weblogic.servlet.jsp.JspException: (line 1): Error in using tag library uri

    Previously my web app was running fine using eclipse 3.1
    When I upgraded my eclipse to 3.2 then built the same web app and deployed, upon running the url i got error
    weblogic.servlet.jsp.JspException: (line 1): Error in using tag library uri='/tags/css' prefix='css' : cannot find tag class
    Your help is appreciated.

              Hi Guys
              Problem is almost certainly because I've gone and defined the get as returning
              an int, (hence no property!)
              Apols
              J
              

  • Problems with JSP - using tag library with Weblogic 8.1

    I am getting the following error when I try to run a web application called "regain":
    /searchinput.jsp(2): Error in using tag library uri='regain-search.tld' prefix='search': cannot find tag class: 'net.sf.regain.ui.server.taglib.MsgTag'
    probably occurred due to an error in /searchinput.jsp line 2:
    <%@taglib uri="regain-search.tld" prefix="search" %>
    The classes that the .tld file points to are in the web applications WEB-INF/classes directory and I have put this path into my classpath environment variable (running Windows 2000 Server).
    This application runs fine on Tomcat.
    I can't not figure out whether is error is masking another error or what. I've tried using JDK and Jrockit for my web app - no luck.
    Please help! Thanks!

    anyone? :/

Maybe you are looking for