JSF - outputLink attribute

Hi all,
I have one JSF page that contains some outputLink elements. Each of the elements points to page that should get parameter passed by the previous JSF page.
I have read an article how to pass that parameters by using the URL ( http://localhost:8080/MyProg?MyParam=sample) but I do not want use method.
I have tried to create an attribute and pass it to the bean but without success.
Can you tell me how I can pass parameter from outputLink element to the next page?
Thanks in advance.

Use h:commandLink. It will create a POST request instead of GET request (which you don't want to use).

Similar Messages

  • JSP ${} expressions in JSF tag attributes

    Does anyone know why the expert group decided not to allow ${} style expressions within JSF tag attributes? I understand that a different syntax is needed to implement the 'late binding' #{} expressions used to link input controls to form beans, but not why the JSF tags actually prevent the use of immediately evaluated ${} expressions for accessing variables in the page scope in JSP 2.0.
    I know there has been a lot of discussion about this and other threads mention a security loophole that would be opened up by allowing expressions like #{blah.${someProperty}}, but I'm not sure why this sort of thing would cause a problem. Is there any way to enable this behaviour, such as editing the JSF tag library descriptors to allow runtime expressions (horrible though that sounds)? Or perhaps another JSF implementation that supports both immediately evaluated and late-binding expressions? It seems a rather unnecessary restriction that is going to cause much confusion and mistyping for all...
    Thanks in advance,
    Keith.

    Thanks Adam, I see the problem now. It's a fairly obscure loophole but serious nonetheless. Of course, this problem could also be avoided by not using request parameters within JSF tags as it doesn't affect the majority of legitimate uses for expressions.
    I have to disagree with you about mixing ${} and #{} expressions though. The majority of developers will be used to writing ${} expressions in JSTL and JSP text and so will expect them to do work the same in JSF tags. Judging by the number of posts in this forum about being unable to use page scope variables in JSF tags this issue is already confusing a lot of people.
    As a rule of thumb, "use ${} for expressions that are output to the page and #{} for binding controls to backing beans and invoking methods" (which perform clearly distinct functions) is a lot simpler and easier to learn IMHO than the current one, which is "use ${} for expressions that are output to the page except within a JSF tag, where you use #{} for the same thing and also to update form values and invoke action methods"! (OK, I'm exaggerating a little for effect, but you get the point... :-)
    I agree that mixing both types of expression in the same attribute might be a little confusing, but this is an unlikely edge case that should probably be prevented in value binding or action attributes anyway. It's more of an issue for label values where mistyping one for the other is already very common and, although not especially difficult to debug, is just another pitfall awaiting the unwary JSP developer. I'm not sure that JSP expressions would be much more difficult to debug anyway as the value and method bindings will simply not work, which is pretty obvious as soon as you try and test the thing.
    Is this something that the EG would be prepared to reconsider for the next release of JSF, or perhaps getting the security loophole addressed in the next JSP spec? In the meantime, is there any reason that developers shouldn't enable runtime expressions in the TLD file provided that they're willing to live with the consequences?
    (Sorry to harp on about it, but I've already had several complaints about this after recommending JavaServer Faces for a major development project at ingenta.com.)
    Many thanks,
    Keith.

  • Tomcat and refreshing jsf component attributes in the browser

    I'm using Eclipse and Tomcat 5.0.25. I start Tomcat in debug mode with a shortcut: "C:\Tomcat-5.0\bin\catalina.bat jpda start". I have an entry in the Tomcat server.xml file that points to my web application:
    <Context debug="0" docBase="C:\MyProjects\eclipse\cdstore\WebContent" path="/cdstore" reloadable="true"/>
    I have a jsp page with a jsf dataTable tag. If I change the html markup (i.e. by typing "hello" in the jsp page) and press the refresh button in my IE 6.0 browser, the "hello" message is displayed.
    If, however, I change the content of a dataTable attribute (i.e. I change styleClass="aClass" to styleClass="anotherClass") or add a new dataTable attribute, the attribute changes are not sent to the browser when I press the browser refresh button. I do a "view html source" and they are not there.
    I have to close the browser down and relaunch the browser to see the new dataTable attributes.
    Does anybody know if there is any easier way of doing this?
    thanks, jeff

    Hi pushpa latha
    Yes it is possible to update the data at the header level using below approach
    create the component interface for your cusotm component
    use the component interface  in the header overview standard component as resuable component.
    Implement the event handler method for the button , in the event handler method get the refreshed value
    create the navigation and call the navigation (fire_outbond_plug) to cutom component by passing the plug name and refreshed data..
    set the refreshed data to your value node in your custom component.
    Thanks & Regards
    Raj

  • JSF outputLink

    Hi all,
    I have been trying to link an external URL from within the portlet. We are using JSF portlet framework and Im using <hx:outputLinkEx/> tag to render the URL. Unfortunately the URL is being prepended with some stuff. For example, I m having a backing bean and a property named link which is binded to the output link tag. The following output resulted when I tried to render the URL.
    The link property is a String
    <h:outputLink id="link2" value="#{myBean.link}">
    <h:outputText id="outputText4" value="#{myBean.link}"></h:outputText>
    </h:outputLink>
    Output:
    <TD>
    <a id="viewPC_7_0_12F_:table1:0:link2" href="http://localhost:9081/wps/PA_1_0_IR/http://yahoo.com">
    <span id="viewPC_7_0_12F_:table1:0:outputText4">http://yahoo.com</span>
    </a>
    </TD>
    Has anyone encountered this problem before or are there any workarounds for this problem? I also tried to use <h:outputLink/> but invain.
    Help would be greatly appreciated.
    Thank u
    -Sri

    any clues or ideas

  • How do I use the ? operator in JSF tag attributes?

    I want to do something like this:
    <h:inputText styleClass="${myBean.valid ? 'styleA' : styleB'}" ...>
    What do I have to do to use this Expression language?
    With the #{...} expression the ? operator doesnt seem to be available.
    When I use the ${...} expression I am getting this error:
    javax.servlet.ServletException: ServletException in '/WEB-INF/body/Test.jsp': /WEB-INF/body/Test.jsp(12,5) According to TLD or attribute directive in tag file, attribute styleClass does not accept any expressions
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
    Can anybody please help?
    Thanks!

    Personally, i'd do:
    <h:inputText styleClass="styleA" rendered="#{myBean.valid}"/>
    <h:inputText styleClass="styleB" rendered="#{!myBean.valid}"/>

  • Pass arguments to JSF tag attributes like id oder value

    Hi!
    I started with JSF some weeks ago and have some questions that i could not find in FAQ or tutorials.
    My page structure uses some <jsp:includes>. Each included page uses JSF.
    The structure is (example - users):
    Users.jsp
    |
    |(incl)
    |
    Mainpage.jsp (=Framework)
    |
    |(incl)
    |
    Browser.jsp (=Table)
    In "Users" all specific data is set. In "Browser" there is a <h:form> tag and a <h:dataTable> tag.
    The result should be a simple table with users inside.
    So I want to pass arguments to those sub-pages.
    1) -> form-ids as parameter:
    <h:form id="#{sessionScope.formName}">
    ... does not work, because ids have to start with a character or "_".
    formName is set as followed:
    session.setAttribute("formName", "form_users");
    2) ->beans as parameter:
    <h:dataTable id="browser_table_#{sessionScope.id}" styleClass="browser_table"
    var="user" value="#{sessionScope.user_list}">
    ... does not work. "id" is requested to be a static value and "value" can't find the bean by this string.
    user_list is set as followed:
    session.setAttribute("user_list", "UserListBean.users");
    (UserListBean.users is an ArrayList)
    Is there an error in my thinking? Or is there a way to pass arguments as i want?
    Thanks!

    sorry ... mistake in topic: "oder" = "or" of course :)

  • Using EL in JSF

    Hello,
    maybe a stupid question but I asked myself why I can't use the $ symbol when using EL in JSF. Can somebody tell me the difference between using # or $ when writing EL in JSP/JSF
    Thx
    Chris

    Yes, it very depends.
    JSF 1.1 and JSP2.0 have their own EL. They do not understand each other.
    #{} uses only for jsf tag attributes. You cannot able to use it outside (Except with Facelets, but it is not about JSP at all).
    In contrast, ${} cannot be used inside the JSF tag attributes.
    JSF1.2 and JSP2.1 use unified EL. Now, you can use them both everywhere on the page, but the major difference still exists.
    ${} is a immediate EL
    #{} is a deferral EL
    #{} orginizes binding instead of immediate replacement. You can use #{} as an L-Value expression.
    For more information read this article:
    http://today.java.net/pub/a/today/2006/03/07/unified-jsp-jsf-expression-language.html

  • ADF ProcessScope -- I get a new AdfFacesContext on each page load

    I am trying to store some variables in the ADF processScope. But the next time the page is loaded and calls the managed bean methods, the AdfFacesContext is different, and so the processScope is empty. The managed bean is session scope, and I am setting the processScope variables in the bean's Java code.
    In particular this happens when I click on the af:table pagination links, e.g. the "next 25".
    How can I get access to the same AdfFacesContext (and therefore the same processScope) the next time the page loads and calls the managed bean?
    I am using JDeveloper 10.1.3.3.0.
    Here is the example code, and the output that is produced from my System.out.println statements:
    ========== Controller.java (session scope managed bean) ===============
    package adfproject;
    import java.util.Map;
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import oracle.adf.view.faces.context.AdfFacesContext;
    public class Controller {
    private List<Map> list = new ArrayList<Map>();
    private String label;
    private static int counter;
    public Controller() {
    // initialize list with Map objects
    for ( int i = 1; i<10 ; i++) {
    Map map = new HashMap();
    map.put("A","first column");
    map.put("B", "row " + i);
    list.add(map);
    // called from JSP to initialize the ECO bean
    public String getLoad() {
    printAdfProcessContext("in getLoad");
    // get value from current process scope
    String currentLabel = (String)getProcessAttribute("LABEL");
    // print currentLabel
    System.out.println("current LABEL = "+currentLabel);
    // if currentLabel null, build new one with counter, incr counter
    if (currentLabel == null) {
    label = "xyz " + ++counter;
    System.out.println("new LABEL: "+label);
    // remember the current label in the process scope, and in member
    setProcessAttribute("LABEL",label);
    return ""; // empty string so nothing is displayed on web page
    public static void printAdfProcessContext(String label) {
    AdfFacesContext afCtx = AdfFacesContext.getCurrentInstance();
    System.out.println("============ "+label+" ===========");
    System.out.println("AdfFacesContext = "+afCtx);
    Map ps = afCtx.getProcessScope();
    System.out.println("Process scope = "+ps);
    * Get attribute from ADF "processScope".
    * This is a special scope provided by ADF which is in between Session
    * and Request.
    * @param name attribute name
    * @return
    public static Object getProcessAttribute(String name) {
    AdfFacesContext afCtx = AdfFacesContext.getCurrentInstance();
    return afCtx.getProcessScope().get(name);
    * Add or overwrite attribute in ADF "processScope".
    * This is a special JSF "scope" provided by ADF Faces which is somewhere
    * between Session scope and Request scope. It can be accessed in JSF
    * pages using the EL expression #{processScope.myAttribute}.
    * @param name attribute name
    * @param value attribute value
    * @return
    public static void setProcessAttribute(String name, Object value) {
    AdfFacesContext afCtx = AdfFacesContext.getCurrentInstance();
    afCtx.getProcessScope().put(name,value);
    public String getLabel() {
    return label;
    public List<Map> getList() {
    return list;
    ============= jsftest.jsp =====================
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <f:view>
    <afh:html>
    <afh:head title="ADF Context Test">
    <meta http-equiv="Content-Type"
    content="text/html; charset=windows-1252"/>
    </afh:head>
    <afh:body>
    <h:form>
    <af:outputText value="#{controller.load}"/>
    <h:panelGrid columns="2">
    <af:outputLabel value="LABEL"/>
    <af:outputText value="#{controller.label}"/>
    <af:outputLabel value="Map"/>
    <af:table emptyText="No items were found" value="#{controller.list}"
    var="row" rows="4">
    <af:column sortable="false" headerText="A" formatType="text">
    <af:outputText value="#{row.A}"/>
    </af:column>
    <af:column sortable="false" headerText="B" formatType="text">
    <af:outputText value="#{row.B}"/>
    </af:column>
    </af:table>
    </h:panelGrid>
    </h:form>
    </afh:body>
    </afh:html>
    </f:view>
    ================= Console Output when page loads initially ==================
    08/09/03 15:27:18 ============ in getLoad ===========
    08/09/03 15:27:18 AdfFacesContext = oracle.adfinternal.view.faces.context.AdfFacesContextImpl@101751
    08/09/03 15:27:18 Process scope = ProcessScopeMap@7009019[_map={}, token=null,children=null]
    08/09/03 15:27:18 current LABEL = null
    08/09/03 15:27:18 new LABEL: xyz 1
    ======= Console Output when I click the "next 4" link on the table, and the page reloads ========
    08/09/03 15:32:42 ============ in getLoad ===========
    08/09/03 15:32:42 AdfFacesContext = oracle.adfinternal.view.faces.context.AdfFacesContextImpl@16bf9ce
    08/09/03 15:32:42 Process scope = ProcessScopeMap@31287037[_map={}, token=null,children=null]
    08/09/03 15:32:42 current LABEL = null
    08/09/03 15:32:42 new LABEL: xyz 2
    ====== Comments =========
    As you can see above, the AdfFacesContextImpl object has changed, so I have lost the ProcessScopeMap.
    Also, on the displayed page, the label is still "xyz 1" instead of changing to "xyz 2".
    Thanks for your help,
    JbL

    Thanks for the idea, Murph.
    I didn't need a session scope bean, request would be fine, I just was trying to make something work that would allow me access to the process scope attributes. I want to allow multiple browser windows searching on different objects independently, so I don't want to use session scope.
    I tried removing the variable declaration and setting/getting the processScope attribute in the setter/getter methods, to make the process scope attributes independent of the managed bean. But each time the page loads (by clicking the table navigation links), I still lose the process scope attributes. I tried with both session and request scope beans. Either way, in the getLoad() method, when I try to get the label from the process scope (using the new version of getLabel()), it is null.
    So the root problem is still there.
    For continued discussion on this more specific problem, see my separate thread "JSF ProcessScope attribute missing on page reload from af:table pagination"
    at JSF ProcessScope attribute missing on page reload from af:table pagination

  • How to set hidden field value in form?

    I've encountered a problem while developing a forum using JSF. See this code:
    <h:form id="commmentForm" formName="commentForm" >
         <h:input_hidden id="pageId" valueRef="CommentBean.pageId" value="${article.id}"/>
         <h:input_text id="userName" valueRef="CommentBean.userName"/>
         <h:input_text id="userEmail" valueRef="CommentBean.userEmail"/>
         <h:input_text id="userURL" valueRef="CommentBean.userURL"/>
         <h:input_textarea id="content" valueRef="CommentBean.content"/>
         <h:command_button id="submit" label="Leave A Comment" commandName="submit" actionRef="CommentBean.createAction" />
    </h:form>
    I was trying to specify a hidden field that represents the unique ID number of the current article using <h:input_hidden> tag above. But RI complains that runtime expression is not permitted in 'value' attribute. So I set the attribute 'value' to arbitrary number such as '2', but it seems that CommentBean.pageId is still null.
    So the question is:
    1. Why can't I use EL in JSF tags attributes?
    2. How can I resolve my problem mentioned above?
    Thanks very much in advance!

    To solve the problem, you have to use two hiddenfields, say:
    <h:input_hidden id="pageId"valueRef="CommentBean.pageId" />
    <h:input_hidden id="articleId" valueRef="article.id"/>
    I want to set the value of CommentBean.pageId to
    ${article.id} (article is not a managed bean) and to
    let CommentBean.createAction insert a database row
    whose page_id column is ${article.id}, so I think the
    tags you suggested won't work for me.Why can't you interrogate your ComponentBean for its pageId property during your invoke() method? By the time your invoke() method is called, the value from the hidden field will have been pushed to the model, so this should be no problem. You could do Application.getValueBinding("ComponentBean.pageId").getValue() to do so.
    Ed

  • JSV-Validation discards some backing bean properties

    Hi guys,
    I'm facing a curious problem occuring in my jsf-application. I have a userlist on my page. Every user can be edited (change password, etc) or a new user can be created. When I click the "edit-user"-button, a new page is opened where I can change different properties of this user. When I submit the form, the jsf-validation is beeing called (because I set some properties to attribute "required"). When an error occurs, the action-command returns null and goes back to the page. But not all properties of my backing bean arent set! It seems, that only the properties beeing set to attribute "required" are saved... How can I fix this?
    My jspx-page that creates/updates a user looks like that:
    <h:form>
         <h:inputHidden value="#{userFormBean.userID}" />
         <h:panelGrid border="0" columns="2" style="margin-bottom:15px;">
              <h:outputLabel value="#{msg['ui.user.create.lastname.label']}:" />
              <h:inputText value="#{userFormBean.name}"
                              required="true"
                              label="#{msg['ui.user.create.lastname.label']}" />
              <h:outputLabel value="#{msg['ui.user.create.firstname.label']}:" />
              <h:inputText value="#{userFormBean.firstname}"
                              required="true"
                              label="#{msg['ui.user.create.firstname.label']}" />
              <!-- more properties... -->
         </h:panelGrid>
         <c:if test="#{userFormBean.state == applicationScope.constants.STATE_NEW}">     
              <h:commandButton action="#{userFormBean.createUser}" value="#{msg['ui.user.create.button']}">
                   <f:setPropertyActionListener value="#{applicationScope.constants.STATE_NEW}" target="#{userFormBean.state}"/>
              </h:commandButton>
         </c:if>
         <c:if test="#{userFormBean.state == applicationScope.constants.STATE_UPDATE}">
              <h:commandButton action="#{userFormBean.updateUser}" value="#{msg['ui.user.update.button']}">
                   <f:setPropertyActionListener value="#{applicationScope.constants.STATE_UPDATE}" target="#{userFormBean.state}"/>
              </h:commandButton>
         </c:if>          
    </h:form>     This is my backing bean that does all the logic...
    public String updateUser(){
         try{
              // do some business-logic
         }catch (Exception ex){
              // set error message and return to form
              FacesContext ctx = FacesContext.getCurrentInstance();
              // provide some error-msgs
              return null;
         return "success";
    }I need to save all the properties on my backing bean, especially my "state"-property that decides whether I create a new user or update a given user identified by its id...

    To start, do not mix JSF with JSTL this way. Remove all of those c:if tags and use the JSF 'rendered' attribute instead.
    E.g.
         <c:if test="#{userFormBean.state == applicationScope.constants.STATE_NEW}">     
              <h:commandButton action="#{userFormBean.createUser}" value="#{msg['ui.user.create.button']}">
                   <f:setPropertyActionListener value="#{applicationScope.constants.STATE_NEW}" target="#{userFormBean.state}"/>
              </h:commandButton>
         </c:if>should be
         <h:commandButton action="#{userFormBean.createUser}" value="#{msg['ui.user.create.button']}" rendered="#{userFormBean.state == applicationScope.constants.STATE_NEW}">
              <f:setPropertyActionListener value="#{applicationScope.constants.STATE_NEW}" target="#{userFormBean.state}"/>
         </h:commandButton>Back to your actual problem: I cannot correlate your problem description to the given code snippet. Which non-set values are you talking about?

  • What is commandButton.action, if not a method?

    Gosh, I'm learning a lot of interesting things. First, the UIComponent.getAttributes().put() method simply uses Java reflection to find the appropriate setXXX() property method of the UIComponent itself, making UIComponent.getAttributes().put(propertyName, propretyValue) equivalent to UIComponent.setProperty(propertyValue)!
    Second, UICommand.setAction only takes a method binding argument, meaning that UICommand.getAttributes().put("action", value) only accepts a method binding as well.
    So how does <commandButton action="value"> work for literal values? That is, if the action action XML attribute value isn't a method-binding reference but a literal string value, how does CommandButtonTag store this value in UICommand?
    Garret

    OK, you've got a distinction between "method-signature
    binding", which is what MethodBinding actually is,
    and your new "method-value binding", which JSF doesn't
    offer.Right, and right! (The latter is the answer to the rhetorical question, "If I can get a value from a property, why can't I get a value from a method call?")
    I don't see anything in your proposal that
    provides method-signature binding via a ValueBinding
    class, nor can I imagine how you'd elegantly provide
    that.I don't want to! The reason why it's important to make the distinction between method-signature binding and method-value binding is that they are two different animals, for two different purposes. Method-signature binding is already served quite well, as you point out, by the existing MethodBinding. The "value" we want is a pointer to the method itself, not the value it produces. As you can't use a JSF EL (or even an extended JSF EL) expression or a method call to return a method-signature binding, there's no reason for method-signature binding to be part of the ValueBinding<?> (or Expression<?> or whatever we call it) hierarchy at all.
    Take the actionListener attribute, for instance. The value of this attribute is a method---not the value a method produces. It says in essence, "here is the method I want JSF to call later when an event is produced." We don't specify method argument objects, because we don't know them. (I'd like to see the JSF EL syntax explicitly specify the parameter types, but that's a wholly separate issue that doesn't affect this discussion.)
    The UICommand.actionListener attribute is like a string or integer attribute that doesn't support property-value binding. In fact, MethodBinding is a type just like String or Integer, and if Java supported returning method bindings we could in fact have an Expression<MethodBinding> that allowed the method binding to be literally specified (as it is now) or returned as the value of a property or a method invocation. But the Java language doesn't know about method-signature bindings, so "actionListener", "valueChangeListener", "validator", and other method-signature binding attributes should remain as they are now, and allow only a single MethodBinding as the valid object (parsed from the literal string method signature value in the XML attribute).
    I'm also not sure you addressed what I meant by
    "shadowing"; in JSF, if a ValueBinding is set, and
    then a static value is set, the static value "shadows"
    the binding; if the static value is nulled out, the
    ValueBinding becomes active again.Oh, I'm sorry, I didn't understand what you meant by "shadowing." I had assumed that you meant the same thing Mann was talking about when he described using a ConstantMethodBinding adapter class to pretend to be a MethodBinding when in reality a literal value is being stored.
    Rather, you're talking about, for example, UIParameter.name, which allows both a value-binding expression to be set, or just a literal string which if set makes UIParameter ignore the value-binding expression. Frankly, I didn't know this was a benefit---I thought it was an undesired consequence of UIComponent wanting to support both literal values and property-value binding expressions, and having one of these hidden if you happened to set both. My proposal didn't have this (what I thought to be) schizophrenia, and I thought that was a good thing.
    If it turns out you want to shadow variables (can you tell me why you'd want to?), then that's easier under my proposal than it currently is in JSF. In my proposal the logic is encapsulated in the Expression<?>, not the UIComponent.
    First, just add an Expression<T>.setShadowedValue() to the base value-binding interface. Adding this to the interface I defined above gives us:
    public interface Expression<T> //the base ValueBinding I describe above
    public T getValue(final FacesContext context);
    public Class getType(FacesContext context);
    public String getExpressionString();
    public void setValue(T value);
    public void setShadowedValue(Expression<T> expression);
    }(Note that I also added Expression<T>.setValue(). A MethodValueBindingExpression<T>.setValue(), of course, will function exactly like a PropertyValueBindingExpression<T>.setValue() for a property that is read-only, as will a LiteralExpression<T>.)
    Now you can shadow property-value bindings with literal values to your heart's content. Better yet, you can also shadow method-value bindings with a literal value. Even better, you don't have to care whether it's a property-value binding or a method-value binding (or even a literal value!) that you're shadowing with your literal value. (Maybe your use case calls for literal values to disallow shadowing---in that case LiteralExpression<T>.setShadowedValue() would call LIteralExpression<T>.setValue(), or maybe just throw away the value, depending on how you want it to work.)
    But it gets better! Why only shadow with literal values---why not shadow with a property-value binding? Why not shadow a property-value binding with a method-value binding? All of this is allowed, because Expression<T>.setShadowedValue() excepts another Expression<T> as its parameter. (And if you're using generics, it's even type-safe.) The internal logic of setShadowedValue() and getValue() function exactly as the current UIComponent code does for any arbitrary attribute, except now it's more elegant, more powerful, and encapsulated in a single place. It should be identically efficient.
    This all assumes that we even want shadowing. I'm sure you have a compelling use case...
    BTW, I entirely agree about the inelegance and
    inefficiency of the standard coding pattern for
    retrieving properties in JSF UIComponent classes, and
    know that it calls out for a better underlying storage
    architecture. That's why we don't duplicate it in the
    ADF Faces code!Yeah, I'm sure there are several ways to get around this ugly mess, and I'm sure most of them use some sort of refactoring to put common code in some other place than within UIComponent. I happen to like my proposal, which uses polymorphism to remove the need for if(){}else{} when retrieving values, and makes everything self-consistent, type-safe, extensible, elegant, and efficient. I'm sure your solution is pretty good, too. ;)
    All this, built entirely on top of the existing JSF
    spec. It can be done.Oh, yes, we can do all sorts of things on top of the existing JSF spec. In fact, the entire architecture I've proposed can be adapted to plug into the existing JSF architecture. Here's what I've done:
    First, I've created the whole Expression<T> interface hierarchy, implemented by PropertyValueBindingExpression<T>, MethodValueBindingExpression<T>, and LiteralExpression<T> hierarchy I outlined above. Now I have a nice interface that allows me to access values without caring how they are represented.
    But some existing UIComponent attributes (e.g. UIParameter.value) only allow property-value bindings (ignoring shadowing for the moment). So I have an ExpressionValueBinding that wraps any expression and adapts it as a subclass of ValueBinding.
    Some existing UIComponent attributes (e.g. UICommand.action) only allow method-value bindings. (In fact, UICommand.action may be the only place where JSF uses a method-value binding---without realizing it) Similarly, I have an ExpressionMethodValueBinding that wraps any expression and adapts it as a subclass of MethodBinding.
    I can now plug any expression (whether literal, property-value binding, or method-value binding) into any relevant exiting JSF component attribute, and things work---well and elegantly. It should be obvious by now that the mere fact that I can do this cries out that property-value binding, method-value binding, and literal values might as well have the same interface to begin with.
    Cheers,
    Garret

  • PLZ Help: how to get value of a request scoped Bean/Attribute in JSF ?!!!

    hi,
    I noticed this part of code to retrieve session scoped beans/vars in an ActionListener or other jsf classes, but it does not work for request scoped beans/vars :( what's the problem then ? what shall i do ?
    Type var = (Type)Util.getValueBinding("myBeanInRequest")).getValue(context);
    I have also set that getPhaseId() returns UPDATE_MODEL_VALUES or APPLY_REQUEST_VALUES.
    Any comment or idea ?

    I have declared my Bean in my JSP page not in the
    faces-config.xml. Does this make any problem ? Also I
    have tried the way you told me as well, but still the
    returned attribute is null.
    P.S. My bean is declared in my JSP page this way:
    <jsp:useBean id="newSurveyVar" class="SurveyModel"
    scope="request" />
    This declaration causes the SurveyModel instance to be created in request scope when the page is rendered, but that doesn't help you when the form is submitted -- that is going to happen on the next request (so the request attribute created here goes away). Basically, <jsp:useBean> is not typically going to be useful for request scope attributes (it's ok for session or application scope, though).
    and further I have this jsf code:
    <h:command_button label="Create" commandName="create"
    action="create" >
    <f:action_listener
    r type="CreateNewSurveyActionListener"/>
    </h:command_button>
    and this is my
    CreateNewSurveyActionListener.processAction(ActionEvent
    e) {
    if (actionCommand.equals("create_the_survey")) {
    FacesContext context =
    t = FacesContext.getCurrentInstance();
    SurveyModel survey =
    y =
    (SurveyModel)(Util.getValueBinding("newSurveyVar")).get
    alue(context);
    if (survey==null) // returns true :(((
    And since I've declared my beans here there is nothing
    special declared in my faces-config.xml
    For me again it is really strange why it is not
    working !!!
    Any idea ? Because the event listener is fired in a separate request, so the one you created in the page is gone.
    This is why the managed bean creation facility was created. If your component contains a valueRef that points at the bean name (or you evaluate a ValueBinding as illustrated earlier in the responses to your question), then the bean will get instantiated during the processing of the form submit.
    Craig McClanahan

  • Jsf 1.2_08 gives me blank page when i use h:panelGrid with binding attribut

    I am using jsf 1.2_08 (Mojarra 1.2_08-b06-FCS) + jstl-1.2.jar + Apache Tomcat/6.0.6 + jdk1.5.0_08 on linux suse server. when i load a jsp page with a h:panelGrid, i get a blank page
    my panelGrid is as follows
    <h:panelGrid id="financialProjections" binding="#{veusSituationMonitorDisplayBean.financialProjections}" border="0" cellpadding="0" cellspacing="0" columnClasses="nspLabel w200,ra bl,ra bl,ra bl,ra bl,ra bld,ra bl,ra bl" columns="8" width="100%"/>
    when i remove the binding attribute, rest of the page displays fine.
    Thanks in Advance
    my web.xml is
    <?xml version="1.0"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
    <context-param>
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
    <param-value>server</param-value>
    </context-param>
    <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>AJAXServlet</servlet-name>
    <servlet-class>net.em.servlets.AJAXServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>InitialLizeApplicationbeansServlet</servlet-name>
    <servlet-class>net.em.servlets.InitialLizeApplicationBeanServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>AJAXServlet</servlet-name>
    <url-pattern>/abc.ajax</url-pattern>
    </servlet-mapping>
    <filter>
    <filter-name>ExtensionsFilter</filter-name>
    <filter-class>
    net.em.emrp.filters.EMExtensionsFilter
    </filter-class>
    <init-param>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>10m</param-value>
    </init-param>
    <init-param>
    <param-name>uploadThresholdSize</param-name>
    <param-value>100k</param-value>
    </init-param>
    </filter>
    <filter>
    <filter-name>ResponseOverrideFilter</filter-name>
    <filter-class>org.displaytag.filter.ResponseOverrideFilter</filter-class>
    </filter>
    <session-config>
    <session-timeout>
    720 <!-- minutes -->
    </session-timeout>
    </session-config>
    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ResponseOverrideFilter</filter-name>
    <url-pattern>*.do</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>ResponseOverrideFilter</filter-name>
    <url-pattern>*.jsp</url-pattern>
    </filter-mapping>
    <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <error-page>
    <error-code>404</error-code>
    <location>/error404.html</location>
    </error-page>
    <error-page>
    <error-code>500</error-code>
    <location>/error500.html</location>
    </error-page>
    <taglib>
    <taglib-uri>http://ajaxtags.org/tags/ajax</taglib-uri>
    <taglib-location>/WEB-INF/ajaxtags.tld</taglib-location>
    </taglib>
    </web-app>

    BalusC wrote:
    I rather mean that you shouldn't instantiate the HtmlPanelGrid in the bean yourself, but just use the instance which is set through the setter during the restore_view phase.BalusC, why do you recommend this? The spec allows for the bean to create the component:
    *JSF 1.2, section 3.1.5* says:
    When a component instance is first created (typically by virtue of being referenced by a UIComponentELTag in a JSP page), the JSF implementation will retrieve the ValueExpression for the name binding, and call getValue() on it. If this call returns a non-null UIComponent value (because the JavaBean programmatically instantiated and configured a component already), that instance will be added to the component tree that is being created. If the call returns null, a new component instance will be created, added to the component tree, and setValue() will be called on the ValueBinding (which will cause the property on the JavaBean to be set to the newly created component instance).

  • InputText: onchange attribute not rendered anymore from JSF 1.2.08?

    Hi!
    Recently I have tried upgrading from 1.2.04 (the version that comes with Glassfish v2ur2 which we are using) to 1.2.13. (Then, when I encountered the problem, only to 1.2.08, but it stayed the same.) To my astonishment, from then on the 'onchange' attribute of at least the h:inputText tag wasn't rendered in HTML anymore!
    I.e. when I write something like this:
    <h:inputText ... onchange="myOnchange(this)" id="myId" />
    it will render as
    <input type="text" id="form1:myId" ... /> <!-- onchange simply skipped! -->
    whereas in the version 1.2.04 it rendered as
    <input type="text" id="form1:myId" onchange="myOnchange(this)" ... />
    I have compared the tld files and the onchange attribute is specified for the inputText tag, it is also there as a member in the tag handler class. Still, it is not getting rendered.
    Is this a bug in versions above 1.2.04 or am I doing something wrong? The way I upgraded is as described in the release notes: simply copied over jsf-impl.jar and jsf-api.jar into GLASSFISH_HOME/lib (thus overwriting the original jsf-impl.jar in that directory), then restarted the container. (I didn't modify domain.xml to add jsf-api.jar to the classpath, though, because our project actually copies over these jars into its own lib and uses those.)
    Thanks,
    Agoston

    Oops, sorry, my fault! :( I didn't remember whether I've already posted it.
    (All I can say in my defence is that I haven't found any option in the forum search which would have enabled me to search for my own posts.)
    Thanks for the original answer!

  • JSF / Struts - I can't see attributes of my form.

    Hi,
    i've a problem with JSF. I'm using struts in my projects and I need to use a JSF component. So, i integrated JSF & Struts using struts-faces.jar. I converted my jsp file and I succeeded to fill combos but when I submitted form I can't get attributes of my form in action. ( i can see but all of them are null)
    Anybody help me?
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="/WEB-INF/struts-faces.tld" prefix="s"%>
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@taglib uri="http://www.ibm.com/jsf/rte" prefix="r"%>
    <script>
         function gonder() {
              if ( confirm('E-Postay&#305; göndermek istedi&#287;inizden emin misiniz?') ) {
                   document.forms[0].action = "/Admin/admin/testMail.do?method=kurumUygulamaGonder";
                   //alert("document.forms[0].elements['_id0:konu'].value : " + document.forms[0].elements['_id0:konu'].value);
                   document.forms[0].submit();
    </script>
    <f:view>
         <body>
         <hx:scriptCollector id="scriptCollector1">
              <s:form action="/admin/testMail" >
                   <jsp:include page="/common/header_center.jsp" />
                   <center>
                   <fieldset style="width: 80%">
                        <table border="0" align="center" id="oddEvenTable" width="98%">
                             <tbody>
                                  <tr class="listOddEven">
                                       <td><h:outputText value="Kurum" /></td>
                                       <td><br>
                                            <h:selectManyListbox styleClass="selectManyListbox"
                                       id="kurumlar" value="#{mailForm.kurumlar}" size="7">
                                       <f:selectItems
                                            value="#{selectitems.requestScope.kurumList.kurumAdi.kurumAdi.toArray}" id="selectItems0" />
                                  </h:selectManyListbox>
                                       </td>
                                       <td></td>
                                       <td><h:outputText value="Uygulama" /></td>
                                       <td>
                                            <h:selectManyListbox styleClass="selectManyListbox"
                                       id="uygulamalar" value="#{mailForm.uygulamalar}" size="7">
                                       <f:selectItems
                                            value="#{selectitems.requestScope.uygulamaList.uygulamaAdi.uygulamaAdi.toArray}"
                                            id="selectItems1" />
                                  </h:selectManyListbox>                         
                                       </td>
                                  </tr>
                                  <tr class="listOddEven">
                                       <td><h:outputText value="Konu" /></td>
                                       <td colspan="4"><h:inputText id="konu" size="118" value="#{mailForm.konu}"/></td>
                                  </tr>
                                  <tr class="listOddEven">
                                       <td><h:outputText value="&#304;çerik" /></td>
                                       <td align="center" colspan="4"><r:inputRichText width="702"
                                            height="352" id="content" value="#{mailForm.content}"></r:inputRichText>
                                       </td>
                                  </tr>
                                  <tr class="listOddEven">
                                       <td colspan="5" align="center" valign="middle">
                                       <hx:commandExButton
                                                 type="button" value="Gönder" styleClass="commandExButton"
                                                 id="btnKriterlereGoreAra" onclick="gonder()">
                                            </hx:commandExButton>
                                       </td>
                                  </tr>
                             </tbody>
                        </table>
                   </fieldset>
                   </center>
              </s:form>
    </f:view>

    Settings>Mail, Contacts, Calendars>Show
    http://i1224.photobucket.com/albums/ee374/Diavonex/382b7c7505f26ac775b54ce257655 5b4.jpg

Maybe you are looking for

  • RGB Colors

    I have a RGB-color and I want to make it a little bit brighter or darker. First I tried out the two functions java.awt.Color.brighter() and darker(), but I noticed that both functions turn a random color to white in a few steps. Therefore I tried to

  • Inconsistent datatypes

    Hi! This is the beginning of my program declare porcent number(4,2); fec date; period number; bloquePLSQL varchar2(32767); begin select ten_porcent, ten_fec, ten_period into porcent, fec, period from ta_tx_entidad where ten_codigo='PF'; bloquePLSQL :

  • -50 error; unknown error occurred downloading rental

    rental fails to download for "unknown reason"; anyone else getting this error (-50)?  deleting the video (in itunes) and restarting doesn't change the error.  I have no problem watching YouTube videos.

  • JDBC & orcacl performance issue..

    I know this is not the right place to post this memo but some of you are very nice and have deep knowledge of what i am going to ask.... I have a java programme which call a stored procedure using oracle callable ( OracleCallableStatement ) slowConn.

  • Problem downloadin​g maps

    Hi there...I'm trying to download the Maps app and am getting the following error: "Sorry, your device does not meet the system requirements that are needed to support BlackBerry Maps." I have the most updated device drives...any thoughts? Thanks in