Re: JSF servlet request in action method or navigation rule to get binary servlet data?
I think that what Andreas is doing is: (1) access a JSF page -- renders html (2) click on command-component in page, causing a submit (3) in action-handler method, send an http-redirect to the browser (4) browser then does a GET to the redirect address, which maps to a servlet (5) the servlet generates a PDF as response, with appropriate http-headers (6) the server sees that the response mime-type is not HTML, so creates a new window to hold the PDF. The original browser window is left with the same HTML it had at (1) The browser window has simply not changed at all since (1), although a JSF lifecycle has run on the server. So of course any messages are still displayed. Andreas, I have had to do something similar in the past, but took a different approach. In the action-handler method I just put some data in session-scope, and then rendered a JSF page that contains some javascript to do a GET request to the pdf-generation servlet (a META refresh tag might also work). The PDF servlet then used the session-scoped data to generate the appropriate PDF document. Regards, Simon Bernd Bohmann schrieb: Hello Andreas, is your action immediate=true ? Regards Bernd Andreas Niemeyer schrieb: yippi :) Thank you all! Regards, Andreas Richard Yee schrieb: Try using divelement.style.display=none Regards, Richard On Wed, Dec 10, 2008 at 6:27 AM, Andreas Niemeyer [EMAIL PROTECTED] wrote: Hi, It works. The only problem is the left space from the invisible div tag. Regards, Andreas div id=error_messages style=color: darkred;visibility: visible t:messages id=error_messages showDetail=true showSummary=false / /div h:commandButton id=reportbutton onclick=clearMessages('error_messages') value=#{msgs.CreateReportButton} action=#{pdfreport.createPDFReport} / JavaScript: function clearMessages(aMessagesID) { var divelement = document.getElementById(aMessagesID); divelement.style.visibility='hidden'; } Andreas Niemeyer schrieb: Hello Helmut, Good proposal to handle this about JavaScript before send the form. I'll give it a trial. Kind regards, Andreas Helmut Swaczinna schrieb: Hello Andreas, I don't think Tobago or JSF can clear the messages for you. But you can clear the messages on the page yourself with some javascript before the action for the PDF generation gets submitted. For example: ... action=controller.createPDF onclick=clearMessagesAndSubmit('@autoId') ... function clearMessagesAndSubmit(actionId) { // Find messages and clear them Var message = document.getElenemtById('page:message'); message.value = ; Tobago.submitAction(actionId, false); } I haven't tried this, but I think it should work. Regards Helmut - Original Message - From: Andreas Niemeyer [EMAIL PROTECTED] To: users@myfaces.apache.org Sent: Wednesday, December 10, 2008 11:11 AM Subject: Re: JSF servlet request in action method or navigation rule to get binary servlet data? Hello Bernd, Yes, I did. There seems to be no way to get previous messages away due I don't get the page reloaded. I'll open a new thread and try to describe in more detail the requirements. Thank you. Regards, Andreas Bernd Bohmann schrieb: Hello Andreas, are you calling FacesContext.getCurrentInstance().responseComplete() ? Regards Bernd Andreas Niemeyer schrieb: Hello Bernd, Thank you for response. Unfortunatly I have to use this servlet as a pdf dynamic provider. The redirect works fine so far, but another thing happened. Due some validation rules in the same method, a previous custom FacesMessage stays displayed and only after a page reload it goes away. Have someone an idea? Regards, Andreas Bernd Bohmann schrieb: Hello Andreas, maybe this help: http://wiki.apache.org/myfaces/Sending_Files You don't need a Servlet for sending binary data from jsf. The magic is the responseComplete() method. Please look at the Section 2.1.3 Faces Request Generates Non-Faces Response of the jsf 1.1 spec. Regards Bernd Andreas Niemeyer schrieb: Hi, I would like to send form data from a JSF page for a servlet request with a navigation rule. The servlet returns a content type of application/pdf and is running in a context path. If I call it from within a action method, it works with following code: public String createPDFReport() { ... FacesContext context = FacesContext.getCurrentInstance(); ExternalContext ext = context.getExternalContext(); String vServletPath = /context_path/pdf-test; ext.redirect(ext.encodeResourceURL(vServletPath)); ... return call_servlet; } My context is a portal, I'm using the JSF portal bridge. The web.xml looks like: ... servlet servlet-namepdf-test/servlet-name
Re: JSF servlet request in action method or navigation rule to get binary servlet data?
Hello Simon, hello Bernd, It's exactly what I did. I put some session data in the session scope for the servlet. Your approach sounds good. More than one solution now available :) @Bernd: for this case with the redirect in the action method it makes no difference for the lifecycle behaviour. Yes I tried it, but.. The variant with the JavaScript to `clear' the faces messages works fine and was at least the simplest. When validation in that action method fails, new faces messages appears again, the page is reloaded and the div css property for visibility is as it was declared (without that property) Thank you all for your help! Regards, Andreas Simon Kitching schrieb: I think that what Andreas is doing is: (1) access a JSF page -- renders html (2) click on command-component in page, causing a submit (3) in action-handler method, send an http-redirect to the browser (4) browser then does a GET to the redirect address, which maps to a servlet (5) the servlet generates a PDF as response, with appropriate http-headers (6) the server sees that the response mime-type is not HTML, so creates a new window to hold the PDF. The original browser window is left with the same HTML it had at (1) The browser window has simply not changed at all since (1), although a JSF lifecycle has run on the server. So of course any messages are still displayed. Andreas, I have had to do something similar in the past, but took a different approach. In the action-handler method I just put some data in session-scope, and then rendered a JSF page that contains some javascript to do a GET request to the pdf-generation servlet (a META refresh tag might also work). The PDF servlet then used the session-scoped data to generate the appropriate PDF document. Regards, Simon Bernd Bohmann schrieb: Hello Andreas, is your action immediate=true ? Regards Bernd Andreas Niemeyer schrieb: yippi :) Thank you all! Regards, Andreas Richard Yee schrieb: Try using divelement.style.display=none Regards, Richard On Wed, Dec 10, 2008 at 6:27 AM, Andreas Niemeyer [EMAIL PROTECTED] wrote: Hi, It works. The only problem is the left space from the invisible div tag. Regards, Andreas div id=error_messages style=color: darkred;visibility: visible t:messages id=error_messages showDetail=true showSummary=false / /div h:commandButton id=reportbutton onclick=clearMessages('error_messages') value=#{msgs.CreateReportButton} action=#{pdfreport.createPDFReport} / JavaScript: function clearMessages(aMessagesID) { var divelement = document.getElementById(aMessagesID); divelement.style.visibility='hidden'; } Andreas Niemeyer schrieb: Hello Helmut, Good proposal to handle this about JavaScript before send the form. I'll give it a trial. Kind regards, Andreas Helmut Swaczinna schrieb: Hello Andreas, I don't think Tobago or JSF can clear the messages for you. But you can clear the messages on the page yourself with some javascript before the action for the PDF generation gets submitted. For example: ... action=controller.createPDF onclick=clearMessagesAndSubmit('@autoId') ... function clearMessagesAndSubmit(actionId) { // Find messages and clear them Var message = document.getElenemtById('page:message'); message.value = ; Tobago.submitAction(actionId, false); } I haven't tried this, but I think it should work. Regards Helmut - Original Message - From: Andreas Niemeyer [EMAIL PROTECTED] To: users@myfaces.apache.org Sent: Wednesday, December 10, 2008 11:11 AM Subject: Re: JSF servlet request in action method or navigation rule to get binary servlet data? Hello Bernd, Yes, I did. There seems to be no way to get previous messages away due I don't get the page reloaded. I'll open a new thread and try to describe in more detail the requirements. Thank you. Regards, Andreas Bernd Bohmann schrieb: Hello Andreas, are you calling FacesContext.getCurrentInstance().responseComplete() ? Regards Bernd Andreas Niemeyer schrieb: Hello Bernd, Thank you for response. Unfortunatly I have to use this servlet as a pdf dynamic provider. The redirect works fine so far, but another thing happened. Due some validation rules in the same method, a previous custom FacesMessage stays displayed and only after a page reload it goes away. Have someone an idea? Regards, Andreas Bernd Bohmann schrieb: Hello Andreas, maybe this help: http://wiki.apache.org/myfaces/Sending_Files You don't need a Servlet for sending binary data from jsf. The magic is the responseComplete() method. Please look at the Section 2.1.3 Faces Request Generates Non-Faces Response of the jsf 1.1 spec. Regards Bernd Andreas Niemeyer schrieb: Hi, I would like to send form data from a JSF page for a servlet request with a navigation rule. The servlet returns a content type of
[Trinidad] check for ppr with javascript
Hi, how can i check if a submit is/becomes a ppr-request? I want to register a (javascript) Event-Listener on form-tags and check if the submitted form is/becomes a ppr-submit. Is there anywhere a javascript documentation? (I know the ppr-site in developers guide, allready...) Any suggestions? Thanks, Daniel -- View this message in context: http://www.nabble.com/-Trinidad--check-for-ppr-with-javascript-tp20957976p20957976.html Sent from the MyFaces - Users mailing list archive at Nabble.com.
Trinidad version
Hi all, I'd like to find out the Trinidad version so that I can look at some of the known issues related to our version. I can see the following two libaries: trinidad-api-incubator-m1-SNAPSHOT.jar and trinidad-impl-incubator-m1-SNAPSHOT.jar in my workspace and there's adf-faces-version.txt in trinidad-impl-incubator-m1-SNAPSHOT.jar which says 11-m7. Can anyone please let me know? Many Thanks, Jing This e-mail is only for the above addressees. It may contain confidential or privileged information. If you are not an addressee you must not copy, distribute, disclose or use any of the information in it or any attachments. If you have received it in error please notify the sender and delete it immediately. Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500. Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555. Cheltenham Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372. Cheltenham Gloucester Savings is a division of Lloyds TSB Bank plc. Lloyds TSB Bank plc, Lloyds TSB Scotland plc and Cheltenham Gloucester plc are authorised and regulated by the Financial Services Authority. Lloyds TSB Group plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95000. Telephone: 0131 225 4555. Lloyds TSB Group plc is a signatory to the Banking Codes. Telephone calls may be monitored or recorded.
Re: [Trinidad] check for ppr with javascript
http://myfaces.apache.org/trinidad/devguide/ppr.html#Javascript%20APIs%20for%20PPR sample code: ... function generalPPRMonitor(state) { if (state == TrRequestQueue.STATE_BUSY) { showDivWait(); } else { closeDivWait(); } } function generalOnLoad() { var requestQueue = TrPage.getInstance().getRequestQueue(); requestQueue.addStateChangeListener(generalPPRMonitor); } ... trh:body onload=generalOnLoad(); ... Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Thu, Dec 11, 2008 at 1:44 PM, Daniel Niklas [EMAIL PROTECTED] wrote: Hi, how can i check if a submit is/becomes a ppr-request? I want to register a (javascript) Event-Listener on form-tags and check if the submitted form is/becomes a ppr-submit. Is there anywhere a javascript documentation? (I know the ppr-site in developers guide, allready...) Any suggestions? Thanks, Daniel -- View this message in context: http://www.nabble.com/-Trinidad--check-for-ppr-with-javascript-tp20957976p20957976.html Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Trinidad version
hello, you are using a quite old version. a release history + release notes are available at [1] regards, gerhard [1] https://issues.apache.org/jira/browse/TRINIDAD?report=com.sourcelabs.jira.plugin.portlet.releases:releases-projecttab 2008/12/9 Xu, Jing [EMAIL PROTECTED] Hi all, I'd like to find out the Trinidad version so that I can look at some of the known issues related to our version. I can see the following two libaries: trinidad-api-incubator-m1-SNAPSHOT.jar and trinidad-impl-incubator-m1-SNAPSHOT.jar in my workspace and there's adf-faces-version.txt in trinidad-impl-incubator-m1-SNAPSHOT.jar which says 11-m7. Can anyone please let me know? Many Thanks, Jing This e-mail is only for the above addressees. It may contain confidential or privileged information. If you are not an addressee you must not copy, distribute, disclose or use any of the information in it or any attachments. If you have received it in error please notify the sender and delete it immediately. Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500. Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555. Cheltenham Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372. Cheltenham Gloucester Savings is a division of Lloyds TSB Bank plc. Lloyds TSB Bank plc, Lloyds TSB Scotland plc and Cheltenham Gloucester plc are authorised and regulated by the Financial Services Authority. Lloyds TSB Group plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95000. Telephone: 0131 225 4555. Lloyds TSB Group plc is a signatory to the Banking Codes. Telephone calls may be monitored or recorded. -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: [Trinidad] check for ppr with javascript
Hi, Walter Mourão-2 wrote: function generalPPRMonitor(state) { if (state == TrRequestQueue.STATE_BUSY) { showDivWait(); } else { closeDivWait(); } } I'm not sure, but i think, that i wouldn't get a notification if it isn't a ppr request?! Daniel -- View this message in context: http://www.nabble.com/-Trinidad--check-for-ppr-with-javascript-tp20957976p20958883.html Sent from the MyFaces - Users mailing list archive at Nabble.com.
PDF File download from server using jsf,backing bean
Hello All, My requirement is as follows. There will be one hyperlink on the browser (through jsf) by name Help. Soon after user clicks on the link, a pdf or doc file has to be downloaded from the server. I'm planning to keep this pdf/doc file as a part of ear, while deploying this into server(As this is a static file, I felt it would be o.k to make this as a part of the ear). Can you please suggest how efficient the approach is. Is it just providing hyperlink, and set the location through html, so that download happens automatically at client end,through window dialog? Thanks Krishna.
Displaying messages over the content - generated by the content?
Hi, I've got a JSF page divided in 2 parts - the status message area and the content area. The content area is positioned under the status message area. In the status area all messages for the user should be shown - for example success messages, error messages and exceptions. In my content area I've got a tr:dataTable value=#{myBean.values}... When the method getValues() of myBean throws an exception, I'm catching this exception. I want to display this exception in the status message area - but this does not work - apparently because the status area is already rendered when the content el-methods are called. Is there any solution for this problem? Is it possible to render the status area at last? Thank you Felix
Re: [Trinidad] check for ppr with javascript
Hi, the code: ... function generalOnLoad() { var requestQueue = TrPage.getInstance().getRequestQueue(); requestQueue.addStateChangeListener(generalPPRMonitor); } ... Makes the generalPPRMonitor method function be executed only when the PPR starts/stops. Walter Mourão http://waltermourao.com.br http://arcadian.com.br http://oriens.com.br On Thu, Dec 11, 2008 at 2:26 PM, Daniel Niklas co...@dniklas.de wrote: Hi, Walter Mourão-2 wrote: function generalPPRMonitor(state) { if (state == TrRequestQueue.STATE_BUSY) { showDivWait(); } else { closeDivWait(); } } I'm not sure, but i think, that i wouldn't get a notification if it isn't a ppr request?! Daniel -- View this message in context: http://www.nabble.com/-Trinidad--check-for-ppr-with-javascript-tp20957976p20958883.html Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Displaying messages over the content - generated by the content?
hello, it's better to load it before the rendering process starts. you can do that on your own (depending on your application) or you can use e.g. a mechanism of orchestra (the prerender-method). regards, gerhard 2008/12/11 felix.bec...@t-systems.com Hi, I've got a JSF page divided in 2 parts – the status message area and the content area. The content area is positioned under the status message area. In the status area all messages for the user should be shown – for example success messages, error messages and exceptions. In my content area I've got a tr:dataTable value=#{myBean.values}... When the method getValues() of myBean throws an exception, I'm catching this exception. I want to display this exception in the status message area – but this does not work – apparently because the status area is already rendered when the content el-methods are called. Is there any solution for this problem? Is it possible to render the status area at last? Thank you Felix -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
RE: Displaying messages over the content - generated by the content?
Hi Gerhard, Thank you for your answer. Unfortunately I can't use orchestra here but a prerenderer method is exactly what I need. Can it be possible to hook up something like a prerendererphase in myfaces / Trinidad? I don't see any other way how solve this problem. Thank you Felix From: Gerhard Petracek [mailto:gerhard.petra...@gmail.com] Sent: Thursday, December 11, 2008 6:29 PM To: MyFaces Discussion Subject: Re: Displaying messages over the content - generated by the content? hello, it's better to load it before the rendering process starts. you can do that on your own (depending on your application) or you can use e.g. a mechanism of orchestra (the prerender-method). regards, gerhard 2008/12/11 felix.bec...@t-systems.com Hi, I've got a JSF page divided in 2 parts - the status message area and the content area. The content area is positioned under the status message area. In the status area all messages for the user should be shown - for example success messages, error messages and exceptions. In my content area I've got a tr:dataTable value=#{myBean.values}... When the method getValues() of myBean throws an exception, I'm catching this exception. I want to display this exception in the status message area - but this does not work - apparently because the status area is already rendered when the content el-methods are called. Is there any solution for this problem? Is it possible to render the status area at last? Thank you Felix -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: Displaying messages over the content - generated by the content?
hello, matthias wrote about the view controller of shale and orchestra - see [1]. a description of the shale view controller is available at [2]. regards, gerhard [1] http://matthiaswessendorf.wordpress.com/2007/10/19/viewcontrollers-in-orchestra/ [2] http://shale.apache.org/shale-view/index.html 2008/12/11 felix.bec...@t-systems.com Hi Gerhard, Thank you for your answer. Unfortunately I can't use orchestra here but a prerenderer method is exactly what I need. Can it be possible to hook up something like a prerendererphase in myfaces / Trinidad? I don't see any other way how solve this problem. Thank you Felix -- *From:* Gerhard Petracek [mailto:gerhard.petra...@gmail.com] *Sent:* Thursday, December 11, 2008 6:29 PM *To:* MyFaces Discussion *Subject:* Re: Displaying messages over the content - generated by the content? hello, it's better to load it before the rendering process starts. you can do that on your own (depending on your application) or you can use e.g. a mechanism of orchestra (the prerender-method). regards, gerhard 2008/12/11 felix.bec...@t-systems.com Hi, I've got a JSF page divided in 2 parts – the status message area and the content area. The content area is positioned under the status message area. In the status area all messages for the user should be shown – for example success messages, error messages and exceptions. In my content area I've got a tr:dataTable value=#{myBean.values}... When the method getValues() of myBean throws an exception, I'm catching this exception. I want to display this exception in the status message area – but this does not work – apparently because the status area is already rendered when the content el-methods are called. Is there any solution for this problem? Is it possible to render the status area at last? Thank you Felix -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Thread safety for Orchestra access scope
I was under the impression that beans that I set up with access scope will need to be thread safe because I could have a user open two tabs (with the same conversation context) and submit to the same page simultaneously (or double submit on the same tab). But I was running some tests and it seems like something in the framework is forcing accesses to my beans to be executed in sequence rather than simultaneously. Specifically I set it up so I had the first request stuck at a breakpoint and submitted a second request (that does not hit the breakpoint), but I found that *both* requests are stuck until I resume the thread stuck at the breakpoint. Any insights? -Jacob Mathew
inputTextHelp - style of help text
Is there a way to make the help text a different color and/or font. For example: I would like to the help text to be light grey...and the text the user enters to be black. Can this be done? Don't see any style attributes associated with the help text. Thanks. Matt -- View this message in context: http://www.nabble.com/inputTextHelp---style-of-help-text-tp20964775p20964775.html Sent from the MyFaces - Users mailing list archive at Nabble.com.
Re: Trinidad version
WOW.. That IS old. That's from when we were back in incubator. Gerhard Petracek wrote: hello, you are using a quite old version. a release history + release notes are available at [1] regards, gerhard [1] https://issues.apache.org/jira/browse/TRINIDAD?report=com.sourcelabs.jira.plugin.portlet.releases:releases-projecttab 2008/12/9 Xu, Jing jing...@lloydstsb.co.uk mailto:jing...@lloydstsb.co.uk Hi all, I'd like to find out the Trinidad version so that I can look at some of the known issues related to our version. I can see the following two libaries: trinidad-api-incubator-m1-SNAPSHOT.jar and trinidad-impl-incubator-m1-SNAPSHOT.jar in my workspace and there's adf-faces-version.txt in trinidad-impl-incubator-m1-SNAPSHOT.jar which says 11-m7. Can anyone please let me know? Many Thanks, Jing This e-mail is only for the above addressees. It may contain confidential or privileged information. If you are not an addressee you must not copy, distribute, disclose or use any of the information in it or any attachments. If you have received it in error please notify the sender and delete it immediately. Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500. Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555. Cheltenham Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372. Cheltenham Gloucester Savings is a division of Lloyds TSB Bank plc. Lloyds TSB Bank plc, Lloyds TSB Scotland plc and Cheltenham Gloucester plc are authorised and regulated by the Financial Services Authority. Lloyds TSB Group plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95000. Telephone: 0131 225 4555. Lloyds TSB Group plc is a signatory to the Banking Codes. Telephone calls may be monitored or recorded. -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces
Re: Thread safety for Orchestra access scope
The source code for Orchestra provided the answer I was looking for. It looks like a lock is acquired on the conversationcontext object corresponding to the request before accessing any of the beans inside of a conversation. So the execution of two requests in the same conversationcontext will not happen concurrently, which mean beans in a conversation (access) scope do no, in general, need to be thread safe. Explicit documentation of this will probably be useful. -Jacob On Thu, Dec 11, 2008 at 10:52 AM, Jacob Mathew jacobgmat...@gmail.comwrote: I was under the impression that beans that I set up with access scope will need to be thread safe because I could have a user open two tabs (with the same conversation context) and submit to the same page simultaneously (or double submit on the same tab). But I was running some tests and it seems like something in the framework is forcing accesses to my beans to be executed in sequence rather than simultaneously. Specifically I set it up so I had the first request stuck at a breakpoint and submitted a second request (that does not hit the breakpoint), but I found that *both* requests are stuck until I resume the thread stuck at the breakpoint. Any insights? -Jacob Mathew
Re: h:messages and redirect in action method: how to reload page?
Andraes, This would go against the faces spec. Messages should be available for all phases of the lifecycle. Portals have a special case in that they have a dual-phased lifecycle where, generally, one expects these messages to be present for subsequent renders. The only thing I could suggest is to maybe come up with other then a custom validator would be to write a custom FacesContext decorator that overrides either the getFacesMessages object or the AddMessage under certain conditions. Additionally, I think if you set immediate=true on the command button, the even should process before the validations do. Scott Andreas Niemeyer wrote: Hi, I there a way to force a view reload after a process action was called? In the view there is a commandButton with an action method. In that method a redirect with following context.responseComplete() is called. The redirect to a servlet works fine, a content type of application/pdf as the content type of the response brings up a save as dialog. The problem I have is a previous custom generated FacesMessage which still stays displayed if the validation fails in that method. When the next time the validation is successful, the redirect will be done. The reason is that the action is completed after the response and no page reload/refresh is triggered. How can I do that? My context is a portal with MyFacesGenericPortlet implementation. Maybe is this the place to refresh that page in some way? I can't change the validation in that backing bean action method, since the view has 2 t:inputCalendar components and the validation covers the correctness of the dates in relation and if the fields are not null. Maybe a special validator could help as another solution? Thank for help in advance. Kind regards, Andreas
Re: Thread safety for Orchestra access scope
It should be noted that the border case where the first request creates a new conversationcontext is not completely sound. In this scenario, no lock is acquired because nothing else can refer to that newly created [conversationcontext] id until the response for this request has been sent back to the client browser. This is not true. The second request can simply guess the conversationcontext id which is a simple alphanumeric increment. Admittedly not a situation likely to happen unless someone was explicitly trying to break the application, but a legitimate hole nonetheless. -Jacob On Thu, Dec 11, 2008 at 4:14 PM, Jacob Mathew jacobgmat...@gmail.comwrote: The source code for Orchestra provided the answer I was looking for. It looks like a lock is acquired on the conversationcontext object corresponding to the request before accessing any of the beans inside of a conversation. So the execution of two requests in the same conversationcontext will not happen concurrently, which mean beans in a conversation (access) scope do no, in general, need to be thread safe. Explicit documentation of this will probably be useful. -Jacob On Thu, Dec 11, 2008 at 10:52 AM, Jacob Mathew jacobgmat...@gmail.comwrote: I was under the impression that beans that I set up with access scope will need to be thread safe because I could have a user open two tabs (with the same conversation context) and submit to the same page simultaneously (or double submit on the same tab). But I was running some tests and it seems like something in the framework is forcing accesses to my beans to be executed in sequence rather than simultaneously. Specifically I set it up so I had the first request stuck at a breakpoint and submitted a second request (that does not hit the breakpoint), but I found that *both* requests are stuck until I resume the thread stuck at the breakpoint. Any insights? -Jacob Mathew
What is Dependency Injection .
Hello All, What is dependency injection in term of JSF. managed-bean managed-bean-nameadress/managed-bean-name managed-bean-classx.y.z.Adress/managed-bean-class managed-bean-scopesession/managed-bean-scope managed-property property-name../property-name property-class.../property-class value#{adress}/value /managed-property /managed-bean
Re: Thread safety for Orchestra access scope
Hi Jacob, Thanks very much for your comments. I don't believe that guessing the conversationcontextid is significant, because the id is per-session. As you point out, someone *can* maliciously try to guess the value, thereby creating race conditions for data *in their own session*. But I don't see any way to expand that to corrupt data in other sessions or create a denial-of-service for anyone else. If you can think of a way someone can use this to affect anyone other than themself, please let me know! Note that having two tabs or windows with the same conversationContextId is a bad idea; separate windows should have separate conversationContextId values. The per-context locking is really just to ensure that things like users double-clicking on a submit button don't cause races. If the user can select the same view in two different windows, and you use the same conversationContextId (or a session-scoped backing bean) then the two windows will interact in unpleasant ways. Having different conversationContextIds ensures that the backing bean instance is *different* for the two windows, so no nasty interactions occur. Note also that if you want multiple windows, you really should select client-side-state-saving. See here for more details: http://myfaces.apache.org/orchestra/myfaces-orchestra-core/multiwindow.html That's the reason there isn't much documentation on the conversation locking feature of Orchestra; apps should use different conversationContextIds for different windows. The locking is just a safety measure for some odd corner cases, not a major user feature. Regards, Simon Jacob Mathew schrieb: It should be noted that the border case where the first request creates a new conversationcontext is not completely sound. In this scenario, no lock is acquired because nothing else can refer to that newly created [conversationcontext] id until the response for this request has been sent back to the client browser. This is not true. The second request can simply guess the conversationcontext id which is a simple alphanumeric increment. Admittedly not a situation likely to happen unless someone was explicitly trying to break the application, but a legitimate hole nonetheless. -Jacob On Thu, Dec 11, 2008 at 4:14 PM, Jacob Mathew jacobgmat...@gmail.com mailto:jacobgmat...@gmail.com wrote: The source code for Orchestra provided the answer I was looking for. It looks like a lock is acquired on the conversationcontext object corresponding to the request before accessing any of the beans inside of a conversation. So the execution of two requests in the same conversationcontext will not happen concurrently, which mean beans in a conversation (access) scope do no, in general, need to be thread safe. Explicit documentation of this will probably be useful. -Jacob On Thu, Dec 11, 2008 at 10:52 AM, Jacob Mathew jacobgmat...@gmail.com mailto:jacobgmat...@gmail.com wrote: I was under the impression that beans that I set up with access scope will need to be thread safe because I could have a user open two tabs (with the same conversation context) and submit to the same page simultaneously (or double submit on the same tab). But I was running some tests and it seems like something in the framework is forcing accesses to my beans to be executed in sequence rather than simultaneously. Specifically I set it up so I had the first request stuck at a breakpoint and submitted a second request (that does not hit the breakpoint), but I found that *both* requests are stuck until I resume the thread stuck at the breakpoint. Any insights? -Jacob Mathew -- -- Emails in mixed posting style will be ignored -- (http://en.wikipedia.org/wiki/Posting_style)
Re: Displaying messages over the content - generated by the content?
felix.bec...@t-systems.com schrieb: Hi, I’ve got a JSF page divided in 2 parts – the status message area and the content area. The content area is positioned under the status message area. In the status area all messages for the user should be shown – for example success messages, error messages and exceptions. In my content area I’ve got a tr:dataTable value=”#{myBean.values}”... When the method getValues() of myBean throws an exception, I’m catching this exception. I want to display this exception in the status message area – but this does not work – apparently because the status area is already rendered when the content el-methods are called. Is there any solution for this problem? Is it possible to render the status area at last? I can't think of an easy solution for this. Output generated during rendering is (at least theoretically) sent over the network to the remote browser as it is created. So as you point out, your status area has already been written before you encounter the exception. There is no TCP feature to unsend data. One obvious option would be to move your status area to the bottom of the page. Or you could write out the status area at the bottom of the page, then use CSS positioning rules to make it *appear* at the top of the page. Or use javascript to move the generated messages block from the bottom of the page to the top. Note that JSF messages created during: * conversion * validation * action-handling are no problem. It is only exceptions during rendering that would be an issue. I can't think why you would be getting errors during fetching of rendered data; I've not had to deal with that before except when wanting to display some kind of result set too large message. Maybe you can move the fetching of this data up into the action method of your bean? Regards, Simon -- -- Emails in mixed posting style will be ignored -- (http://en.wikipedia.org/wiki/Posting_style)