Re: Tag Only Works Within a Request?
It seems like the best way to do this is to create a PhaseListener, "that moves messages from the FacesContext to the user's session and back in the appropriate phases of the JSF lifecycle. " Please see Variant 2: http://jsffaq.com/Wiki.jsp?ptitle=How+to+show+Faces+Message+on+the+Next+Page%3F&page=HowToShowFacesMessageOnTheNextPage I think this approach can be greatly simplified by not getting all the messages from the FacesContext, then cycling through the messages and removing the client specific messages, then putting the remaining messages into the session, Rather, in most cases you are going to know the message or messages you want to appear on the next page; it will be much simpler to place these messages directly into a collection which is held in the session, and then all the PhaseListener has to do is check the session object and get the messages at the beginning of the next cycle and then put the messages into the FacesContext. It seems like a cool approach. I shall give it a try. Thx to: mailto:[EMAIL PROTECTED]">Jesse Wilson BTW: Shouldn't this behavior be intrinsic to JSF? Mike --- Mike Duffy <[EMAIL PROTECTED]> wrote: > It seems that the tag only works within a request. If something > goes wrong on the > current page, the messages display fine. > > What I would like to be able to do is display a message on the next page (in > a new request > scope) > once the current page has processed. I can't seem to get this to work. > > Is there a session scope for the ? > > Am I missing something basic? > > Thx. > > Mike > > __ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
returning to same position within a datascroller?
Is it possible to return to the same position within a datascroller after leaving the page and returning (i.e., datatable displays a large result set; user has scrolled through the data and is on the 3rd page of data; user selects a record which links them to a detail page; now want to return the user to the original .jsf page at the same 3rd page of data within the datascroller)? If so, how? thanks
Re: How I can read managed property value from faces-config file in class constructor?
Yogesh Chaudhari wrote: Hi, I would like to read "show" managed property value in InvoiceBean class constructor so I can populate different resultset in "invoices" arraylist to display on page. Thanks, Yogesh public class InvoiceBean { private String show; ArrayList invoices; public InvoiceBean () { System.out.println("show invoices " + show); invoices = getInvoices(); } invoiceALLBean org.adr.faces.backing.InvoiceBean request show java.lang.String ALL invoicePENDINGBean org.adr.faces.backing.InvoiceBean request show java.lang.String PENDING .. .. .. The short answer is you can't. Properties are set on a bean after it's constructed (since before it's constructed there's nothing to set a property on...). You have a couple of options: - call getInvoices() from setShow() - call getInvoices() lazily when needed, after the show property has been set. I'd recommend the latter but either would work. L.
Re: How I can read managed property value from faces-config file in class constructor?
Whem Myfaces loads, it unmarshalls the faces configurations file(s) into an object model. It stores this in application scope, check the source in order to find out which attribute key this is, I forget. You can also just create your own. FacesConfigUnmarshaller _unmarshaller = new DigesterFacesConfigUnmarshallerImpl(null); InputStream is = new FileInputStream(new File(pathToFacesConfig)); FacesConfigDispenser dispenser = new DigesterFacesConfigDispenserImpl(); dispenser.feed(_unmarshaller.getFacesConfig(is, path)); This of course is vendor lock-in. Dennis Byrne >-Original Message- >From: Yogesh Chaudhari [mailto:[EMAIL PROTECTED] >Sent: Saturday, February 4, 2006 05:08 PM >To: 'MyFaces Discussion' >Subject: How I can read managed property value from faces-config file in class >constructor? > >Hi, > >I would like to read "show" managed property value in InvoiceBean >class constructor so I can populate different resultset in "invoices" >arraylist to display on page. > >Thanks, Yogesh > >public class InvoiceBean { > private String show; > ArrayList invoices; > > public InvoiceBean () { > System.out.println("show invoices " + show); > invoices = getInvoices(); > } > > > >invoiceALLBean >org.adr.faces.backing.InvoiceBean >request > > show > java.lang.String > ALL > > > > >invoicePENDINGBean >org.adr.faces.backing.InvoiceBean >request > > show > java.lang.String > PENDING > > >. >. >. > >
Tag Only Works Within a Request?
It seems that the tag only works within a request. If something goes wrong on the current page, the messages display fine. What I would like to be able to do is display a message on the next page (in a new request scope) once the current page has processed. I can't seem to get this to work. Is there a session scope for the ? Am I missing something basic? Thx. Mike __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
How I can read managed property value from faces-config file in class constructor?
Hi, I would like to read "show" managed property value in InvoiceBean class constructor so I can populate different resultset in "invoices" arraylist to display on page. Thanks, Yogesh public class InvoiceBean { private String show; ArrayList invoices; public InvoiceBean () { System.out.println("show invoices " + show); invoices = getInvoices(); } invoiceALLBean org.adr.faces.backing.InvoiceBean request show java.lang.String ALL invoicePENDINGBean org.adr.faces.backing.InvoiceBean request show java.lang.String PENDING . . .
UISelectOne or UISelectMany with spread layout in HtmlPanelGrid
Hi! If I add a UISelectOne or UISelectMany component with spread layout as child to a HtmlPanelGrid, does this component count as child or not. In JSP, I think it doesn't count as child, but the single HtmlRadio or HtmlCheckbox components. This is what I'd expect when I build the UI programmatically. If it does also count as child, I have a problem... Regards, Matthias
Re: Best Way to Get Request Parameters
Perfect. Thx Matthias --- Matthias Wessendorf <[EMAIL PROTECTED]> wrote: > Hi Mike > > > HttpServletRequest request = > > > > (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest(); > > > > String someParameterValue = > > request.getParameter(Constants.SOME_PARAMETER_KEY); > > > > I have a feeling that this is not the best way. Is there some methodology > > in JSF that allows > me > > to hide the HttpServletRequest? Any suggestions? > > yes! Faces provides a Map for HTTP parameters. Call this: > > Map params = > FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); > > params.get(Constants.SOME_PARAMETER_KEY); > > so you are not tied to Servlet API inside of your backing beans. > > > Copy and paste from getRequestParameterMap()'s JavaDoc: > > > Servlet: This must be the set of parameters available via the > javax.servlet.ServletRequest methods getParameter() and > getParameterNames(). > > Portlet: This must be the set of parameters available via the > javax.portlet.PortletRequest methods getParameter() and > getParameterNames(). > > > HTH, > Matthias > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: Panel Grid custom component
Hey Volker,I tried to add the components as you have instructed but nothing at all gets rendered that way. i wonder if im inheriting my component from the right base class UIPanel in my case any how the code im trying now is: public void encodeBegin( FacesContext context ) { try { ResponseWriter writer = context.getResponseWriter(); writer.writeComment("* THIS IS THE START OF COMPONENT **"); HtmlPanelGrid panelGrid = new HtmlPanelGrid(); List children = panelGrid.getChildren(); panelGrid.setColumns(2); UIOutput labelName = new UIOutput(); labelName.setValue("Enter name: "); panelGrid.getChildren().add(labelName); UIInput inputName = new UIInput(); children.add(inputName); UIOutput labelAge = new UIOutput(); labelAge.setValue("Enter age: "); children.add(labelAge); UIInput inputAge = new UIInput(); children.add(inputAge); this.getChildren().add(panelGrid); super.encodeBegin(context); writer.writeComment("* THIS IS THE END OF COMPONENT **"); } catch( IOException e ) { } } Thanx a lot for your help though ...AliOn 2/3/06, Volker Weber <[EMAIL PROTECTED]> wrote: Hi Ali,there are some things you made wrong:First, and this seems to be a popular error: you can't add a componentto another by setting the parent of the child! useparent.getChildren().add(child) instead. Than: You dont neet to invoke encoding on every component, just createthen component tree and let jsf do the rest.Try this :public void encodeBegin( FacesContext context ){ HtmlPanelGrid panelGrid = new HtmlPanelGrid(); panelGrid.setColumns(2); List children = panelGrid.getChildren(); UIOutput labelName = new UIOutput(); labelName.setValue("Enter name: "); labelName.setId("nameId"); children.add(labelName); UIInput inputName = new UIInput(); inputName.setId("inputNameId"); // UIInput needs a valueBinding children.add(inputName); UIOutput labelAge = new UIOutput(); labelAge.setValue("Enter age: "); labelName.setId("ageId"); children.add(labelAge); UIInput inputAge = new UIInput(); inputAge.setId("inputAgeId"); // UIInput needs a valueBinding children.add(inputAge); this.getChildren.add(panelGrid); super.encodeBegin(context);}Regards, VolkerAli Raza wrote:> Greetings again,>> Instead of adding components by rendering the htl myself i am adding > chilid components and calling their encode methods as following:>> public void encodeBegin( FacesContext context )> {> try> {> ResponseWriter writer = context.getResponseWriter();> writer.writeComment("* THIS> IS THE START OF COMPONENT> **");> > HtmlPanelGrid panelGrid = new HtmlPanelGrid();> panelGrid.setColumns(2);> panelGrid.encodeChildren(context);>> addComponentBegin(context, "panelGridId", this, panelGrid); > addComponentEnd(context, panelGrid);>> UIOutput labelName = new UIOutput();> labelName.setValue("Enter name: ");> addComponentBegin(context, "nameId", panelGrid, labelName); > addComponentEnd(context, labelName);>> UIInput inputName = new UIInput();> addComponentBegin(context, "inputNameId", panelGrid, inputName);> addComponentEnd(context, inputName); >> UIOutput labelAge = new UIOutput();> labelAge.setValue("Enter age: ");> addComponentBegin(context, "ageId", panelGrid, labelAge);> addComponentEnd(context, labelAge); >> UIInput inputAge = new UIInput();> addComponentBegin(context, "inputAgeId", panelGrid, inputAge);> addComponentEnd(context, inputAge);> writer.writeComment("* THIS> IS THE END OF COMPONENT> **");> } > catch( IOException e )> {>> }> }>> public static void addComponentBegin( FacesContext context, String> componentId, UIComponent parentComponent, UIComponent childComponent ) > throws IOException> {> if( componentId != null )> {> childComponent.setId( componentId );> }>> childComponent.setParent ( parentComponent );> childComponent.encodeBegin ( context );> }>> public static void addComponentEnd( FacesContext context,> UIComponent childComponent ) throws IOException > {>
weird error when using jscookmenu / not sure w here problem is
hello all, i have a webapp that uses myfaces..as menu of application, i have always used struts-menu and everythingworked fine.. so i decided to move to use jscookmenu.Menu is displayed fine, however something weird is happening when i clikc on one menu item, i am redirected to the proper page (i am using tiles)but when i complete hte form on the page and click 'submit', my backed bean is neverinvoked...i cant understand where the problem is can anyone help me out? my app works with in-memory database, so in extreme casei can mail it privatelybut what i don't understand is why the page doesnot get submittedhere is a brief of my navigation rules.. navigation rule *** * go_to_insertExpense /insert.jsp go_to_queryExpense /query.jsp go_to_modifyExpense /modify.jsp end of navigation rule ***AND HTIS is the source of the page, if it can help source **< HTML>Insert Entrytitle> HEAD > < tr>
This should be a proper header.td>tr>