Re: Distinguish if parameters are sent by POST or GET
Hallo Volker This worked! Thank You. Georg 2015-03-18 18:36 GMT+01:00 Volker Weber : > Hi Georg, > > in ServletContext you can use HttpServletRequest.getMethod(): > ((HttpServletRequest) > > FacesContext.getCurrentInstance().getExternalContext().getRequest()).getMethod() > > regards, > > Volker > > > > > 2015-03-18 15:46 GMT+01:00 Georg Füchsle : > > > Hallo Max, > > > > Thanks for replying. My attempt did not work: > > > > I want distinguish GET and POST inside a PhaseListener. > > > > In the PhaseListener I receive the FacesContext from the PhaseEvent. I > also > > tried to receive the FacesContext from static: > > > > public void beforePhase(PhaseEvent event) > > { > >if (event.getPhaseId() == PhaseId.RESTORE_VIEW) > > { > > > > ExternalContext extCtx = > > event.getFacesContext().getExternalContext(); > > > > boolean post1 = FacesContext.getCurrentInstance().isPostback(); > > > > boolean post2 = event.getFacesContext().isPostback(); > > > > logger.info("post1: " + post1 + " - post2: " + post2); > > > > > > > > Called With Get: > > http://localhost:8080/TextTool/pages/start/texttool.jsf?BEDIENER=Gio > > 15:41:04,609 INFO [jsf.StartPhaseListener] (default task-60) > > *post1: false - post2: false* > > > > Called with POST from a form: > > 15:42:09,045 INFO [jsf.StartPhaseListener] (default task-69) *post1: > > false - post2: false* > > > > > > What do I do wrong? > > > > Gio > > > > 2015-03-18 15:18 GMT+01:00 Max Starets : > > > > > Georg, > > > > > > Have you tried isPostback() on FacesContext? If you are not including > > view > > > state as one of the parameters, it will return false for GET requests. > > > > > > Max > > > > > > > > > On 3/18/2015 9:19 AM, Georg Füchsle wrote: > > > > > >> Hallo! > > >> > > >> Is it possible to see if a parameter read in my jsf-app was sent by > post > > >> or > > >> by get? > > >> > > >> My webapp should be startet calling a starturl with some post > > parameters. > > >> I > > >> would like to forebid the use of get parameters. is it possible? > > >> > > >> thanks > > >> > > >> Gio > > >> > > >> > > > > > > > > > -- > inexso - information exchange solutions GmbH > Ofener Straße 30 | 26121 Oldenburg > www.inexso.de >
Re: Distinguish if parameters are sent by POST or GET
Hallo Max, Thanks for replying. My attempt did not work: I want distinguish GET and POST inside a PhaseListener. In the PhaseListener I receive the FacesContext from the PhaseEvent. I also tried to receive the FacesContext from static: public void beforePhase(PhaseEvent event) { if (event.getPhaseId() == PhaseId.RESTORE_VIEW) { ExternalContext extCtx = event.getFacesContext().getExternalContext(); boolean post1 = FacesContext.getCurrentInstance().isPostback(); boolean post2 = event.getFacesContext().isPostback(); logger.info("post1: " + post1 + " - post2: " + post2); Called With Get: http://localhost:8080/TextTool/pages/start/texttool.jsf?BEDIENER=Gio 15:41:04,609 INFO [jsf.StartPhaseListener] (default task-60) *post1: false - post2: false* Called with POST from a form: 15:42:09,045 INFO [jsf.StartPhaseListener] (default task-69) *post1: false - post2: false* What do I do wrong? Gio 2015-03-18 15:18 GMT+01:00 Max Starets : > Georg, > > Have you tried isPostback() on FacesContext? If you are not including view > state as one of the parameters, it will return false for GET requests. > > Max > > > On 3/18/2015 9:19 AM, Georg Füchsle wrote: > >> Hallo! >> >> Is it possible to see if a parameter read in my jsf-app was sent by post >> or >> by get? >> >> My webapp should be startet calling a starturl with some post parameters. >> I >> would like to forebid the use of get parameters. is it possible? >> >> thanks >> >> Gio >> >> >
Distinguish if parameters are sent by POST or GET
Hallo! Is it possible to see if a parameter read in my jsf-app was sent by post or by get? My webapp should be startet calling a starturl with some post parameters. I would like to forebid the use of get parameters. is it possible? thanks Gio
Re: Read Server Ip and Port inside JSF
Hallo Ludovic, the application is deployed for several customers on different AppServers in different architectures and even on different OS. I cannot test the request in all possible cases. For that reason I decided to make a config-param to determine the url of the service. Thanks for your help. Best regards, Gio 2014-06-05 18:37 GMT+02:00 l.pe...@senat.fr : > On 05/06/2014 18:31, Georg Füchsle wrote: > >> Hallo Ludovic, >> >> thanks for Your answer. But it didn't work for me. In my example the >> header: >> String forwardedFor = req.getHeader("X-Forwarded-For") >> was null. >> >> I also found this link: >> http://stackoverflow.com/questions/3867197/get-the- >> server-port-number-from-tomcat-with-out-a-request >> But also there I didnt find an answer. Maybe I will make a configuration >> for the internal URL and use this. The administrators will damn me. >> > Did you try to inspect the request with a tool such as Firebug ? I would > be very suprised that you have no header where to find what you want. > If not, your admins should really setup the proxies so that they add such > a header. > > Best regards, > > > Ludovic > | > | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. > | > >
Re: Read Server Ip and Port inside JSF
Hallo Ludovic, thanks for Your answer. But it didn't work for me. In my example the header: String forwardedFor = req.getHeader("X-Forwarded-For") was null. I also found this link: http://stackoverflow.com/questions/3867197/get-the-server-port-number-from-tomcat-with-out-a-request But also there I didnt find an answer. Maybe I will make a configuration for the internal URL and use this. The administrators will damn me. Cheers Gio 2014-06-05 17:01 GMT+02:00 l.pe...@senat.fr : > On 05/06/2014 14:59, Georg Füchsle wrote: > >> Hallo, >> >> my Application is deployed inside a Firewall and/or behind a >> Load-Balancer. >> >> My application provies a web-app and an web-service. At some time i have >> to >> call my own web-service from the web-app. In this case I have to use the >> internal URL of my server. >> >> At another time I have to give the public URL of my web-app to an >> interface >> to other apps or services. In that caes i have to use the external URL of >> my web-app. ( That is the URL of the firewall >> or the load balancer) >> >> For example: >> >> The App is deployed internal on the Server with the name webserver1. So >> the >> internal URL would be: >> >> http://webserver1:8080/myapp/ >> >> But from outside the office I have to call the Url of the Firewall/Load >> balancer: >> >> http::// www.mycompany.com/myapp/ >> >> >> >> I found a way to read the current URL from the request: >> >> HttpServletRequest request = (HttpServletRequest) >> FacesContext.getCurrentInstance().getExternalContext().getRequest(); >> URL reconstructedURL; >> reconstructedURL = new URL(request.getScheme(), request.getServerName(), >> request.getServerPort(), ""); >> >> But the result is the internal URL, when the User is using the internal >> URL >> and the external URL, when the user is using the external URL. >> >> >> Is there a possibility to read the internal server-name and port in any >> case? >> > This is not exactly your question, but I have a similar problem when I > have to get the real source address of a forwarded request. > > I use this function in this case : > > public static String getRemoteAddr(HttpServletRequest req) { > String forwardedFor = req.getHeader("X-Forwarded-For"); > if(StringUtils.isNotBlank(forwardedFor)) { > return forwardedFor.split("\\s*,\\s*", 2)[0]; // liste > d'adresses de la forme : client, proxy1, proxy2, etc. > } > return req.getRemoteAddr(); > } > > I guess, but do not have a requyest to your server at hand to check it, > that there must be a header in your request that you can analyse in a > similar way to get what you are looking for. > With forwardedFor.split("\\s*,\\s*", 2)[1] , I guess that you would have > your public address. > > Hope this helps. > > Ludovic > | > | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. > | > >
Re: Read Server Ip and Port inside JSF
Hallo, I can find the servername by this: String servername; try { servername = InetAddress.getLocalHost().getHostName(); // mymachine } catch (UnknownHostException e) { servername = System.getenv("COMPUTERNAME");// MYMACHINE on Windows if servername == null || servername.length() == 0) { servername = System.getenv("HOSTNAME"); // mymachine on Unix } } But I still have to find out the port and the protocol of my app. I would prefer to read it from the machine than to configure it in the web.xml manually. Any proposals? Thanks! 2014-06-05 14:59 GMT+02:00 Georg Füchsle : > Hallo, > > my Application is deployed inside a Firewall and/or behind a Load-Balancer. > > My application provies a web-app and an web-service. At some time i have > to call my own web-service from the web-app. In this case I have to use the > internal URL of my server. > > At another time I have to give the public URL of my web-app to an > interface to other apps or services. In that caes i have to use the > external URL of my web-app. ( That is the URL of the firewall > or the load balancer) > > For example: > > The App is deployed internal on the Server with the name webserver1. So > the internal URL would be: > > http://webserver1:8080/myapp/ > > But from outside the office I have to call the Url of the Firewall/Load > balancer: > > http::// www.mycompany.com/myapp/ > > > > I found a way to read the current URL from the request: > > HttpServletRequest request = (HttpServletRequest) > FacesContext.getCurrentInstance().getExternalContext().getRequest(); > URL reconstructedURL; > reconstructedURL = new URL(request.getScheme(), request.getServerName(), > request.getServerPort(), ""); > > But the result is the internal URL, when the User is using the internal > URL and the external URL, when the user is using the external URL. > > > Is there a possibility to read the internal server-name and port in any > case? > > > Thanks, > > Gio > >
Read Server Ip and Port inside JSF
Hallo, my Application is deployed inside a Firewall and/or behind a Load-Balancer. My application provies a web-app and an web-service. At some time i have to call my own web-service from the web-app. In this case I have to use the internal URL of my server. At another time I have to give the public URL of my web-app to an interface to other apps or services. In that caes i have to use the external URL of my web-app. ( That is the URL of the firewall or the load balancer) For example: The App is deployed internal on the Server with the name webserver1. So the internal URL would be: http://webserver1:8080/myapp/ But from outside the office I have to call the Url of the Firewall/Load balancer: http::// www.mycompany.com/myapp/ I found a way to read the current URL from the request: HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); URL reconstructedURL; reconstructedURL = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), ""); But the result is the internal URL, when the User is using the internal URL and the external URL, when the user is using the external URL. Is there a possibility to read the internal server-name and port in any case? Thanks, Gio
Re: Consume a ASP.Net Service with windows Authentification from JSF
I cancelled this! Still I am not shure about how this has to be done. But I assumed, that I have to send autentication requests to the domain server of the partner company. When I asked for this information (ip and port of the domain server) the partner company stopped their plans and now will offer access top the REST-Service with other autentication proofs. So I will not struggle anymore on this topic. Thank You for your help! Gio 2013/7/25 Georg Füchsle > Thanks! Im am still working for it.If I have a solution i will paste it > here. > > > 2013/7/25 Mike Kienenberger > >> I really don't know the details of how it works, but the jcifs servlet >> filter is sufficient to allow NTLM domain-authenticated connections from >> both IE and Firefox to a JSF application most of the time, providing >> all of your web.xml settings are correct. I'm not exactly certain >> how that would play out for connecting to an ASP.NET RESTful service >> instead. >> >> If nothing else, the source code should give you some idea of what's >> going on in a transaction. >> >> On Thu, Jul 25, 2013 at 3:06 AM, Georg Füchsle >> wrote: >> > Thank you both, >> > I will try the jcifs first. >> > >> > The autentication method ist NTLM. I assume the Autentification header >> is >> > part of the http-Headers. Is this header only sent from a specially >> > configured browser. Because I try with my own machine and own Browser >> > >> > Thanks >> > Gio. >> > >> > >> > 2013/7/24 Jim May >> > >> >> You would need to find a way to set the authentication header. I dont >> know >> >> how easily that is with windows authentication. Maybe painful. You may >> have >> >> to switch the authentication method OR setup something like oauth that >> uses >> >> tokens so that the two apps trust each other. >> >> On Jul 24, 2013 5:46 AM, "Georg Füchsle" >> wrote: >> >> >> >> > I have to make calls to an customers ASP.NET RESTful Service. This >> >> service >> >> > is protecetd by a windows authentification. >> >> > >> >> > As far as I assume, this means, the user will use a browser on a >> windows >> >> > computer inside their company. They open my web-app that is hosted >> >> outside >> >> > their company. From this web-Apap I call again the REST-Service >> inside >> >> this >> >> > company. To have permission to the service I have to send the user >> >> > authentification data. >> >> > >> >> > My question: What do I (in the JSF-web-app outside the company) have >> to >> >> do >> >> > to deliver the user-information towards the REST-service? >> >> > >> >> > Has anybody done something like this? >> >> > >> >> > >> >> > Thanks in advance, >> >> > >> >> > Gio >> >> > >> >> >> > >
Re: Consume a ASP.Net Service with windows Authentification from JSF
Thanks! Im am still working for it.If I have a solution i will paste it here. 2013/7/25 Mike Kienenberger > I really don't know the details of how it works, but the jcifs servlet > filter is sufficient to allow NTLM domain-authenticated connections from > both IE and Firefox to a JSF application most of the time, providing > all of your web.xml settings are correct. I'm not exactly certain > how that would play out for connecting to an ASP.NET RESTful service > instead. > > If nothing else, the source code should give you some idea of what's > going on in a transaction. > > On Thu, Jul 25, 2013 at 3:06 AM, Georg Füchsle > wrote: > > Thank you both, > > I will try the jcifs first. > > > > The autentication method ist NTLM. I assume the Autentification header is > > part of the http-Headers. Is this header only sent from a specially > > configured browser. Because I try with my own machine and own Browser > > > > Thanks > > Gio. > > > > > > 2013/7/24 Jim May > > > >> You would need to find a way to set the authentication header. I dont > know > >> how easily that is with windows authentication. Maybe painful. You may > have > >> to switch the authentication method OR setup something like oauth that > uses > >> tokens so that the two apps trust each other. > >> On Jul 24, 2013 5:46 AM, "Georg Füchsle" > wrote: > >> > >> > I have to make calls to an customers ASP.NET RESTful Service. This > >> service > >> > is protecetd by a windows authentification. > >> > > >> > As far as I assume, this means, the user will use a browser on a > windows > >> > computer inside their company. They open my web-app that is hosted > >> outside > >> > their company. From this web-Apap I call again the REST-Service inside > >> this > >> > company. To have permission to the service I have to send the user > >> > authentification data. > >> > > >> > My question: What do I (in the JSF-web-app outside the company) have > to > >> do > >> > to deliver the user-information towards the REST-service? > >> > > >> > Has anybody done something like this? > >> > > >> > > >> > Thanks in advance, > >> > > >> > Gio > >> > > >> >
Re: Consume a ASP.Net Service with windows Authentification from JSF
Thank you both, I will try the jcifs first. The autentication method ist NTLM. I assume the Autentification header is part of the http-Headers. Is this header only sent from a specially configured browser. Because I try with my own machine and own Browser Thanks Gio. 2013/7/24 Jim May > You would need to find a way to set the authentication header. I dont know > how easily that is with windows authentication. Maybe painful. You may have > to switch the authentication method OR setup something like oauth that uses > tokens so that the two apps trust each other. > On Jul 24, 2013 5:46 AM, "Georg Füchsle" wrote: > > > I have to make calls to an customers ASP.NET RESTful Service. This > service > > is protecetd by a windows authentification. > > > > As far as I assume, this means, the user will use a browser on a windows > > computer inside their company. They open my web-app that is hosted > outside > > their company. From this web-Apap I call again the REST-Service inside > this > > company. To have permission to the service I have to send the user > > authentification data. > > > > My question: What do I (in the JSF-web-app outside the company) have to > do > > to deliver the user-information towards the REST-service? > > > > Has anybody done something like this? > > > > > > Thanks in advance, > > > > Gio > > >
Consume a ASP.Net Service with windows Authentification from JSF
I have to make calls to an customers ASP.NET RESTful Service. This service is protecetd by a windows authentification. As far as I assume, this means, the user will use a browser on a windows computer inside their company. They open my web-app that is hosted outside their company. From this web-Apap I call again the REST-Service inside this company. To have permission to the service I have to send the user authentification data. My question: What do I (in the JSF-web-app outside the company) have to do to deliver the user-information towards the REST-service? Has anybody done something like this? Thanks in advance, Gio
Re: Bean-members marked with transient are not reset to null after request.
Hallo Mike! Thanks for Your reply! The scope of my bean is "request". The state is saved for some pages using This bean has some members; one of them is marked transient. When the bean had been restored after a request that had : > What is the scope of your bean containing the transient members? > > On Fri, Jan 6, 2012 at 8:35 AM, Georg Füchsle wrote: >> Hallo! >> >> I had to switch the state-saving method from client to server. After >> this change bean-members marked with transient are not reset to null >> after request. >> >> I use jsf1.2 (sun ri) with tomahawk and Facelets. >> >> To exclude bean memberes from state-saving I usually marked these >> members with 'transient': >> For example: >> private transient List<...> myList; >> >> At least when these beans where saved via after >> any request these values had been reset to null. >> Now for another reason I had to switch the state saving from client to >> server. >> After tis change the transient memberes are not reset after a request. >> >> >> I tried both context-parameters: >> >> >> com.sun.faces.serializeServerState >> true >> >> >> org.apache.myfaces.SERIALIZE_STATE_IN_SESSION >> true >> >> >> I hoped when using a serverside serialization these values should be >> reset. But it won't. >> >> Can anybody give me a hint how to get the same behaviour as with clien >> state saving? >> >> Thanks Gio
Re: Recognize Browser-Version in JSF doesn’t work on WAS6.1
Hallo, Now after some time I tried again on the same problem. I acchieved to load my own JSF-Libraries. For this I followed this link: http://www.denoo.info/2008/02/finally-jsf-12-and-facelets-on-websphere-61/ I only switched the class-loader of the EAR to PARENT_LAST. But to use some facelet-functionality I had to change the JSF-StateSaving from 'client' to 'server' (only on WAS6.1) With my own JSF-Libs the browser-version was recognized well. Thanks for all for your help. Georg 2011/11/3 Georg Füchsle : > Hi Toby, > > I gave up for today. > No matter what I do, as soon as I switch the class loader of the webapp I get > SRVE0201E: Das Servlet > [javax.faces.webapp.FacesServlet] ist keine Servlet-Klasse. > when starting the application. > > I did not mention that I use the sun implementation. > > On the weekend I will try to start with a small application from the > scratch... maybe I find something out. > > Thanks for your help > > Georg
Bean-members marked with transient are not reset to null after request.
Hallo! I had to switch the state-saving method from client to server. After this change bean-members marked with transient are not reset to null after request. I use jsf1.2 (sun ri) with tomahawk and Facelets. To exclude bean memberes from state-saving I usually marked these members with 'transient': For example: private transient List<...> myList; At least when these beans where saved via after any request these values had been reset to null. Now for another reason I had to switch the state saving from client to server. After tis change the transient memberes are not reset after a request. I tried both context-parameters: com.sun.faces.serializeServerState true org.apache.myfaces.SERIALIZE_STATE_IN_SESSION true I hoped when using a serverside serialization these values should be reset. But it won't. Can anybody give me a hint how to get the same behaviour as with clien state saving? Thanks Gio
Re: Recognize Browser-Version in JSF doesn’t work on WAS6.1
Hi Toby, I gave up for today. No matter what I do, as soon as I switch the class loader of the webapp I get SRVE0201E: Das Servlet [javax.faces.webapp.FacesServlet] ist keine Servlet-Klasse. when starting the application. I did not mention that I use the sun implementation. On the weekend I will try to start with a small application from the scratch... maybe I find something out. Thanks for your help Georg
Re: Recognize Browser-Version in JSF doesn’t work on WAS6.1
Hallo Toby, I don't use RAD. Therefore I set the Classloader's settings in the WAS admin console. If I set the Class Loader of the Web-Module to PARENT_LAST, the Web-App cannot be started. I get the following output: [03.11.11 14:40:21:366 CET] 001c WebExtensionP W Servlet Faces Servlet is currently unavailable: SRVE0201E: Das Servlet [javax.faces.webapp.FacesServlet] ist keine Servlet-Klasse. In the WAS6.1 admin console I changed the class loader for the ear to PARENT_LAST, the other class loader were not touched. I always thought I would use JSF 1.2 as I use sucessfully tags like : > Hy Georg, > > You will nee to overwrite the JSF Version which ships with WAS 6.1 - i > think it is IBM's implementation of JSF 1.1 - no myfaces here. > - Add a current myfaces version to the war's classpath. > - In your EAR File you will need to set the class load to PARENT_LAST (To > do that open the application.xml with RAD and go the the Deployment Tab. > here in the Application section select the EAR an set classloader mode to > PRENT_LAST. Then click on the war file and do the same.) > > Let me know if that helped, > > Toby > > On Thu, Nov 3, 2011 at 11:30 AM, Georg Füchsle wrote: > >> Hallo! >> >> To recognize the user’s browser version I examine the HttpHeader in a >> request scoped managed bean: >> >> FacesContext ctx = FacesContext.getCurrentInstance(); >> ExternalContext extctx = ctx.getExternalContext(); >> Map map = extctx.getRequestHeaderValuesMap(); >> String arBrowser = map.get("User-Agent"); >> String headBrowser = arBrowser[0]; >> >> >> This works well on WAS7 and JBoss. >> But on WAS6.1 the map returns empty and then I get a ClassCastException: >> java.util.Vector$1 incompatible with [Ljava.lang.String;] >> >> On the other AppServers the headBrowser returns the right value to >> recognize the user’s browser. >> >> I don’t know the reason why WAS6 behaves different. The differences I know >> are: >> 1. WAS6.1 uses a (to me unknown) jsf-Version shipped with WAS6.1; the >> other AppServers use jsf 1.2_15b02 >> 2. WAS6.1 runs with java 1.5; WAS7 and JBoss6 run with java 1.6 >> >> Can anyone tell me the reason why there are differences and can anyone >> help me to make this function run also on WAS6.1? >> >> Thanks, >> Georg >> >
Recognize Browser-Version in JSF doesn’t work on WAS6.1
Hallo! To recognize the user’s browser version I examine the HttpHeader in a request scoped managed bean: FacesContext ctx = FacesContext.getCurrentInstance(); ExternalContext extctx = ctx.getExternalContext(); Map map = extctx.getRequestHeaderValuesMap(); String arBrowser = map.get("User-Agent"); String headBrowser = arBrowser[0]; This works well on WAS7 and JBoss. But on WAS6.1 the map returns empty and then I get a ClassCastException: java.util.Vector$1 incompatible with [Ljava.lang.String;] On the other AppServers the headBrowser returns the right value to recognize the user’s browser. I don’t know the reason why WAS6 behaves different. The differences I know are: 1. WAS6.1 uses a (to me unknown) jsf-Version shipped with WAS6.1; the other AppServers use jsf 1.2_15b02 2. WAS6.1 runs with java 1.5; WAS7 and JBoss6 run with java 1.6 Can anyone tell me the reason why there are differences and can anyone help me to make this function run also on WAS6.1? Thanks, Georg
Re: Functionality that returns the Jsf-Version?
Thanks Mike! First I thought about a solution like You described. But Kito's solution is much more simple. It gives back the full jsf-api filename (like "C://jsf-api-1.2_15_Bo2.jar"). So I can control very easily the Version-no. I have to deploy to WAS6.1 WAS7 and JBoss6. And now found out that on WAS6 I never used the intended JSF-Version but a Version that is delivered by WAS6.1. Fortunately this Version works well. But the jsf-Version delivered by WAS7 is buggy with the statesaving. So I have to be shure that the Jsf is loaded from my /WEB-INF/lib directory. Regards, Georg 2011/10/28 Mike Kienenberger : > You'll have to look at the archives to find the exact code, but in the > past, there has been code used to detect the difference between JSF > 1.1 and 1.0, and possibly 1.2. > > Use reflection to find a method that only exists in the later versions. > The standalone facelets library for JSF 1.x did this. > > On Fri, Oct 28, 2011 at 4:12 AM, Georg Füchsle > wrote: >> Thanks Kito, >> >> thats great! Now I can control if really the expected jsf.jar is loaded! >> >> Regards, >> >> Georg >> >> 2011/10/27 Kito Mann : >>> Hello Georg, >>> >>> There isn't a standard API for revealing the JSF version, but you can >>> reveal the location of the JSF API JAR: >>> >>> System.out.println("JSF API Location: " >>> + FacesContext.class.getProtectionDomain().getCodeSource()); >>> >>> This will print out the path to the JAR that contains the FacesContext. >>> >>> I've found this useful in WAS 7 and 8 for determining the location of the >>> JSF classes are being loaded. >>> --- >>> Kito D. Mann | twitter: kito99 | Author, JSF in Action >>> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting >>> http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter: >>> jsfcentral >>> +1 203-404-4848 x3 >>> >>> * Listen to the latest headlines in the JSF and Java EE newscast: >>> http://blogs.jsfcentral.com/roller/editorsdesk/category/JSF+and+Java+EE+Newscast >>> * Keep up with the aftermath of the Oracle/Sun merger: >>> http://www.mergerspeak.com >>> >>> >>> >>> On Thu, Oct 27, 2011 at 6:43 AM, Georg Füchsle >>> wrote: >>> >>>> Hallo! >>>> >>>> My WebApp needs to use Jsf with the Version 1.2.15B02. In WAS7 I >>>> achieved this by using shared Libraries. Unfortunately often we forget >>>> to switch on these shared libs. In this case the App runs but on later >>>> sites there will be mistakes due to different cashing of Managed >>>> beans. >>>> Therefore I would like to output the Jsf-Version to a system information >>>> page. >>>> Can anybody show me a function that returns the Jsf-Version? >>>> Gerald once advised me to load special functions that only exist in >>>> the new version of Jsf and to surround this with try-catch-brackets. >>>> If the new function is not loaded, there will be used an older Jsf >>>> version. >>>> >>>> To do this I should find information which functions are new in which >>>> version. >>>> Especially I should recognize if an older version than Jsf1.2-15B02 >>>> (mojarra) is used. >>>> >>>> Can anybody give me a link? >>>> >>>> Thanks Georg >>>> >>> >> >
Re: Functionality that returns the Jsf-Version?
Thanks Kito, thats great! Now I can control if really the expected jsf.jar is loaded! Regards, Georg 2011/10/27 Kito Mann : > Hello Georg, > > There isn't a standard API for revealing the JSF version, but you can > reveal the location of the JSF API JAR: > > System.out.println("JSF API Location: " > + FacesContext.class.getProtectionDomain().getCodeSource()); > > This will print out the path to the JAR that contains the FacesContext. > > I've found this useful in WAS 7 and 8 for determining the location of the > JSF classes are being loaded. > --- > Kito D. Mann | twitter: kito99 | Author, JSF in Action > Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting > http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter: > jsfcentral > +1 203-404-4848 x3 > > * Listen to the latest headlines in the JSF and Java EE newscast: > http://blogs.jsfcentral.com/roller/editorsdesk/category/JSF+and+Java+EE+Newscast > * Keep up with the aftermath of the Oracle/Sun merger: > http://www.mergerspeak.com > > > > On Thu, Oct 27, 2011 at 6:43 AM, Georg Füchsle wrote: > >> Hallo! >> >> My WebApp needs to use Jsf with the Version 1.2.15B02. In WAS7 I >> achieved this by using shared Libraries. Unfortunately often we forget >> to switch on these shared libs. In this case the App runs but on later >> sites there will be mistakes due to different cashing of Managed >> beans. >> Therefore I would like to output the Jsf-Version to a system information >> page. >> Can anybody show me a function that returns the Jsf-Version? >> Gerald once advised me to load special functions that only exist in >> the new version of Jsf and to surround this with try-catch-brackets. >> If the new function is not loaded, there will be used an older Jsf >> version. >> >> To do this I should find information which functions are new in which >> version. >> Especially I should recognize if an older version than Jsf1.2-15B02 >> (mojarra) is used. >> >> Can anybody give me a link? >> >> Thanks Georg >> >
Functionality that returns the Jsf-Version?
Hallo! My WebApp needs to use Jsf with the Version 1.2.15B02. In WAS7 I achieved this by using shared Libraries. Unfortunately often we forget to switch on these shared libs. In this case the App runs but on later sites there will be mistakes due to different cashing of Managed beans. Therefore I would like to output the Jsf-Version to a system information page. Can anybody show me a function that returns the Jsf-Version? Gerald once advised me to load special functions that only exist in the new version of Jsf and to surround this with try-catch-brackets. If the new function is not loaded, there will be used an older Jsf version. To do this I should find information which functions are new in which version. Especially I should recognize if an older version than Jsf1.2-15B02 (mojarra) is used. Can anybody give me a link? Thanks Georg
Re: Is it impossible to use tomahawk and richfaces in the same app?
Hallo Werner, I am not shure what work I have to expect migrating to JSF2. But thanks, so I will think about this solution, too. gio 2011/8/26 Werner Punz : > Am 26.08.11 15:18, schrieb Georg Füchsle: > >> 2. I really cannot get rid of tomahawk in my app. How can I add some >> ajax functionality to my tomahawk app, in a way that keeps it >> deployable to new AppServers? >> > Mhh can you move up to jsf 2.1? Then yo would get ajax out of the box. > > Werner > > >
Is it impossible to use tomahawk and richfaces in the same app?
Hallo Users, is it impossible to use tomahawk and richfaces in the same app? My situation: I develop a webapp that uses jsf1.2, facelets, tomahawk and ajax4jsf that runs on WebSphere6 and JBoss6. Now I got a request to deploy to WebSphere7. I realised, that ajax4jsf-1.1.1.jar mustn't be deployed to a WAS7-app. (I tried to deploy my app without ajax4jsf.jar and without the ajax4jsf references in the web.xml - and it could be started well...) Because I had trouble to start WebSphere with the richfaces libraries, it tried it on JBoss. Using the richfaces jars instead of the ajax4jsf.jar, I could start my app on JBoss. But as soon as I navigated to a site using http://community.jboss.org/thread/9694?tstart=0 https://issues.jboss.org/browse/RF-1519?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel What is the latest news? 1. Can I use t:saveState and richfaces a4j: in the same app? And how to to it? if no: 2. I really cannot get rid of tomahawk in my app. How can I add some ajax functionality to my tomahawk app, in a way that keeps it deployable to new AppServers? Thanks in advance, gio
Wrong rendering of special characters with tomahawk-1.1.9 on unix-machine
Hallo, Since I updated my tomahawk jar from 1.1.7 to 1.1.9 there a special character (umlaut) is rendered wrong when deployed on a unix machine. When I deploy on a windows machine there is all right: This tag with bean (mandinf) funktion: String getRegionStr() { ... return "BAWÜ"; } is rendered on Windows: BAWÜ (right) on Unix: BAWÃœ (wrong) I have a JSF1.2 application usinf facelets and tomahawk. The Java and xhtml-Files are all in utf-8 I produce the war and ear -Files via Maven using UTF-8 Has anybody a hint? Thanks
Re:
Hallo, we are afraid that we are not using JSF1.2 on WebSphere 6.1: When we switch the class loader for the application in the WebSphere console: Enterprise Applications > "Application Name"> Class loader Class loader order : --> "Classes loaded with application class loader first" and WAR class loader policy : --> "Class loader for each WAR file in application" then the application will start and produce the exception when the f:setPropertyActionListener is called. Otherwise if we switch the classloader for the Web-module: Class loader order : --> "Classes loaded with application class loader first" and WAR class loader policy : --> "Single class loader for application" the application cannot be started. When calling the first page the following message is displayed in the browser: Error 404: SRVE0201E: Das Servlet [javax.faces.webapp.FacesServlet] ist keine Servlet-Klasse. (in English: the servlet [javax.faces.webapp.FacesServlet] is not a servlet class) - Can we output to the page the JSF-Version that is used? - Or do we use a wrong set of jar-Versions? - Should the JSF1.2 jars be used from a 'shared library reference' in WebSphere? Thanks Georg 2011/5/5 Georg Füchsle : > Hallo Leonardo, > > thank you for your interest! > Here the exception: > > [05.05.11 09:47:25:663 CEST] 001a ServletWrappe E SRVE0068E: Es > wurde eine Ausnahme angefangen, die in einer der Servicemethoden des > Servlet Faces Servlet ausgelöst wurde. Ausgelöste Ausnahme: > javax.servlet.ServletException > at javax.faces.webapp.FacesServlet.service(FacesServlet.java:209) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146) > at > com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:593) > at > com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:533) > at > com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90) > at > com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:751) > at > com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478) > at > com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:125) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) > at > com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387) > at > com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102) > at > com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) > at > com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) > at > com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) > at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) > at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) > at > com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751) > at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) > at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) > Begin backtrace for Nested Throwables > java.lang.IllegalArgumentException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:618) > at > com.sun.faces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:179) > at > com.sun.facelets.el.LegacyELContext$LegacyELResolver.setValue(LegacyELContext.java:201) > at com.sun.el.parser.AstValue.setValue(AstValue.java:113) > at > com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:246) > at > com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93) > at > com.sun.facelets.el.LegacyValueBinding.setValue(LegacyValueBinding.java:68) > at > com.sun.facelets.tag.jsf.core.SetPropertyActionListenerHandler$LegacySetPropertyListener.processAction(SetPropertyActionListenerHandler.java:88) > at javax.faces.event.ActionEvent.processListener(ActionEvent.java:57) > at > javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:683) > at javax.faces.component.UICommand.broadcast(UICommand.java:297) >
Re:
com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) [05.05.11 09:47:25:672 CEST] 001a WebAppE [Servlet Error]-[Faces Servlet]: java.lang.IllegalArgumentException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at com.sun.faces.el.PropertyResolverImpl.setValue(PropertyResolverImpl.java:179) at com.sun.facelets.el.LegacyELContext$LegacyELResolver.setValue(LegacyELContext.java:201) at com.sun.el.parser.AstValue.setValue(AstValue.java:113) at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:246) at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93) at com.sun.facelets.el.LegacyValueBinding.setValue(LegacyValueBinding.java:68) at com.sun.facelets.tag.jsf.core.SetPropertyActionListenerHandler$LegacySetPropertyListener.processAction(SetPropertyActionListenerHandler.java:88) at javax.faces.event.ActionEvent.processListener(ActionEvent.java:57) at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:683) at javax.faces.component.UICommand.broadcast(UICommand.java:297) at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:302) at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:419) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:77) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:239) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:91) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:593) at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:533) at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:751) at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:125) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387) at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) regards Georg 2011/5/5 Leonardo Uribe : > Hi > > Could you provide the exception to see if there is a configuration problem? > > regards, > > Leonardo > > 2011/5/4 Georg Füchsle : >> Hallo >> >> I have made up a small JSF-Project using maven. >> It works as long I will not use > When > >> I deploy to WebShpere 6.1. >> >> I tried to switch the class loading without success. >> Looking forward for any help! >> >> Thanks Georg >> >> >> *** >> Here my sources: >> pom.xml: >> >> http://maven.apache.org/POM/4.0.0"; >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >> xsi:schemaLocation="http://maven.
users@myfaces.apache.org
Hallo I have made up a small JSF-Project using maven. It works as long I will not use http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> 4.0.0 de.safir InvestInformWeb 0.0.1-SNAPSHOT war org.apache.openejb javaee-api 5.0-3 javax.faces jsf-api 1.2_04 compile javax.servlet jstl 1.2 provided javax.servlet.jsp jsp-api 2.1 provided javax.faces jsf-impl 1.2_04 compile com.sun.facelets jsf-facelets 1.1.9 javax.el el-api 1.0 com.sun.el el-ri 1.0 ${basedir}/src ${basedir}/WebRoot/WEB-INF/classes ${basedir}/src **/*.java org.apache.maven.plugins maven-war-plugin ${basedir}/WebRoot ${basedir}/WebRoot true org.apache.maven.plugins maven-compiler-plugin 2.3.2 1.5 1.5 The web-Page: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml"; xmlns:h="http://java.sun.com/jsf/html"; xmlns:f="http://java.sun.com/jsf/core";> Testseite * and the backing bean: package de.safir; public class ersteBean { private String text; private String neuerText; public String laden() { return ""; } public String getText() { return text; } public void setText(String text) { this.text = text; } public String getNeuerText() { return neuerText; } public void setNeuerText(String neuerText) { this.neuerText = neuerText; } }
Re: Problems retrieving selection data from
Hallo Leonardo! Thank You for Your answer and also I regret my late responding. The facts about the tomahawk So I suppose the list lying behind the t:dataList will not be calculated once more when rendering the useraction. 2. In my list I always keep users that belong to the same institute. Also, if the list was changed (by adding or removing a user of this institute) it should consist of users of the same institute. Now - twice - there was displayed the right user-list, but there were displayed the data belonging to a user of a different institute. There is called an action that loads the user that is clicked in the : > Hi > > The problem you described here is because JSF javax.faces.UIData > default implementation depends on the rowIndex to indicate which row > is being affected by the action (for example click a link), or restore > the state of the row. I'll do a description about the problem, to give a > better idea about what's going on. > > For example, suppose this list of data: > > - A > - C > > Now suppose between the first request and the next one when you > press the link (for C row), by some reason (other user, same user > other window, ... ), now the list is this: > > - A > - B > - C > > When UIData tries to know which link was clicked, it says > "... look for the second row ...", so in practice, the server assume B > was clicked, but the client clicked C. > > There is a lot of solutions in JSF to deal with this problem. JSF libraries > has > overcome this issue creating its custom JSF component hierarchy > and its custom "model" interfaces (see Trinidad for example). Other > solutions include > use MyFaces Orchestra to store the model in "access" scope, > t:dataTable "preserveDataModel" property or in a future release of tomahawk > (1.1.11) use > an EL expression to identify the row and "derive" the child clientIds called > rowKey. Below > there is the description: > > * - Used to assign a value expression that identify in a unique way a row. > This value > will be used later instead of rowIndex as a key to be appended to the > container > client id using getDerivedSubClientId() method. > * > The only disadvantage of use "rowKey", is that in some way the > primary key or a derivate of your data is output on the html, and somebody > could > not want that by some special reason. Note the default strategy used for > years in UIData using rowIndex hides that information. > > regards, > > Leonardo Uribe > > 2011/4/8 Georg Füchsle > >> Hallo! >> >> >> I use Jsf 1.2 with Tomahawk and Facelets. >> >> On a page listing users that belong to a company, I use >> To edit one user, I call an actionListener, that retrieves the id of >> the selected user. >> >> This works since some years. Now it happens sometimes that the >> selection of the user finds a userid of a user that belongs to another >> company as listed. >> >> This is really bad... :-( >> >> Is there any advance to replace the actionlistener with >> > Has anybody an idea? >> >> Thanks! >> >> >> >> here is may actual code: >> >> >> >> >> >> > rowCountVar="macCount" >> value="#{mbBedienerVerwaltung.bedienerEB}" >> var="bediener" >> rowIndexVar="index"> >> >> > style="padding-left: 5px; width: 310px;"> >> >> > >> value="#{bediener.bedAnzeigeName}" >> >> action="#{mbBedienerVerwaltung.edit}" >> >> actionListener="#{mbBedienerVerwaltung.mandantSearch}"> >> >> >> >> >> ... >> ... >> >> >> >> >> >> >> >> >> Here my backing bean: >> >> >> >> public class MbBedienerVerwaltung implements Serializable >> { >> private List bedienerEB=null; >> private Integer idBediener; >> >> >> >> public void mandantSearch(ActionEvent event) >> { >> this.idBediener = 0; >> try >> { >> BedienerData bed = null; >> UIData ob = JsfUtils.getUI
ajax4jsf doesn't work with https and InternetExplorer 9
Hallo Users! I have a jsf page that uses ajax (ajax4jsf-1.1.1). Now with InternetExplorer 9 the ajax-request on this page does not work, if this page has to be called by https. There is displayed the following (German) errors: ** Details zum Fehler auf der Webseite Benutzer-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) Zeitstempel: Wed, 27 Apr 2011 14:14:42 UTC Meldung: Schnittstelle nicht unterstützt Zeile: 42 Zeichen: 197 Code: 0 URI: https://comfin.investinform.de/ComFin/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf ** This page works well with IE9 when the application is not deployed to https. Also this ajax-Requests work well with https, when using other browsers. The file https://comfin.investinform.de/ComFin/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf can be downloaded also from https. There are no differences between the downloadad files 'AjaxScript.jsf' when downloadad on the not working system or downloadad from the working system. Any ideas? Thank You Georg
Problems retrieving selection data from
Hallo! I use Jsf 1.2 with Tomahawk and Facelets. On a page listing users that belong to a company, I use To edit one user, I call an actionListener, that retrieves the id of the selected user. This works since some years. Now it happens sometimes that the selection of the user finds a userid of a user that belongs to another company as listed. This is really bad... :-( Is there any advance to replace the actionlistener with ... ... Here my backing bean: public class MbBedienerVerwaltung implements Serializable { private List bedienerEB=null; private Integer idBediener; public void mandantSearch(ActionEvent event) { this.idBediener = 0; try { BedienerData bed = null; UIData ob = JsfUtils.getUIDataParent(event); Object tmp = ob.getRowData(); bed = (BedienerData) tmp; this.idBediener = bed.getBedId(); } catch (RuntimeException e) { log_tech.warn("mandantSearch(): Die BedienerId kann nicht bestimmt werden! Der Bediener kann nicht editiert werden"); this.idBediener = null; } } public String edit() { if ((mbBediener != null)) { // retrieve Backingbean for User MbBediener mbBediener = JsfUtils.getMbBediener(); // read Userdate for id from Database mbBediener.read(idBediener); return "edit"; } // Error return "error"; } . }
Re: Facelets custom component with an action as a variable like
Hi Walter, thanks for the fast answer. I tried it like that and it worked at once: I defined a custom control in a file 'schalterpanel.xhtml' http://www.w3.org/1999/xhtml"; xmlns:ui="http://java.sun.com/jsf/facelets"; xmlns:f="http://java.sun.com/jsf/core"; xmlns:h="http://java.sun.com/jsf/html"; xmlns:c="http://java.sun.com/jsp/jstl/core"; xmlns:t="http://myfaces.apache.org/tomahawk";> Then I defined the custom control like this: schalterpanel ../pages/schalterpanel.xhtml And then I can use my custom control like this: Now my button is displayed and clicking the button the action mbBean.save() is performed! Maybe You are right, it is a bit ugly, but it is sufficient for me. It is a pity that i don't really understand why action="#{BackingBean1[Action1]}" is resolved into mbBean.save()... Thanks a lot! Cheers Georg 2010/4/12 Walter Mourão : > Hi, Georg, > > yes, there are some (quite ugly) solutions: > http://www.ibm.com/developerworks/java/library/j-facelets2.html > > Component with the same problem/solution: > http://code.google.com/p/trinidadcomponents > > Cheers, > > Walter Mourão > http://waltermourao.com.br > http://arcadian.com.br > http://oriens.com.br > > > > On Mon, Apr 12, 2010 at 8:56 AM, Georg Füchsle wrote: > >> Hallo, >> >> I use JSF 1.2 with Facelets and Tomahawk. >> >> Now I would like to make a facelets custom component for a navigation >> / toolkit bar (button panel) that looks the same in every page. This >> component should exist of a number of > defined by calling this custom component. >> >> I thougt about something like this: >> >> In a file 'btnPanel.xhtml': >> http://www.w3.org/1999/xhtml"; >> xmlns:f="http://java.sun.com/jsf/core"; >> xmlns:h="http://java.sun.com/jsf/html"; >> xmlns:ui="http://java.sun.com/jsf/facelets"; >> xmlns:t="http://myfaces.apache.org/tomahawk"; >> xmlns:c="http://java.sun.com/jstl/core";> >> >> >> >> >> >> . >> >> >> >> >> I would define this as a custom tag: >> >> >> btnPanel >> ../pages/btnPanel.xhtml >> >> >> >> Finally I want to call this control in my xhtml-pages like this: >> >> >> >> But I realised that it is not possible to define a variable action for >> my custom control like this. Actually this way JSF looks for a method >> mbBean.getSave() instead of performing the action mbBean.save() >> >> >> Is there another way to do that? >> >> Thanks in advance >> >> >> Georg >> >
Facelets custom component with an action as a variable like
Hallo, I use JSF 1.2 with Facelets and Tomahawk. Now I would like to make a facelets custom component for a navigation / toolkit bar (button panel) that looks the same in every page. This component should exist of a number of http://www.w3.org/1999/xhtml"; xmlns:f="http://java.sun.com/jsf/core"; xmlns:h="http://java.sun.com/jsf/html"; xmlns:ui="http://java.sun.com/jsf/facelets"; xmlns:t="http://myfaces.apache.org/tomahawk"; xmlns:c="http://java.sun.com/jstl/core";> . I would define this as a custom tag: btnPanel ../pages/btnPanel.xhtml Finally I want to call this control in my xhtml-pages like this: But I realised that it is not possible to define a variable action for my custom control like this. Actually this way JSF looks for a method mbBean.getSave() instead of performing the action mbBean.save() Is there another way to do that? Thanks in advance Georg
Re: value in SessionScope ist lost after a redirect on Safari
Hallo Werner, thank You for Your help and Your patience! You gave me the right hint: The session was not saved because of missing cookie-rights, and I could solve my problems! Sorry for such a trivial solution! My application sometimes is called from a customer's web-page. Normally my application needs a authentication of the user. Being called from this customer's web-page I wanted to automatically log-on a anonymous user and redirect him to the start of the application. The standard cookie-setting of Safari says: 'Only accept cookies of web sites I am visiting' So I guess, at the very first request to my application my application does not belong to these web-sites Safari is visiting; so when redirected to the second page the session-id is lost. To log-on anonymously now I made an intermediate site for the anonymous start. This intermediate page does nothing but redirect the request to a seond page. When this second page is processed I log-on the anonymous user (and save the user being logged on in a session scoped bean) and then redirect again to the start of the application. In this case the cookie is accepted and the session is not lost and the information of the session scoped bean still exists So now the anonymous log-on is working also using the standard cookie settings of Safari; but for the anonymous login the User will be redirected 2 times. Once more thanks a lot! Georg 2009/9/1 Werner Punz : > Hello the main issue you have is you want to trigger from an outside > navigation a jsf page and you want to preserve the session, correct? > > I assume this here is hardcoded right? src="http://localhost:9080/InvestInform/login/iimnall.jsf"; > name="anzeige" id="anzeige" title="anzeige" /> > > > what you have to do is following, you have to create the link dynamically > and use: > response.encodeURL(encodedUrl) > no redirect is needed here, you will have lost the session already at > > private void umleitenAufNeueZielseite(PhaseEvent event, String >> kontextStamm, String zielSeite) > > > What happens is following: > You trigger an external page here, page gets a session id assigned, then you > trigger a frame but you omit the session id, the frame then gets its own > session id, because you have a hardcoded link. > > You have to drag in your session id to the link that jsf calls so that jsf > can recycle it. > > > the call should then look like src="http://localhost:9080/InvestInform/login/iimnall.jsf?jsessionId=."; > name="anzeige" id="anzeige" title="anzeige" /> > > It depends on the context you are in, if you already are in jsf or if. > But as I said do not create the link hardcoded use the el to > make the link and then delegate to response.encodeURL(...) > > however also make sure that the server and browser allow cookies otherwise > the entire sessionid thing wont work > (since you know german > http://www.java-forum.org/allgemeines-ee/87463-funkt-encodeurl-auch-wenn-cookies-eingeschalten-sind.html) > > > Werner > > > Georg Füchsle schrieb: >> >> Hallo Werner, >> >> thanks for Your help. >> But I have to ask once more: >> >> thecall of 'response.encodeURL(encodedUrl)' doesnot change the url. >> >> for the redirect I use the following funktion: >> >> >> private void umleitenAufNeueZielseite(PhaseEvent event, String >> kontextStamm, String zielSeite) >> { >> try >> { >> ExternalContext ectx = >> event.getFacesContext().getExternalContext(); >> HttpServletResponse response = >> (HttpServletResponse)ectx.getResponse(); >> >> >> String encodedUrl = kontextStamm + zielSeite; >> encodedUrl = response.encodeURL(encodedUrl); >> >> ectx.redirect(encodedUrl); >> } >> catch (IOException e) >> { >> log.error("Fehler bei der Weiterleitung!"); >> } >> } >> >> >> Was it this what you wanted to advice me? >> >> Cheers >> Georg >> >> >> 2009/8/28 Werner Punz : >>> >>> Werner Punz schrieb: >>>> >>>> Georg Füchsle schrieb: >>>>> >>>>> Hallo Werner , hallo Jan-Kees, >>>>> >>>>> thank you for your answers. >>>>> >>>>> - I do not redirect to another application but to another URL inside >>>>> the same appl
Re: value in SessionScope ist lost after a redirect on Safari
Hallo Werner, thanks for Your help. But I have to ask once more: thecall of 'response.encodeURL(encodedUrl)' doesnot change the url. for the redirect I use the following funktion: private void umleitenAufNeueZielseite(PhaseEvent event, String kontextStamm, String zielSeite) { try { ExternalContext ectx = event.getFacesContext().getExternalContext(); HttpServletResponse response = (HttpServletResponse)ectx.getResponse(); String encodedUrl = kontextStamm + zielSeite; encodedUrl = response.encodeURL(encodedUrl); ectx.redirect(encodedUrl); } catch (IOException e) { log.error("Fehler bei der Weiterleitung!"); } } Was it this what you wanted to advice me? Cheers Georg 2009/8/28 Werner Punz : > Werner Punz schrieb: >> >> Georg Füchsle schrieb: >>> >>> Hallo Werner , hallo Jan-Kees, >>> >>> thank you for your answers. >>> >>> - I do not redirect to another application but to another URL inside >>> the same application. >>> - I do not change from http to https or vice versa. >>> - Werner: I tried to youse handleNavigtion instead of redirect, but >>> unfortunately i didn't succeed as i got an exception. ( I asked this >>> in another request to this news group...) >>> >>> >>> But now I examined once more an found out another strange fact: >>> >>> >>> I loose the session only if the application is called out of a frame. >>> (The application should be embedded into the website of a customer >>> using a frameset :) >>> >>> http://localhost:9080/InvestInform/login/iimnall.jsf"; >>> name="anzeige" id="anzeige" title="anzeige" /> >>> >>> >> Ok here is the issue, you basically change applications implicitely via >> the usage of frames :-) >> >> You probably should add your session id to the link.. via >> response.encodeUrl you can get a valid url including the id :-) >> Make sure you do that for all frame to frame navigations (inside a frame >> you wont have to do that) >> >> Werner >> >> > Ok Just to add something here, in your case with trying to call a JSF page > from an outside frame, a navigation case wont help you. Navigaton cases only > work within the same frame. > > Werner > >
Re: value in SessionScope ist lost after a redirect on Safari
Hallo Werner , hallo Jan-Kees, thank you for your answers. - I do not redirect to another application but to another URL inside the same application. - I do not change from http to https or vice versa. - Werner: I tried to youse handleNavigtion instead of redirect, but unfortunately i didn't succeed as i got an exception. ( I asked this in another request to this news group...) But now I examined once more an found out another strange fact: I loose the session only if the application is called out of a frame. (The application should be embedded into the website of a customer using a frameset :) http://localhost:9080/InvestInform/login/iimnall.jsf"; name="anzeige" id="anzeige" title="anzeige" /> If I call the application directly typing the url (http://localhost:9080/InvestInform/login/iimnall.jsf) to safari, I will not loose the session. And still: I only see this using the safari browser; a customer tells me the same behaviour on the internet explorer v8. Cheers Georg 2009/8/27 Jan-Kees van Andel : > In most cases, redirecting to a different application on the same > server also leads to loss of session data, since the two applications > don't share session state (they do share the same session ID, but not > the same state). > > But I can't come up with a reason why it only happens in Safari... > > Regards, > Jan-Kees > > > 2009/8/27 Werner Punz : >> You could issue a navigation via the navigation handler. >> But generally I dont thin you should loose the session on a redirect. >> This is standard servlet stuff. >> Do you change domains in between or do you change from https to http? >> >> >> Werner >> >> >> Georg Füchsle schrieb: >>> >>> Hallo! >>> >>> >>> For starting my application the User asks for a special start-url. >>> During the render-phase at a request for this start-url in a certain >>> case I recognize that the user wants a anonymous logon. In this case I >>> set value of a session bean 'mbUser.name=anonymous' and forward the >>> user to another URL. >>> >>> Generally in my application I accept a request, if the sessionscoped >>> value 'mbUser.name' is set. (So I know that the user had logged on >>> sucessfully.) >>> >>> This works very well since some months. >>> >>> But now when I do so with a safari-browser after the redirect the >>> session scoped value mbUser.name is lost and the application will deny >>> an access. >>> A customer told me he has the same effect with Internet Explorer >>> Version 8, but I can only reproduce this problem with safari. >>> >>> >>> There is another logon mechanism to this application that works >>> without redirect. In this way the session scoped values are not lost >>> and the application can be used. >>> >>> >>> So the problem is: >>> >>> The value of a sessionscoped Bean is lost after redirecting the reqest >>> (only) when using a Safari browser. >>> For redirecting I call: >>> ...getFacesContext().getExternalContext().redirect(newUrl); >>> >>> >>> >>> Can anybody give me a hint? >>> >>> Thanks Georg >>> >> >> >
exception using handleNavigation(...)
Hallo, in Order to redirect to another page during Restore-View-Phase I call: FacesContext fc = event.getFacesContext(); fc.getApplication().getNavigationHandler().handleNavigation(fc, "", "mnfmrecherche"); There is the navigation-rule in my faces-config.xml: /* mnfmrecherche /pages/mn/mnfmRecherche.xhtml Makes following exception: [27.08.09 14:38:18:206 CEST] 001f ServiceLogger I com.ibm.ws.ffdc.IncidentStreamImpl resetIncidentStream FFDC0010I: FFDC hat die Datenstromdatei C:\Programme\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\ffdc\server1_001f_09.08.27_14.38.18_2.txt für das Ereignis geschlossen. [27.08.09 14:38:18:206 CEST] 001f WebAppE [Servlet Error]-[Faces Servlet]: java.lang.NullPointerException at com.sun.faces.application.NavigationHandlerImpl.getViewId(NavigationHandlerImpl.java:175) at com.sun.faces.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:121) at org.apache.myfaces.custom.redirectTracker.RedirectTrackerNavigationHandler.handleNavigation(RedirectTrackerNavigationHandler.java:40) at de.safir.web.jsf.DebugPhaseListener.navigierenAufNeueZielseite(DebugPhaseListener.java:431) . What I am doing wrong? Has anybody an idea? Thanks Georg
value in SessionScope ist lost after a redirect on Safari
Hallo! For starting my application the User asks for a special start-url. During the render-phase at a request for this start-url in a certain case I recognize that the user wants a anonymous logon. In this case I set value of a session bean 'mbUser.name=anonymous' and forward the user to another URL. Generally in my application I accept a request, if the sessionscoped value 'mbUser.name' is set. (So I know that the user had logged on sucessfully.) This works very well since some months. But now when I do so with a safari-browser after the redirect the session scoped value mbUser.name is lost and the application will deny an access. A customer told me he has the same effect with Internet Explorer Version 8, but I can only reproduce this problem with safari. There is another logon mechanism to this application that works without redirect. In this way the session scoped values are not lost and the application can be used. So the problem is: The value of a sessionscoped Bean is lost after redirecting the reqest (only) when using a Safari browser. For redirecting I call: ...getFacesContext().getExternalContext().redirect(newUrl); Can anybody give me a hint? Thanks Georg
Re: how to read data from the request after session timeout?
Hallo Werner, that was what I was looking for! Thanks for your fast and excellent help! Cheers Georg 2009/8/20 Werner Punz : > via getParameter, just the usual servlet way, have in mind that you have > to use the clientId, the in html displayed id of the input field. JSF > does an internal id mapping so the id loginType might be mapped to a > value along the lines of ::loginType > > > > Georg Füchsle schrieb: >> Hallo Werner, >> >> I have got the request as a variable. >> Now I want to read from it the state of the hidden input-field, that >> was on the jsf-Page. >> >> This is the input-field: >> >> >> > id="loginType" >> immediate="true" >> style="display:none;visibility:hidden;"/> >> >> >> How can I read its value from the request? >> >> Thanks, >> >> Georg >> >> 2009/8/20 Werner Punz : >>> FacesContext.getExternalContext().getRequest should point you towards >>> the servlet request. >>> >>> Werner >>> >>> >>> Georg Füchsle schrieb: >>>> Hallo all, >>>> >>>> when a session of an user timed out I display a Website telling 'Your >>>> Session expired; please login again!". >>>> Now I have to distinguish some 'loginType' of the user. >>>> If the user initially logged on by ldap i have to redirect him to >>>> another site as if he logged in by internal mechanisms. >>>> >>>> So I have to access the user's logintype data after the session timed out. >>>> >>>> I was thinking on a solution without using cookies: >>>> To do so, I put the loginType data to a hidden input field on the >>>> website. I thought that this data is not lost doing a request after >>>> session timeout. >>>> >>>> Unfortunately at the restoreview-Phase the data was not already >>>> written to the bean. >>>> >>>> But I think: in the request there will be sent also the information >>>> from the old (session timed out) page. So I also should be able to >>>> read the value of this input-field 'loginType'. Is there any >>>> possibility to read from the request? >>>> >>>> Can anybody tell me if I am right, and tell me how to read this data? >>>> >>>> I use JSF Tomahawk and Facelets. >>>> >>>> >>>> Thanks! >>>> >>>> >>>> >>>> Here my input-text: >>>> >>>> >>>> >>>> >>> id="loginType" >>>> immediate="true" >>>> style="display:none;visibility:hidden;"/> >>>> >>>> >>>> >>>> >>>> >>>> here my PhaseListener: >>>> >>>> >>>> class PhaseListener >>>> { >>>> >>>> public void beforePhase(PhaseEvent event) >>>> { >>>> if(event.getPhaseId() == PhaseId.RESTORE_VIEW) >>>> { >>>> /* >>>> before processing any request, I control if the User >>>> is logged in >>>> to the application: >>>> */ >>>> UserBean user = JsfUtils.getUserBean(); >>>> >>>> if(!user.loggedIn()) >>>> { >>>> /* >>>> User is not logged in! >>>> */ >>>> ExternalContext extCtx = >>>> event.getFacesContext().getExternalContext(); >>>> HttpServletRequest request = >>>> (HttpServletRequest) extCtx.getRequest(); >>>> String reqUri = request.getRequestURI(); >>>> >>>> if(startOrErrorPageIsCalled(reqUri)) >>>> { >>>> /* >>>> Users that are not logged in are >>>> only allowed to see the >>>> login-page or the error pages... >>>> */ >>>> return; >>>> } >>>> else >>>> { >>>> /* >>>> Users that is not logged in tried to >>>> request the application. >>>> I want to redirect him to a page >>>> 'sessionExpired' depending on >>>> his former loginType; this loginType I want to save on the website; >>>> */ >>>> >>>> // HERE THE LOGINTYPE WAS NOT reset >>>> to the Bean. is there any >>>> other possibility to read this value from the request? >>>> if(user.getLoginType() == 1) >>>> { >>>> >>>> event.getFacesContext().getExternalContext().redirect(JsfUtils.getKontextRoot() >>>> + "sessionExpired.jsf"); >>>> } >>>> else >>>> { >>>> // redirect him to another >>>> website >>>> } >>>> } >>>> } >>>> >>>> } >>>> } >>>> >>>> >>>> } >>>> >>> >> > >
Re: how to read data from the request after session timeout?
Hallo Werner, I have got the request as a variable. Now I want to read from it the state of the hidden input-field, that was on the jsf-Page. This is the input-field: How can I read its value from the request? Thanks, Georg 2009/8/20 Werner Punz : > FacesContext.getExternalContext().getRequest should point you towards > the servlet request. > > Werner > > > Georg Füchsle schrieb: >> Hallo all, >> >> when a session of an user timed out I display a Website telling 'Your >> Session expired; please login again!". >> Now I have to distinguish some 'loginType' of the user. >> If the user initially logged on by ldap i have to redirect him to >> another site as if he logged in by internal mechanisms. >> >> So I have to access the user's logintype data after the session timed out. >> >> I was thinking on a solution without using cookies: >> To do so, I put the loginType data to a hidden input field on the >> website. I thought that this data is not lost doing a request after >> session timeout. >> >> Unfortunately at the restoreview-Phase the data was not already >> written to the bean. >> >> But I think: in the request there will be sent also the information >> from the old (session timed out) page. So I also should be able to >> read the value of this input-field 'loginType'. Is there any >> possibility to read from the request? >> >> Can anybody tell me if I am right, and tell me how to read this data? >> >> I use JSF Tomahawk and Facelets. >> >> >> Thanks! >> >> >> >> Here my input-text: >> >> >> >> > id="loginType" >> immediate="true" >> style="display:none;visibility:hidden;"/> >> >> >> >> >> >> here my PhaseListener: >> >> >> class PhaseListener >> { >> >> public void beforePhase(PhaseEvent event) >> { >> if(event.getPhaseId() == PhaseId.RESTORE_VIEW) >> { >> /* >> before processing any request, I control if the User >> is logged in >> to the application: >> */ >> UserBean user = JsfUtils.getUserBean(); >> >> if(!user.loggedIn()) >> { >> /* >> User is not logged in! >> */ >> ExternalContext extCtx = >> event.getFacesContext().getExternalContext(); >> HttpServletRequest request = >> (HttpServletRequest) extCtx.getRequest(); >> String reqUri = request.getRequestURI(); >> >> if(startOrErrorPageIsCalled(reqUri)) >> { >> /* >> Users that are not logged in are only >> allowed to see the >> login-page or the error pages... >> */ >> return; >> } >> else >> { >> /* >> Users that is not logged in tried to >> request the application. >> I want to redirect him to a page >> 'sessionExpired' depending on >> his former loginType; this loginType I want to save on the website; >> */ >> >> // HERE THE LOGINTYPE WAS NOT reset to >> the Bean. is there any >> other possibility to read this value from the request? >> if(user.getLoginType() == 1) >> { >> >> event.getFacesContext().getExternalContext().redirect(JsfUtils.getKontextRoot() >> + "sessionExpired.jsf"); >> } >> else >> { >> // redirect him to another >> website >> } >> } >> } >> >> } >> } >> >> >> } >> > >
how to read data from the request after session timeout?
Hallo all, when a session of an user timed out I display a Website telling 'Your Session expired; please login again!". Now I have to distinguish some 'loginType' of the user. If the user initially logged on by ldap i have to redirect him to another site as if he logged in by internal mechanisms. So I have to access the user's logintype data after the session timed out. I was thinking on a solution without using cookies: To do so, I put the loginType data to a hidden input field on the website. I thought that this data is not lost doing a request after session timeout. Unfortunately at the restoreview-Phase the data was not already written to the bean. But I think: in the request there will be sent also the information from the old (session timed out) page. So I also should be able to read the value of this input-field 'loginType'. Is there any possibility to read from the request? Can anybody tell me if I am right, and tell me how to read this data? I use JSF Tomahawk and Facelets. Thanks! Here my input-text: here my PhaseListener: class PhaseListener { public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RESTORE_VIEW) { /* before processing any request, I control if the User is logged in to the application: */ UserBean user = JsfUtils.getUserBean(); if(!user.loggedIn()) { /* User is not logged in! */ ExternalContext extCtx = event.getFacesContext().getExternalContext(); HttpServletRequest request = (HttpServletRequest) extCtx.getRequest(); String reqUri = request.getRequestURI(); if(startOrErrorPageIsCalled(reqUri)) { /* Users that are not logged in are only allowed to see the login-page or the error pages... */ return; } else { /* Users that is not logged in tried to request the application. I want to redirect him to a page 'sessionExpired' depending on his former loginType; this loginType I want to save on the website; */ // HERE THE LOGINTYPE WAS NOT reset to the Bean. is there any other possibility to read this value from the request? if(user.getLoginType() == 1) { event.getFacesContext().getExternalContext().redirect(JsfUtils.getKontextRoot() + "sessionExpired.jsf"); } else { // redirect him to another website } } } } } }
Re: getting information about caller-url
Hallo Mamallan! Thank You! I tried your proposal. In my example the RequestHeaderMap contains the following keys: 1.: User-Agent 2.: Host 3.: Connection 4.: Accept-Encoding 5.: Cookie 6.: Accept 7.: Accept-Language The key "referer" doesnot exist. Is it possible that this key does not exist, beacuse my caller-page is just a static html-page in my file system? At the moment I cannot test to call my application from a remote host. Do You think, when calling from a remote host, I will get the 'referer'-information? Regards, Georg 2009/7/13 Mamallan Uthaman : > Hi Georg, > > You can get that info from the request-header 'Referer'. You can access it > from the external context like below > > ExternalContext extCtx = > FacesContext.getCurrentInstance().getExternalContext(); > String refererHeader = extCtx.getRequestHeaderMap().get("Referer"); > > Thanks > Mamallan > > Georg Füchsle wrote: >> >> Hallo Rene! >> >> Thanks for your fast answer. >> >> This does not seem to fit to my problem: >> >> I tried to start my app from a static html-file. in this static >> html-file I put a static link to my application like: >> >> http://localhost/myapp/start.jsf";>start >> >> Then I examine the external context in a PhaseListener before the >> RestoreView-Phase: >> >> public void beforePhase(PhaseEvent event) >> { >> >> if(event.getPhaseId() == PhaseId.RESTORE_VIEW) >> { >> ExternalContext extCtx = >> event.getFacesContext().getExternalContext(); >> String callerUrl = extCtx.getRequestPathInfo(); >> //== null >> callerUrl = extCtx.getRequestServletPath(); // >> ==url of the >> actually called ressource ( inside my application) >> callerUrl = extCtx.getRequestContextPath(); // == >> context Root of >> my application >> >> } >> >> What I hoped to read is the URL of the static html-pagse from where I >> clicked the link to my application. >> >> Have You an idea how to get this information? >> >> >> >> Thanks Georg >> >> >> 2009/7/13 Rene van Wijk : >> >>> >>> All the request information is contained in the ExternalContext which >>> can >>> be accessed as: FacesContext.getCurrentInstance().getExternalContext(); >>> >>> >>> >>> It contains methods such as getRequestContextPath. >>> >>> -Original message- >>> From: Georg Füchsle >>> Sent: Mon 13-07-2009 11:36 >>> To: MyFaces Discussion ; >>> Subject: getting information about caller-url >>> >>> hallo, >>> >>> when starting my application I have to distinguish between the >>> different sites from where the user can call the application. >>> >>> Theese urls are outside application. >>> >>> Can somebody give me a hint how i can read the url from where the >>> user is calling? >>> >>> Thanks Georg >>> >>> >>> >
Re: getting information about caller-url
Hallo Rene! Thanks for your fast answer. This does not seem to fit to my problem: I tried to start my app from a static html-file. in this static html-file I put a static link to my application like: http://localhost/myapp/start.jsf";>start Then I examine the external context in a PhaseListener before the RestoreView-Phase: public void beforePhase(PhaseEvent event) { if(event.getPhaseId() == PhaseId.RESTORE_VIEW) { ExternalContext extCtx = event.getFacesContext().getExternalContext(); String callerUrl = extCtx.getRequestPathInfo(); //== null callerUrl = extCtx.getRequestServletPath(); // ==url of the actually called ressource ( inside my application) callerUrl = extCtx.getRequestContextPath(); // == context Root of my application } What I hoped to read is the URL of the static html-pagse from where I clicked the link to my application. Have You an idea how to get this information? Thanks Georg 2009/7/13 Rene van Wijk : > > All the request information is contained in the ExternalContext which can > be accessed as: FacesContext.getCurrentInstance().getExternalContext(); > > > > It contains methods such as getRequestContextPath. > > -Original message- > From: Georg Füchsle > Sent: Mon 13-07-2009 11:36 > To: MyFaces Discussion ; > Subject: getting information about caller-url > > hallo, > > when starting my application I have to distinguish between the > different sites from where the user can call the application. > > Theese urls are outside application. > > Can somebody give me a hint how i can read the url from where the > user is calling? > > Thanks Georg > >
getting information about caller-url
hallo, when starting my application I have to distinguish between the different sites from where the user can call the application. Theese urls are outside application. Can somebody give me a hint how i can read the url from where the user is calling? Thanks Georg
Re: Set a node invisible in tree2
Hallo, maybe You can do like this: You override your treenode class with an own class that also has a member 'visible' that is set when creating the treenodes. Then you can ask this value in your jsp code. for example similar like this: I have no example, where I can try this; so I canot promise, if this will work. Georg 2009/4/29 mitroiasi : > > > > Hallo Georg, > > Thank you for your reply. > But I want to set the invisible, not to delete them. > I explain my problem. > I have a menu implemented in a tree2 component. On the same time, on every > page I have a next and back buttons. When the user press the "next" button, > for example, she should see in the tree (menu) the next item selected. > But I can select one item based on the id (path), e.q. "0:2:3". Only I build > this tree based on some conditions and sometimes one node has the id "0:2:3" > and in other conditions "0:3:3". > > For this reason I want to have the entire tree but some items to be > invisible. > > If you know a good solution please let me know > -- > View this message in context: > http://www.nabble.com/Set-a-node-invisible-in-tree2-tp23211324p23292512.html > Sent from the MyFaces - Users mailing list archive at Nabble.com. > >
Re: may I use session scoped beans in an application scoped bean's method?
Thanks Matthias, I do not use EL API, and I don't understand what you mean by DI-container. But I can show you the following example: I have an application scoped bean and a session scoped bean (MbSessionBean) In my application scoped bean I found code like that: public String getImageUrl() { int layout = (MbSessionBean)getManagedBean("mbsessionbean").getLayout(); if(layout == 1) return "/pages/imageone.jpg"; else return "/pages/imagetwo.jpg"; } protected static final Object getManagedBean(String beanName) { Object ob; FacesContext facesContext = FacesContext.getCurrentInstance(); Application app = facesContext.getApplication(); javax.faces.el.ValueBinding vb =app.createValueBinding("#{"+beanName+"}"); ob = vb.getValue(facesContext); return ob; } Of course this is not nice code, because I ask user dependent data from a method of an application scoped bean. But I wonder how it can work. How does the application bean know which session scoped bean it should ask? Obviously it works. But does it only work by chance, ( for example because there has never been 2 or more session beans with different data at the same time...) or does it really work? If it works (even the code is ugly) I could let it this way now and clean it another time Cheers Georg 2009/4/27 Matthias Wessendorf : > I'd not do that... > > generally fetching beans by using the EL API is not that good. > Use a real DI container for that > > -M > > On Mon, Apr 27, 2009 at 11:22 AM, Georg Füchsle > wrote: >> Hallo, >> >> I found such things in my code: >> >> In an static method of an application scoped bean I fetch a session >> scoped bean and read some data from it. >> It seems to work. But is it really allowed? >> >> Georg >> > > > > -- > Matthias Wessendorf > > blog: http://matthiaswessendorf.wordpress.com/ > sessions: http://www.slideshare.net/mwessendorf > twitter: http://twitter.com/mwessendorf >
may I use session scoped beans in an application scoped bean's method?
Hallo, I found such things in my code: In an static method of an application scoped bean I fetch a session scoped bean and read some data from it. It seems to work. But is it really allowed? Georg
Re: Set a node invisible in tree2
Hallo, when processing the action you can delete your node serverside. This should be the easiest way. If you want to show/hide the node by Javascript it will be more work. You have to look at the produced html-Code to find the ids of the that corresponds to your node and hide it by Javascript. but actually I didn't try this... cheers, Georg 2009/4/24 mitroiasi : > > > Hi, > > I want to set a node invisible in a tree2 component. > I didn't find any proper method to do this. > Is it possible to implement this? > If yes, how? > > Thank you > -- > View this message in context: > http://www.nabble.com/Set-a-node-invisible-in-tree2-tp23211324p23211324.html > Sent from the MyFaces - Users mailing list archive at Nabble.com. > >
Re: how to add post-data to a redirect from an action
Hallo Walter, thanks for Your reply. I have tried to understand what ist httpclient, but I am not shure if I am right. What I guess is that httpclient can manage the client-communication to a web server. That means I can make programs that interact with a webserver. (like calling an url with some data and process the response.) What I want to do is: inside my WebApp - when the User pressed a button - I want to redirect the User to another WebApp on another server provided with some post-data. The answer to this request to the second WebApp should never arrive at my WebApp but should be interpreted by the User's browser. Do You think, httpclient can help me doing this? Thanks, Georg 2009/4/21 Walter Mourão : > Some time ago I wrote a small http proxy where an web service call generates > a http post. I used commons-httpclient: http://hc.apache.org/httpclient-3.x/ > and it was quite useful. > > Cheers, > > Walter Mourão > http://waltermourao.com.br > http://arcadian.com.br > http://oriens.com.br > > > > On Tue, Apr 21, 2009 at 7:58 AM, Georg Füchsle > wrote: >> >> Hallo Simon, >> >> >> Yes You have understood right: I want the user's browser to call >> another server and dont want to continue processing my application >> afterwards. >> >> I also have thought about the JavaScript solution. >> But using a js solution generally I will write the xml-data into the >> user's html. I did'nt like to do that, because this (xml-)data grants >> You access to the other application. For this reason I wanted to hide >> the xml-data. But using get-Parameters the xml-data is visible the >> same. >> >> >> Maybe should think about a ajax- functionality like this: >> >> I use a commandbutton that supports ajax-request and a hidden form >> that makes a post-request. >> When the user clickes the commandbutton i can fill the data of the >> form via ajax and then in an after-ajax-event click the submit-button >> of the form via JavaScript. Do You think this will work? >> >> I hoped, there would be an more easy way >> >> Thank You for Your help. >> >> Regards >> >> >> Georg >> >> 2009/4/21 Simon Kitching : >> > Georg Füchsle schrieb: >> >> hallo, >> >> >> >> >> >> I have to call another application out from JSF. >> >> To call this application i have to send (xml) data via post to the >> >> start-url of this application. >> >> >> >> I found some example on the web: >> >> >> >> >> >> ExternalContext extContext = >> >> FacesContext.getCurrentInstance().ctx.getExternalContext(); >> >> String name = URLEncoder.encode("INTERFACENAME", "utf-8"); >> >> String someData = " >> >> "; >> >> String value = URLEncoder.encode(someData , "UTF-8"); >> >> String viewId = "http://www.server.com/startapp/index.html"+ '?' + >> >> name + "=" + value; >> >> String urlLink = extContext.encodeActionURL(viewId); >> >> extContext.redirect(urlLink); >> >> >> >> >> >> >> >> I tried this code. its calls the new application, but the data is sent >> >> via GET: >> >> >> >> >> >> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding. >> >> >> >> So the intefacedata is easily be read by the user. Has anyone any idea >> >> how i can make a rediract with POST data? >> > >> > When you say "call another application out", do you mean that you want >> > the *user's browser* to send a POST command to some other server, and >> > then display the result returned from that server (without any further >> > processing)? >> > >> > HTTP provides no way to do this; the http-redirect facilities only do >> > GET commands. See the HTTP specification for more details. What your >> > code above does (extContext.redirect) just generates an http redirect >> > response, and the user's browser then processes this response and does >> > the redirect. >> > >> > HTML provides no way to do this either AFAIK. >> > >> > JSF just uses HTTP and HTML, so JSF also has no way to do this. I think >> > you will need to use javascript, ie generate an HTML page that contains >> > an html with the fields you want, and some javascript that then >> > does document.getElementById(formId).submit() or something similar. >> > >> > >> > Or does "call another application out"mean that after a JSF submit, you >> > want *your server* to send a POST command to some other server, then >> > process the result before sending back a new page to the user? You can >> > use the apache commons-httpclient library to do things like this. >> > >> > Regards, >> > Simon >> > >> > -- >> > -- Emails in "mixed" posting style will be ignored >> > -- (http://en.wikipedia.org/wiki/Posting_style) >> > > >
Re: how to add post-data to a redirect from an action
Hallo Simon, Yes You have understood right: I want the user's browser to call another server and dont want to continue processing my application afterwards. I also have thought about the JavaScript solution. But using a js solution generally I will write the xml-data into the user's html. I did'nt like to do that, because this (xml-)data grants You access to the other application. For this reason I wanted to hide the xml-data. But using get-Parameters the xml-data is visible the same. Maybe should think about a ajax- functionality like this: I use a commandbutton that supports ajax-request and a hidden form that makes a post-request. When the user clickes the commandbutton i can fill the data of the form via ajax and then in an after-ajax-event click the submit-button of the form via JavaScript. Do You think this will work? I hoped, there would be an more easy way Thank You for Your help. Regards Georg 2009/4/21 Simon Kitching : > Georg Füchsle schrieb: >> hallo, >> >> >> I have to call another application out from JSF. >> To call this application i have to send (xml) data via post to the >> start-url of this application. >> >> I found some example on the web: >> >> >> ExternalContext extContext = >> FacesContext.getCurrentInstance().ctx.getExternalContext(); >> String name = URLEncoder.encode("INTERFACENAME", "utf-8"); >> String someData = " >> "; >> String value = URLEncoder.encode(someData , "UTF-8"); >> String viewId = "http://www.server.com/startapp/index.html"+ '?' + >> name + "=" + value; >> String urlLink = extContext.encodeActionURL(viewId); >> extContext.redirect(urlLink); >> >> >> >> I tried this code. its calls the new application, but the data is sent via >> GET: >> >> http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding. >> >> So the intefacedata is easily be read by the user. Has anyone any idea >> how i can make a rediract with POST data? > > When you say "call another application out", do you mean that you want > the *user's browser* to send a POST command to some other server, and > then display the result returned from that server (without any further > processing)? > > HTTP provides no way to do this; the http-redirect facilities only do > GET commands. See the HTTP specification for more details. What your > code above does (extContext.redirect) just generates an http redirect > response, and the user's browser then processes this response and does > the redirect. > > HTML provides no way to do this either AFAIK. > > JSF just uses HTTP and HTML, so JSF also has no way to do this. I think > you will need to use javascript, ie generate an HTML page that contains > an html with the fields you want, and some javascript that then > does document.getElementById(formId).submit() or something similar. > > > Or does "call another application out"mean that after a JSF submit, you > want *your server* to send a POST command to some other server, then > process the result before sending back a new page to the user? You can > use the apache commons-httpclient library to do things like this. > > Regards, > Simon > > -- > -- Emails in "mixed" posting style will be ignored > -- (http://en.wikipedia.org/wiki/Posting_style) >
how to add post-data to a redirect from an action
hallo, I have to call another application out from JSF. To call this application i have to send (xml) data via post to the start-url of this application. I found some example on the web: ExternalContext extContext = FacesContext.getCurrentInstance().ctx.getExternalContext(); String name = URLEncoder.encode("INTERFACENAME", "utf-8"); String someData = " "; String value = URLEncoder.encode(someData , "UTF-8"); String viewId = "http://www.server.com/startapp/index.html"+ '?' + name + "=" + value; String urlLink = extContext.encodeActionURL(viewId); extContext.redirect(urlLink); I tried this code. its calls the new application, but the data is sent via GET: http://www.server.com/startapp/index.html?INTERFACENAME==%3C%3Fxml+version%3D%271.0%27+encoding. So the intefacedata is easily be read by the user. Has anyone any idea how i can make a rediract with POST data? Thanks Gio
configuring resource adapter embedded in ear
hallo, I have an resource adapter 'httpjca.rar' that is embedded into an ear-file. When deploying this ear-file the resource adapter is installed as an internal module and there is installed an connection-factory for the rar. I want to preset the in the ra.xml-configuration the jndi-name of this resource adapter and connection-factory. In the ra.xml i set a config-property 'jndiName' ti my desired name 'comfip' But after installing to WebSphere the jndi-Name is automatically set to 'javax.resource.cci.ConnectionFactory'. Can anyone help me how to configure the resource adapterwell, so that the right values are written during deployment? here my ra.xml: http://java.sun.com/dtd/connector_1_0.dtd";> httpAdapter JCA Adapter for ComFIP safir-wid 1.0 HTTP 0.1 false de.safir.web.jca.HttpEISManagedConnectionFactory javax.resource.cci.ConnectionFactory de.safir.web.jca.HttpEISConnectionFactoryImpl javax.resource.cci.Connection de.safir.web.jca.HttpEISConnection NoTransaction Host to connect Host java.lang.String entwo210l Port to connect Port java.lang.Integer 4110 jndiName java.lang.String comfip Basic BasicPassword javax.resource.security.PasswordCredential false
AW: [Tomahawk] how to save input-values when pressed a button with immediate tag set?
It worked well. Thank You. Georg -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Volker Weber Gesendet: Montag, 28. Januar 2008 18:40 An: MyFaces Discussion Betreff: Re: [Tomahawk] how to save input-values when pressed a button with immediate tag set? Hi Georg, 2008/1/28, Georg Füchsle <[EMAIL PROTECTED]>: > Is there a way to save these values? Can I do this by hand while processing > action of my button? you can get the values from the requestParamaters: Map params = facesContext.getExternalContext().getRequestParameterMap(); String value = (String) params.get(); Regards, Volker -- inexso - information exchange solutions GmbH Bismarckstraße 13 | 26122 Oldenburg Tel.: +49 441 4082 356 | FAX: +49 441 4082 355 | www.inexso.de __ safir-Wirtschaftsinformationsdienst GmbH Möllendorffstr. 49 10367 Berlin Tel.: ++49 30 577981 - 0 Fax: ++49 30 577981 - 18 E-Mail: [EMAIL PROTECTED] Internet: www.safir-wid.de Handelsregister: Amtsgericht Charlottenburg HRB 66681 USt-ID: DE 193584747 Geschäftsführer: Thilo Kind
[Tomahawk] how to save input-values when pressed a button with immediate tag set?
Hallo! I have got a form with some input elements using the 'required'-tag. There is also a button that leads to an intermediate form with some extra input fields. This button has got the 'immediate'-tag set true, in order to allow this navigation even if not all required fields are set. But in this way I cannot save the values that already had been inputted to the fields of the first form. (I would like to save then even if they are not complete, because I want to display them again, when returning to the first form.) Is there a way to save these values? Can I do this by hand while processing action of my button? Thanks! Georg __ safir-Wirtschaftsinformationsdienst GmbH Möllendorffstr. 49 10367 Berlin Tel.: ++49 30 577981 - 0 Fax: ++49 30 577981 - 18 E-Mail: [EMAIL PROTECTED] Internet: www.safir-wid.de Handelsregister: Amtsgericht Charlottenburg HRB 66681 USt-ID: DE 193584747 Geschäftsführer: Thilo Kind
AW: Action behind plus/minus icon tree2 tomahawk
Hallo! I think you can do so using ajax4jsf. There is an example here: http://www.jroller.com/plainoldweblog/entry/use_tomahawk_tree2_and_ajax4jsf I used this and it worked fine. When toggling the Items the method public void processToggle(ActionEvent p_event) is called and there is the possibility to dynamically build the tree data. (In the example the functions loadChildren(node); and unloadChildren(node);) Georg -Ursprüngliche Nachricht- Von: Wolfgang [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 15. Januar 2008 10:52 An: MyFaces Discussion Betreff: Action behind plus/minus icon tree2 tomahawk Hi, does anyone know if there is a possibility to put an action behind the plus/minus (expand/collapse) icon in a tomahawk tree2? What I want is to execute a method which adds some more children to the tree by clicking the plus icon Thanks a lot! Wolfgang __ safir-Wirtschaftsinformationsdienst GmbH Möllendorffstr. 49 10367 Berlin Tel.: ++49 30 577981 - 0 Fax: ++49 30 577981 - 18 E-Mail: [EMAIL PROTECTED] Internet: www.safir-wid.de Handelsregister: Amtsgericht Charlottenburg HRB 66681 USt-ID: DE 193584747 Geschäftsführer: Thilo Kind