One reason why commandLink doesn't work in dataTable

Ok, so I think I've got an explanation why commandLink doesn't work in dataTable when the model bean is request scoped. Maybe somebody can tell me if I'm wrong.
I have a model bean that generates table rows based on some input criteria (request parameters).
So, we validate the inputs, apply them to the bean and render the page. Once the inputs have been applied to the bean, a request for table rows returns rows, no problem.
However, we put a commandLink in each row, so we can expand the details. Maybe we even get smart and repeat the input row-generating criteria as a hidden field in the page.
Unfortunately, when the user hits the commandLink, the list page simply refreshes, maybe even w/out table rows. The user doesn't get the details page as expected.
Why not?
Because: in the DECODE phase (even before validation and before "immediate" values have had their valueChangeListeners called), we ask the model bean for the table rows, so we can decode the commandLinks. Unfortunately, in "decode" phase, the request-scoped model bean has not had its row-generating criteria updated (that happens in the "update model" normally, or at the END of the decode phase if we got cute by (1) setting the "immediate" attribute on the row-generating criteria to "true" AND (2) set a valueChangeListener to allow us to update the model bean early. The END of the decode phase isn't good enough -- in the middle of that phase, when we're attempting to deocde commandLinks, the model bean has no citeria, so there's no row data. No row data means no iteration over commandLinks to decode them and queue ActionEvents. So, we march through the rest of the phases, process no events, and return to the screen of origin (the list screen) with no errors.
So, what's the solution?
One solution is to make the model bean session-scoped. Fine, maybe we can store a tiny bit of data in it (the search criteria), so it's not such a memory drag to have it live in the session forever. How do we get that data in? A managed property in faces-config.xml with value #{param.PARENT_KEY} won't work because it's assigning request-scoped data to a session-scoped holder. JBoss balks, and rightly so. Do we write code in the model bean that pulls the request parameter out of thin air? (FacesContext.getExternalContext()....) I don't really like to code the name of a specific http request parameter into the bean, I think it's the job of the JSP or faces-config.xml to achieve that binding (request parameter to model propery). Plus, I'd be sad to introduce a dependency on Faces in what was previously just a bean.
Is there a better way?
In my particular situation, we're grafting some Faces pages onto an already-existing non-Faces application. I don't get the luxury of presenting the user an input field and binding it to a bean. All I've got to work with is a request parameter.
Hmm, I guess I just answered my own question. if all I've got to work with is a request parameter, some ugliness is inevitable, I guess.
I guess the best fix is to cheat and have the bean constructor look for a request parameter. If it finds it, it initializes the criteria field (which, in my case, is the key of an object that has a bunch of associated objects (the rows data), but could be more-general d/b search criteria).
(I looked at the "repeater" example code in the RI, but it basically statically-generates its data and then uses 100% Faces (of course) to manage the paging (where "page number" is essentially the "criteria").
Comments? Did I miss something obvious?
John.

...or I could just break down and do the thing I was hoping to avoid (outputLink instead of commandLink):
<h:outputLink value="/faces/Detail.jsp">
  <f:param name="PARENT_KEY" value="#{bean.parentKey}"/>
  <h:outputText value="#{bean.label}"/>
</h:outputLink>It's still a "hardcoded" parameter name, but at least the binding is in the JSP and faces-config.xml, not the bean Java code.

Similar Messages

  • Possible (1) cause why iTunes doesn't work on some windows systems

    I'm currently working on a notebook computer for a friend. The problem? iTunes does not launch.
    Selecting the iTunes icon does nothing.
    Loaded iTunes onto (2) of my computers. A desktop and a notebook. Both worked well.
    Attempted to launch the Quicktime icon on her system. Just as with the iTunes - nothing.
    So, I re-read the Minimal System Requirements. iTunes requires 256mb of memory. And on her notebook - only has 240mb.
    My memory (DDR2) won't work on her older system. But I suspect this may be (at least) one reason why iTunes does not launch.
      Windows XP  

    Hello Lorenzo 1972,
    It sounds like you are unable to open iTunes even after a fresh install with the error that it cannot find the iTunes.exe file. That path, c:\program files (x86)\itunes\itunes.exe leads to the 32 bit program folder for iTunes. If you are using a shortcut you had on the desktop pre install, try going to C:\program files\itunes\ and finding the iTunes.exe file there.
    If not it sounds like iTunes may be installing a damaged copy of the 32 bit version of the application, so I would recommend the following article to help you get any old installation files out so you can install the 64 bit version fresh:
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/ht1926
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • My new iPad air is suddenly asking for a pass code. I have only just finished restoring it from my iPad 2 and I didn't set one. The one I used before doesn't work. What can I do?

    My new iPad air is asking for a pass code. I have only just finished restoring it via iTunes from my ipad2 and I didn't set one. The one I used before doesn't work. What can I do?

    http://support.apple.com/kb/HT1212

  • I have 3 computers. i want to get files from one to another. it doesn't work, i think it is a problem with the apple id?

    i have 3 computers. i want to get files from one to another. it doesn't work, i think it is a problem with the apple id?

    Roger:
    Zugriffsrecht means Access Right according to the translators.
    martinamm:
    You can't do what you want with iCloud.  You will need to setup remote access to your main computer with VPS or some similar remote access application.   With VPS you have an application running on your main computer turning it into a server and an client app on your laptop so you can access it remotely.  There are many such apps out there, some probably more feature filled than VPS.  You might post in the system forum that you're running and ask there.
    OT

  • Confused as to why this doesn't work...

    I wrote this code correctly, but it doesn't seem to work. I'm not sure if I'm leaving something out or not using something correctly. If anyone can tell me why this doesn't work, it would be greatly appreciated!
    P.S. in the actionPerformed method, I want to put the window to close once someone clicks an "ok" button. How is this done? I've tried using setDefaultCloseOperation(3), but it doesn't seem to work.
    peace,
    Mark
    //?2002 Copyright. MJA Technologies.  All Rights Reserved.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class About extends JFrame implements ActionListener
        JTextArea textarea;
        JPanel panel1;
        JButton okbutton;
        String output;
        public About()
            super("Pages");
            Container container = getContentPane();
            textarea = new JTextArea();
            textarea.setText("Pages 1.0 beta 0\n?2002 MJA Technologies.\nAll Rights Reserved.");
            container.add(textarea);
            setDefaultCloseOperation( 3);
            setVisible(true);
            setSize(400, 300);
        public void actionPerformed(ActionEvent event)
            if(event.getSource() == okbutton)

    Oh see, you said this:
    "P.S. in the actionPerformed method, I want to put the window to close once someone clicks an "ok" button. How is this done? I've tried using setDefaultCloseOperation(3), but it doesn't seem to work."
    so I said this:
    "setVisible(false)"
    NOOOOOOOOOOOW you say the TextArea doesn't show up...that's a whole other problem.
    Jeeeeeeeeeeeeeeeez.
    So what layout manager are you using in the container? (hint hint)

  • Sun one server 6.0 doesn't work well with explorer

    We've sun one server 6.0 sp4 running in a sparc server as SSL server and too as common server on port 80. The most our clients , 95%, are explorer browser users.
    The server has known bugs with SSL3 , interoperatibility with MSIE problem 532427. The solutions suggested in the server documentation don't work. We tryed the solutions suggested many times and in few time we got complaints from clients, people get "this page can't be displayed". I had to set the server to work with SSL2 only , althought security's reports tell that this protocol is not safe.
    The second bug is concern the latencies loading pages with explorer. I apply the solution suggested, KeepAliveQueryMeanTime 1, it doesn't work well too. We don't feel the latencies on new machines or light browsers as avant , but we still feel these latencies with old machines or if the users uses modem. A lot of people still see very strong latencies.
    I feel the server wasn't tested enough with explorer browser , it has so many compatibility problems with this browser.I think for the most webmasters the perfect compatibility with explorer is very important.
    We payed for this server and it is worst than apache ,apache group fixed the SSL problem long time ago. Only one thing we need doesn't work well in apache then we contenue to use sun one server. But this diference is not enough to justify the use of this server if sun don't fix these problems. I'm talking about problems they exist more than 1 year, they were when i installed the server then i contenue to work with iplanet 4.1 and SSL2. I read the new version server characteristics, version 6.1 , i didn't find anything telling that these problems were fixed.
    Yair Lapin
    Hebrew University Webmaster

    Yair -
    Unfortunately this is a little vague. Can you tell us specifically what problem(s) you're having (unfortunately your current message does not go into adequate detail for us to understand the problems you see, or to make recommendations about how to remedy them).
    Thanks
    Joe

  • IPad clipboard - one reason, why it is so bad for me

    iPad clipboard - one reason, why it is so bad for me
    search for adresses on an app for that and export the found adresses per email;
    THe first task goes well; further adresses (say, I need today three adresses from acertain village) are going wrong. Can anyone consider, why?

    Fourth time, because my first three answers were blowing in the wind, gefressen guzzled by the clipboard or reloading safaripage, the third by notes, never I have seen there have been  hundred of chars eaten by notes.
    1) I have an application (“app”) to search addresses in austria as there is a phone-number connected.
    2) I can generate a contact entry with the result or export it in various channels, say I send it per e-mail to me (for using it on an other device outside iOS or send it to a collegue.)
    3) If there are more than one wanted results, I have to send them one by one.
    4) Looking for the e-mails, they may have a totally senseless content (an earlier clipboard-content) or
    every e-mail has the same content: the first address in the results-list.
    5) Please do not ask me, why this is. I would be glad to hear from you how to stop this behavior of
    iPad (with wich I was really happy for years and which is since month not helpful but the source of nuisance friendly said on every use
    daily, hourly, eight times or so every hour)
    {see https://discussions.apple.com/message/26921591?ac_cid=op123456#26921591}
    And yes I have tried all resettings though not the one to delete all content, perhaps Apple can find a better solution for me (so I thought weeks before).

  • Why FaceTime doesn't work in Saudi Arabia ?

    why FaceTime doesn't work in Saudi Arabia ?

    we have stores sell apple products some of them sell with faetime at a high rate,
    and some other sell apple products without facetime at a normal price.
    finaly we need apple stores in Saudi Arabia to prevent this fraud.
    thank you
    what you're saying here is that some people parallel import apple products around the normal channels and they are from other countries so they havent got facetime blocked
    and others normally import apple products and they are blocked
    and then you go on believing that if apple had a store in saudi things would be better rest asured that if they did they would sell products with facetime blocked

  • Why "fixedcolumn" doesn't work in tableview?

    Hi,
    I have a tableview which use iterator on BSP page. I set "fixedcolumn" attribute for one column in iterator->GET_COLUMN_DEFINITIONS
          tv_column-columnname  = 'pvname'.
          concatenate '' text-002 '' into tv_column-title.
          tv_column-width       = '35%'.
          tv_column-fixedcolumn = 'X'.
          append tv_column to p_column_definitions.
    And in iterator->RENDER_CELL_START, I put textview in each cell:
            when 'PVNAME'.
              assign component 'PVNAME' of structure <row> to <col>.
              lv_string = <col>.
              create object htmlb_textview.
              htmlb_textview->text = lv_string.
              p_replacement_bee = htmlb_textview.
    On BSP page, I define the tableview:
                  <htmlb:tableView id            = "system_view"
                                   table         = "<%= model->sys_view %>"
                                   width         = "100%"
                                   footerVisible = "False"
                                   design        = "alternating"
                                   iterator      = "<%= iterator %>"
                                   sort          = "server" />
    But when I run page, I found the "fixedcolumn" doesn't work. the cell's background color changed. But still each cell has same content, not grouped in one cell.
    What's the reason? Thanks!
    Best regards,
    Long

    i have been using this method which works fine.
    page attribute:
    coldef     TYPE     TABLEVIEWCONTROLTAB
    wa_coldef     TYPE     TABLEVIEWCONTROL
    oncreate:
    refresh: coldef .
    clear: coldef, wa_coldef .
    wa_coldef-columnname          = 'CARRID'.
    wa_coldef-title = 'Carrier.'.
    wa_coldef-fixedcolumn = 'X' .
    append wa_coldef to coldef.
    clear wa_coldef .
    wa_coldef-columnname          = 'CONNID'.
    wa_coldef-title = 'Connection.'.
    wa_coldef-fixedcolumn = 'X' .
    append wa_coldef to coldef.
    clear wa_coldef .
    <htmlb:tableView id                = "LW"
                               headerText        = "header text %>"
                               headerVisible     = "TRUE"
                               table             = "<%= finlwdets %>"
                               visibleRowCount   = "25"
                               navigationMode    = "BYLINE"
                               iterator          = "<%= iterator %>"
                               columnDefinitions = "<%= coldef %>" />

  • Why EL doesn't work with custom tags ?!

    I don't know why expression lang. doesn't work with me.
    here's an example, and please tell me why :
    --- the jsp page with EL ==> doesn't work :
    <%-- In the name of ALLAH most gacious most merciful --%>
    <%@ page language="java" %>
    <%@ taglib uri="/cartlib" prefix="cart" %>
    <html>
    <jsp:useBean id="product" class="ch16.cart.ProductCatalog" scope="application" />
    <cart:showCatalog productCatalog="${product}" addToShoppingCartUri="<%= response.encodeURL("AddToShoppingCart.jsp") %>" />
    </html>
    when using expressions instead, the page works .
    the new page is :
    <%-- In the name of ALLAH most gacious most merciful --%>
    <%@ page language="java" %>
    <%@ taglib uri="/cartlib" prefix="cart" %>
    <html>
    <jsp:useBean id="product" class="ch16.cart.ProductCatalog" scope="application" />
    <cart:showCatalog productCatalog="<%= product %>"
    addToShoppingCartUri="<%=
    response.encodeURL("AddToShoppingCart.jsp") %>" />
    </html>
    The error was :
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: jsp.error.beans.property.conversion
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper
    .java:512)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    org.apache.jasper.JasperException: jsp.error.beans.property.conversion
    org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(Js
    pRuntimeLibrary.java:885)
    org.apache.jsp.ShowProductCatalog_jsp._jspService(ShowProductCatalog_jsp.java:77
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.20 logs.

    Regarding setup, see this post reply #6
    http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0
    Other potential things to check: make sure you are getting the right value passed in
    productCatalog="${applicationScope.product}"
    ${product} by preference would take a pageContext, request or session attribute before the application level one (it uses pageContext.findAttribute).
    What do you get if you just print out ${product} on the screen?
    It should call a toString() on it for rendering purposes.

  • Is there a reason why Firefox does not work on my Galaxy Edge?

    I recently upgraded to a Samsung Galaxy Note Edge; love the phone, it works great. The downside is that Firefox doesn't seem to work properly, it goes from extremely low while displaying Web pages to not displaying anything at all. At first I thought it was something with the phone but as soon as I switch to Chrome everything works normal. I use Firefox on my laptop and have bookmarks and passwords stored in it. Previously I had a Samsung GS4 and syncing data from laptop to phone was a piece of cake. I like Chrome and I know it could do the same but I'd like to stick to Firefox if possible. Hope the Mozilla team can fix it soon.
    Edgar J. Oviedo.

    Hi EOviedo
    I am surprised that Firefox doesn't work on the Note Edge because it works great on the Note 3 and 4
    Could you please:
    # Tell us what exact model of Note Edge? e.g. Verizon Note Edge, AT&T Note Edge. We have had problems where obscure carrier variants of phones and tablets don't work but the popular variants do work (e.g. in one case the AT&T HTC One M8 worked fine but the Verizon HTC One M8 didn't)
    # Tell what version of the Android Operating system? Are you using Kitkat 4.4 or Lollipop 5?
    # Could you please tell us what you did (what do you mean by "from extremely low while displaying Web pages to not displaying anything at all"; which websites exactly) what happened and what you expected. A sample URL of a website and screenshot would be super helpful
    Cheers!
    ...Roland

  • I cannot sync Ical on my iMac with my professional calendar (outlook web access). and I don't understand why it doesn't work since I have already made it with my iPhone. Help

    Hello,
    I bought an iMac few days ago. I would like to sync ical on my iMac with my professional calendar I use in my company (from outlook web access).
    I was easy to manage it on my iPhone (I just add a new "exchange" mail account and ask for a calendar sync only) and it worked very quickly.
    But I cannot do it with the iMac, and I don't undersatnd why?
    the domain is is used for my iPhone is the following :
    owa.companyname.com
    I tried all the solutions I found in this forum but it doesn't work.
    Many thanks in advancefor your help.
    Matt

    Does it have to be an applet?
    If you want the same behaviour as in the code with traffic lights, change
    class MortgageApplet extends JApplet implements ActionListener {
    to
    class MortgageApplet extends JFrame implements ActionListener {
    and change
    public void init() {
    to
    public MortgageApplet() {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Why Earpods doesn't work on Ipod Shuffle 3G?

    I just got my new earpods because I have an ipod shuffle that I didnt use for a couple months because I lost the earphones, but it seems this new ones dont work, I cant turn volume up/down or anything I can just ear the music with the default volume,,, in the manual it says it is suppose to work on iPod shufle 3rd generation or later... I think it is a lie.. or somebody found a way to make them work yet?

    Only Apple would know the answer to why they won't work with the 3G.
    B-rock

  • Why rollback doesn't work?

    hello,
    I am mantaining a servlet application with Tomcat and MySQL 4.0.16 .
    Here is a part of the code that is giving me lots of problems with concurrent users:
    public void saveUpdate(String gameName, int IDAzienda, int periodo) throws ClassNotFoundException, SQLException, NamingException, Exception {
        Connection con = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Statement stmt = null;
        try {
            con = DBConnect.connect("DB");
            con.setAutoCommit(false);
            // many updates
            con.commit();
            con.setAutoCommit(true);
            con.close();
            catch ( SQLException sqle ){
            con.rollback();
            throw sqle;
        finally {
             if ( rs != null ){
                  try {rs.close();}
                  catch ( Exception e ) {  }
                  rs = null;
              if ( stmt != null ){
                  try {stmt.close();}
                  catch ( Exception e ) {  }
                  stmt = null;
              if ( pstmt != null ){
                   try {pstmt.close();}
                   catch ( Exception e ) {  }
                   pstmt = null;
              if ( con != null ){
                    try {con.close();}
                    catch ( Exception e ) { }
    }When concurrent users click on the submit button on the same istant to read/write on the db (there are many more similar methods called by different servlets), sometimes something goes wrong and it throws an exception (this is a problem I will set out later in the Servlet forum).
    The problem with above code is that when such an event occur, the tables stay modified and are saved with incoherent values.
    I am using InnoDB tables, so rollback() should be fully implemented.
    Do you think that I should move con.rollback() from the catch block to the finally block? anyway, why is this not working?
    thank you
    alessandro

    thanks for your quick replies.
    1. connections are always in setAutocommit(false)
    2. there are no DDL or other implicit commit statements
    so I guess too this is a locking problem. each method reads or updates the same 50 tables in a single transaction. what will happen if I use a SERIALIZABLE isolation level when 2 or more users are concurrent? will each method complete its transaction before another one is called?
    or do I have to LOCK manually the whole 50 tables at the beginning of each transaction? though I read that if a thread gets a LOCK, it automatically commits the changes made up to that point (also by other threads), so it might not be transaction-safe if one thread gets a LOCK while another one is still operating.
    alessandro

  • CommandLink doesn't work with rendered-attribute

    Hello,
    I have quite a strange problem.
    I have a commanLink, which has a rendered attribute. The link is rendered conditionally, so the rendered-value comes from a bean.
    <h:commandLink rendered="#{Bean.canEdit}" action="#{Bean.selectDocumentToEdit}" >
               <h:outputText value="Edit doc" />
                              <f:param name="param" value="#{Bean.doc.id}"/>
    </h:commandLink>Showing the link is working like it should, but commandLink is not working with this. When I change rendered="true", commandLink works ok. But now it doesn't call the commandLink action at all.
    Any help would be appreciated

    rendered="true", commandLink works ok. But now it
    doesn't call the commandLink action at all.I meant it doesn't call the commandLink action method when retrieving rendered-value from bean.
    I'm using RI 1.1.01

Maybe you are looking for