Facelets - setting locale via link

Hello Everyone,
I am developing a small web app. A file upload with additional params, its processing on submit and returning the final chart (an image). There are two links for switching to another locale and one for a help page.
The first version was made as JSP page with EL tags and backing servlet. It worked fine but I found the final image can't be saved on local disk. Later I figured out it is caused by browser behaviour during 'save' action, when the servlet is called again (if the image is not already in cache), but as original parameters are missing in this phase, creating of the final image fails.
Trying to solve my problem I've found PRG pattern [1] which seems to be promising answer. I've chosen facelets framework (Mojarra) and tried to refactor app logic a bit. As I see, the complexity of the whole solution grows... and not everything I am able to solve...
My current blocker is a language switcher. What could be in JSP made relatively easy using the following code at the beginning:
<c:if test="${param['locale'] != null}">
  <fmt:setLocale value="${param['locale']}" scope="session" />
</c:if>and handled by very simple links:
<a href="index.jsp?locale=en-GB">English</a> | <a href="index.jsp?locale=cs-CZ">Czech</a>is now unsolvable issue for me.
After long trial error path I set up the following way, but it still doesn't work properly.
In xhtml:
<f:view encoding="utf-8" locale="#{localeBean.locale}">
<h:form>
  <h:commandLink action="#{localeBean.setLocaleEx}">
    <f:setPropertyActionListener
       target="#{localeBean.locale}" value="en"/>
    English
  </h:commandLink>
  <h:commandLink action="#{localeBean.setLocaleEx}">
    <f:setPropertyActionListener
       target="#{localeBean.locale}" value="cs"/>
    Czech
  </h:commandLink>
  <h:outputText value="#{localeBean.locale}" />
  ...In Bean:
@ManagedBean
@RequestScoped
public class localeBean {
    protected String locale = "cs";
    public String getLocale() {
        return locale;
    public void setLocale(String locale) {
        this.locale = locale;
    public void setLocaleEx() {
}Click on generated link really change localeBean.locale value which is displayed using directive h:outputText, but...
1. refreshing of the page is very very slow on my quite recent PC (I use Tomcat 6 as the container - the JSP delay was undetectable)
2. no locale is changed (a f:view locale atribute is probably ignored)
3. in the final HTML page there is a quite long JavaScript
... so unacceptable for me.
Can I create links which can change locale more straigforward and reliable way? And without that JavaScript?
Can I set f:view locale using any parameter sent using a simple URL link like Czech ? I need this setting also for Help page, so a session scope is required. Can this be done via facelets?
Curently I am puzzled a bit...
Thanks in advance for any hint.
Regards,
Jan
[1] [http://blogs.sun.com/enterprisetechtips/entry/post_redirect_get_and_jsf|http://blogs.sun.com/enterprisetechtips/entry/post_redirect_get_and_jsf]

ad 1) refreshing of the page is much better now (maybe there was a memory problem)
ad 2) locale seems to be updated, but I still don't know why my strings are not localized according to this locale
ad 3) if JavaScript is disabled in a browser, switching of locale doesn't work anymore. It would be better to avoid JS at all, but I resigned.
I've found my initial approach is wrong. When some form values are edited and locale is changed in a proposed way, these parameters are reset to their default values.
What I probably need is applying PRG pattern also on this part - somehow to set a new locale and then refresh the same page. I've tried that using 'metada' element at the begining of the page, but it is not very clear how to change locale via commandlink:
<f:metadata>
   <f:viewParam name="loc" value="#{localeBean.locale}" />
</f:metadata>
<f:view encoding="utf-8" locale="#{localeBean.locale}">
<f:loadBundle basename="messages" var="i18n" />
<h:commandLink action="index?faces-redirect=true&includeViewParams=true">
   <f:setPropertyActionListener target="#{localeBean.locale}" value="cs"/>
   Czech
</h:commandLink>as I am getting message when this link is clicked: Conversion Error setting value 'en' for 'null Converter'.
('en' is the default locale set directly in the backing bean)
There is probably impossible to use 'setPropertyActionListener' in this kind of command link, but I have no better idea.
Tu sumarize that, I need a form with two links for switching texts to another locale and one submit button for sending form data to my servlet, all that using PRG pattern to avoid resubmitting once sent data. I prefer the simplest solution.
From my point of view this is the basic feature of any web and I am quite upset that it is still unclear how to resolve it.
Jan

Similar Messages

  • How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided.

    How to I set an internal link in a PDF document using Preview?  After setting a link under the Tools/Annotations menu, the link doesn't work and no detailed instructions are provided via the Help menu other than it showing the pull-down menu selection to make.

    No.  I am able to use the other features such as underlining, highlighting, adding rectangles and oval and save those changes.

  • Importing Data from MS Access into SQL Serevr 2005 via Linked Server: User-Dependent failure

    I am operating an Express version of SQL Server 2005 on a Windows XP machine.
    I have successfully setup a linked server to a remote Access (.mdb) database. With my user account (Windows authentication) I can retrieve and store data without any problem.
    I have another user (apparently with same settings as my own account) that is always failing to get the data.
    The Error message he gets is:
    OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "TSU_Tmp" returned message "The Microsoft Jet database engine cannot open the file '\\DSITSO-NT0001\Exchange\Database5.mdb'.  It is already opened exclusively by another
    user, or you need permission to view its data.".
    Msg 7303, Level 16, State 1, Line 1
    Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "TSU_Tmp".
    Here below the code used to set up the linked server (coming from the Code Snippets of SQL Server 2005).
    EXEC sp_addlinkedserver
    @server = N'TSU_Tmp',
    @provider = N'Microsoft.Jet.OLEDB.4.0',
    @srvproduct = N'OLE DB Provider for Jet',
    @datasrc = N'\\DSITSO-NT0001\Exchange\Database5.mdb'
    EXEC sp_addlinkedsrvlogin
    @rmtsrvname = N'TSU_Tmp',
    @useself = N'TRUE',
    @locallogin = NULL,
    @rmtuser = N'Admin',
    @rmtpassword = NULL
    We both run the script, actually is a Stored Procedure, (see code below) on the same XP machine where SQL Server is running.
    EXEC('INSERT INTO tblFcst
    (StartBUCode, StartBUType, StartBUSeq, StartTrz, StartCty,
    EndBUCode, EndBUType, EndBUSeq, EndTrz, EndCty,
    FcstCreationPeriod, FcstValidForPeriod, Fcst, FcstExternalReference,
    IsProcessed, IsSolved)
    SELECT TSU.BUCodeSend, TSU.BUTypeSend, TSU.BuaNoSend, Null AS StartTrz, Null AS StartCty,
    TSU.BUCodeRcv, TSU.BUTypeRcv, TSU.BuaNoRcv, Null AS EndTrz, Null AS EndCty,
    TSU.[Current week], TSU.[Forecast for week], TSU.[Volume trp m3], TSU.[TSU_ID (Don''t touch me)],
    0 AS IsProcessed, 0 AS IsSolved
    FROM TSU_Tmp...tbl_TSU_trpm3 AS TSU;')
    PS: it is run using an 'EXEC(String)' format as at compile time of Store Procedure the Linked Server is not existing and otherwise compile would fail.
    We tried it with different files, in different locations. It always wors for me, never for him...
    The files were not used by anyone else. The folder(s) where they were stored are open to "Everyone".
    So I concluded it should be something linked to the User... :) But I really do not know what, as said apparently we have exactely the same setup in our Login profiles.
    Any idea or suggestion is welcome.
    Thanks
    Luca

    Hi Luca Lentati,
    According to your description and T-SQL statement, we need to verify if the download and install the Microsoft.Jet.OleDB.4.0 as a provider.
     If the 64bit SQL Server is running on the server,  The error, the Microsoft.Jet.OleDB.4.0 is not support, I reommend you download and install the Microsoft.ACE.OLEDB.12.0 as a provider.
    The error 7303 message indicates that the linked server does not have correct login mapping. You can execute the sp_helplinkedsrvlogin stored procedure to set the login information correctly. Also, verify that you have specified the correct parameters
    for the linked server configuration.
    In addition, if the issue still exists, I recommend you copy the access file to local Server, and create linked server between them , check if it can run well. If yes, it means that
     the account which SQL server uses to run the service does not have read/write access to that file share.
    There is an article about configuring a Linked Microsoft Access Server on SQL 2005 Server , you can review the following article.
    http://www.aspfree.com/c/a/Microsoft-Access/Configuring-a-Linked-Microsoft-Access-Server-on-SQL-2005-Server/
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Helo to set locale in java

    Dear All,
    please help me how to set locale in java and how it works.
    please send me the link or code.
    thanks in advance
    Anjul Tyagi
    Message was edited by:
    Anjul
    Message was edited by:
    Anjul

    GraphicsEnvironment.getAllFonts
    an array of available Fonts
    Add a new Font with new Font() contructor.
    Font f = new Font("Lucida Sans", font.PLAIN, 12)
    Method Font.createFont(int, InputStream) provides
    the ability to add fonts at runtime.

  • Force editing document locally by link

    Hello Community,
    Hopefully it is the right forum for this problem.
    I'm working with the Enterprise Portal and need a solution for the following problem.
    I have some documents, stored in folder. One is like a central document with hints and links to the other documents. When I'm opening a document via link in this document, the target document opens and I have the possibility to change it.
    Is it possible to have this functionality in a collaboration room, with check in and check out of the document I want to edit when clicking on a link in this "central" document? In other words, is it possible to force local editing via hyperlink?
    Thanks for every hint or solution!
    Message was edited by: Frank Hahnemann

    Thanks for this hint, this works. It is a nice workaround. But now I have the problem, that a new Browser opens and I have to log in again. But this is maybe another "not Enterprise Portal"-problem. Another one is a maximum length of 255 chars for a hyperlink in MSExcel and this is just a MSOffice problem.
    Maybe I have to find another solution for the whole problem.
    Regards,
    Frank

  • Set Locale ID extension for Dreamweaver 8

    Is anyone aware of an alternative for the Set Locale ID server extension by Jason Parker as it returns an "Invalid Extension" when attempting to download it.
    Using ASP pages with Access database which has suddenly started to reformat the date from an input form to the US format of mm/dd/yyyy instead of the programmed dd/mm/yyyy format. The error does not occur when the database is run locally, only when via the web server which makes me think that although the locale on the web server shows the UK locale of 2057 I need to add a server script to my ASP pages to ensure the dates are indeed in UK format.

    While hopefully one of our Add-ons community members may know the answer you will probably have better luck posting your question on the Dreamweaver forum as Add-ons is focussed on CS6 and up.
    I hope you are able to find a solution.
    Best,
    Jonathan

  • Edit Locale Settings Link

    I was wondering if anyone knows what API calls I must make to get the 'Edit Locale Settings' Link for a given user which exists on the 'My Account' page.
    Thanks,
    Mike
    P.S. This is for version 5.x

    I can tell you right now, building your own activity space to cut the steps and do what you want is about the only way to go.
    What I would like to know is:
    1) Did I miss a simple way of bypassing the MyAccount page to go straight to the Edit Locale Settings page?
    - you could just hack the page, create a hyperlink and copy the edit local setting page url... that would work.
    - however, you can never get it to redirect back to the current page the user was on, b/c that's now what this edit local setting page does.
    2) Is the activity space the simplest and best way of accomplishing what I need?
    - yes, b/c the locale setting needs to take place and a refresh of content needs to take place. Basically, you still need to mimick what the edit locale page did to get this to change instantaneously for the user as well as do the rest of the actions you described.
    3) If not, would it be possible to create a custom tag to replace the PT:MyAccount tag so that the custom tag goes straight to the locale page?
    - you could do it this way. But why not do #1 instead?
    The short of it... going to the editor page is the simliest and easiest way about it. But the editor page points back to the my account page. If you want to change this behavior, you will have to hack it somehow... which is not possible really unless you build your own activity space.

  • Setting locale before mounting local filesystems

    I have this problem when mounting an NTFS partition:
    http://www.ntfs-3g.org/support.html#locale
    I have figured out that the problem is that the locale is set after mounting the partitions (it is the last reason listed on the support question above).  Is there a way I can have the locale be set before mounting those partitions?  I figured it may be in /etc/rc.sysinit but don't know much about that file, so don't want to mess it up (as I have before).
    I know there is an option to set "locale=" in /etc/fstab, but I think the above solution would be better since it would work across the board with all the generated locales.

    Yes, I had all the locales set, and that's not the problem.  The problem is that the filesystem is mounted prior to the locale being set during boot (as mentioned in the link I posted).
    I  have set the "locale=en_US.utf-8" setting in /etc/fstab and it works, so it isn't really a big problem.  But I originally thought that I would need to set it as de_DE.utf8 to be able to read umlauts and what not, but it works with the en_US locale set under fstab.
    I was trying to find a solution without having to set "locale=" in fstab, but since the English worked, I'm OK with that.

  • Is it possible to set  Local Currency - INR in SAP B1 8.81

    Hi,
    In SAP B1 Version  8.81 , i have taken Type -Chart of Accounts - as Global
    and  Localization - United Kingdom  And just tell me is it possible to set
    Local Currency - INR in SAP B1 8.81

    Hi,
    You can set any currency till the time there is no transactions in the database.
    Please do remember that the on selection of the Localization UK, the legal aspects and the tax law pertaining to the UK will be applicable and also you have to check for the exchange rate calculation based on settings (direct/indirect).
    Also, taking INR as LC will lead to INR being the main currency and hence the reports generation and reconciliation of all the Multi-Currency will be performed in the Lead Currency.
    All the Best.
    Kind Regards,
    Jitin
    SAP Business One Forum Team

  • How "not to set locale " in user's profile?

    In the "Oracle Universal Content Management 11gR1 Differences between 11gR1 and 10gR3" document
    http://www.oracle.com/technology/products/content-management/ucm/diffsbetween10gand11g.pdf
    says:
    "If locale is not set in a user’s profile, Content Server can pick that up from a HTTP header variable."
    However, how do I "not to set locale " in user's profile? it appears as a dropdown list and there is no option to enter null.
    Thanks

    Hi there,
    What you're changing is per-user but those options are set in the Utilities->System Properties applet
    Here's how you change it:
    Go to the System Properties applet:
    UNIX: Start the System Properties utility by running the System_Properties script, which is located in the bin subdirectory of the Stellent Content Server installation directory.
    Windows: From the Windows Start menu, select Programs -> Content Server Content Server -> [Instance Name] -> Utilities -> System Properties.
    Then once the System Properties applet is started:
    # Open the Localization tab.
    # In the list of locales, you can Disable the locales you have here or maybe a new option with 11g will show up.
    # When you are done, click OK to apply the setting and exit System Properties.
    # Restart each instance of the content server.
    Cheers,
    malky

  • No longer able to follow local file links.

    In previous versions of firefox ( 28 and Earlier ) I was able to follow local file links by whitelisting them in the user preferences file as shown here: http://kb.mozillazine.org/Links_to_local_pages_do_not_work
    This functionality has ceased to work with the update.

    You might find a similar bug already posted, but if not, sure, others are going to have the issue.
    I guess one question is implementation. What mechanism is replacing capability preferences? If there isn't something that general purpose, what kind of site-level permission could be relevant?
    And if the need is not clear, what are the use cases for http:// to file:// access that the developers need to consider? Or is it for file:// to file:// access that's most critical?

  • When I try to set up a link to AOL on the desk top, I get a link to Chrome, which I deleted from my computer. How do I get a link to Firefox?

    When I drag the symbol from the URL line to the desktop to set up a link, I get a google chrome icon instead of a firefox icon. I removed chrome from the computer, but I still get a chrome icon which links does not work. How do I get the reference to chrome out of firefox?

    Tried again about 30 minutes later, and now I get firefox links. Don't know what changed, but seems to be OK.
    Joyce3

  • Query via linked server to DB2/NT gives different results

    I have a DB2 9.7 database I need to query. I'm testing from four separate SQL Servers.
    ServerA - SQL 2012 SP2
    ServerB - SQL 2012 SP1
    ServerC - SQL 2012 SP1 CU1
    ServerD - SQL 2012 SP1
    I set up a linked server from ServerA. I run QueryA, and am happy with the results.
    I create a linked server from ServerB. I run QueryA and get the message, "Error converting data type DBTYPE_DBDATE to datetime."
    I did the same test on ServerC. It works fine.
    If, inside OPENQUERY, I convert the datetime to a varchar, call it QueryB, it mostly works, but will be missing a small percentage of datetime values from that converted column when run on ServerB. If I run QueryB on the on ServerA, those missing
    values are there. Same for ServerC.
    At this point, I can think only that the main difference is the service pack and CU level. I can't find any documentation on updates that are relevant, but doesn't mean much.
    Then, I did the same test on ServerD. ServerD is at the same SP/CU level as ServerB. ServerD worked just fine. Apparently it's not the service pack or cumulative update level making the difference.
    My setup: On each server I loaded MS OLE DB Provider for DB2 Version 4.0. I used the same sp_addlinkedserver script with the same connection string on each server. QueryA and QueryB both used OPENQUERY. They were identical except for the CAST to varchar
    for a datetime field. This CAST became a call to a function VARCHAR on the DB2 server in later tests with the same result. 
    Of course, the only place I actually need this working is ServerB.
    tia,
    Steve

    Sure, with some obfuscation and shortening.
    On each server, (except the first where I had to figure it out), I went through the same process.
    Load MS OLE DB Provider for DB2 Version 4.0 version 9.0.1390.0
    Run the Create Linked Server query
    Run QueryA.
    Only on ServerB has this been a problem. 
    --Create Linked Server
    EXEC sp_addlinkedserver
    @server='LinkedServer',
    @srvproduct='Microsoft OLE DB Provider for DB2',
    @catalog='DBName',
    @provider='DB2OLEDB',
    @provstr='Provider=DB2OLEDB;User ID=Username;Password=Password;Initial Catalog=DBName;Network Transport Library=TCPIP;Host CCSID=1252;PC Code Page=1252;Network Address=127.0.0.1;Network Port=50000;Package Collection=MSDB2COL;Process Binary as Character=False;Units of Work=RUW;DBMS Platform=DB2/NT;Use Early Metadata=False;Defer Prepare=False;DateTime As Char=False;Rowset Cache Size=0;Datetime As Date=False;AutoCommit=True;Authentication=Server;Decimal As Numeric=False;Derive Parameters=True;LoadBalancing=False;Persist Security Info=True;Cache Authentication=False;Mode=Read;Connection Pooling=False;'
    --QueryA
    SELECT * FROM OPENQUERY(LinkedServer,'
    SELECT [ARRIVAL]
          ,[ACCT_CODE]
          ,[ACC_EVENT_ID]
          ,[TRANS_DATET]
          ,[AVAIL_DATE]
          ,[AVAIL_STATUS]
      FROM [DBName].[UserName].[TableName]
    ') AS TableNameLink
    --QueryB
    SELECT * FROM OPENQUERY(LinkedServer,'
    SELECT [ARRIVAL]
    ,[ACCT_CODE]
    ,[ACC_EVENT_ID]
    , CAST([TRANS_DATET] AS VARCHAR(26)) TRANS_DATET
    ,[AVAIL_DATE]
    ,[AVAIL_STATUS]
    FROM [DBName].[UserName].[TableName]
    ') AS TableNameLink
    --QueryC
    SELECT * FROM OPENQUERY(LinkedServer,'
    SELECT [ARRIVAL]
    ,[ACCT_CODE]
    ,[ACC_EVENT_ID]
    , VARCHAR([TRANS_DATET]) TRANS_DATET
    ,[AVAIL_DATE]
    ,[AVAIL_STATUS]
    FROM [DBName].[UserName].[TableName]
    ') AS TableNameLink

  • Setting up Navigational Links

    Hi everybody!
    I would like to call custom view (copied from standard view).
    1. Copied view "IRecPartner" into application Z_CRM_IC.
    2. Defined custom IC Web Client & IC Web Client Runtime framework profiles.
    3. Defined navigational link through application Z_CRM_DT_REP.
       Made changes for Page fragments:
       CRM_IC_All_NavLinks.xml
       CRM_IC_All_Viewsets.xml
       IRecNavigationalLink.xml
       IRecViewSets.xml
       In page "IRecNavigationalLink.xml" changed navigational link for view "IRecPartner".
    Requirement: Execute "CRM_IC" --> Interaction Record --> Partner.
    Instead of standard "IRecPartner", it should call custom (copied) "IRecPartner".
    But on the same page, it should show one custom view and others as standard ones.
    In my case, after click on "Partners" button of "Interaction Record", it shows only one
    view (custom IRecPartner), but no other standard view is being displayed.
    Can anybody guide me for setting custom navigational links?
    Best Regards,
    Priya

    Many Thanks Ken. I had a sneaking suspicion it might be the Crossover Mac program doing it.
    It's a great program but it does have its limitations.
    Thanks again.

  • How to set local path for load library

    Hi,
    How do i set local path for native dll as i dont want to set the path in the environment variable.
    can i do like this
    System.loadLibrary("c:\abc");
    Thanks

    I believe that System.load() does exactly the same thing, but accepts fully qualified filenames. So give that a try.
    Failing that.... maybe you can add -Djava.library.path=
    to your command line to explicitely override the path set ?
    regards,
    Owen

Maybe you are looking for

  • ALV help plz

    Hello, my alv contains a lot of fields .So when i scroll to the right ,i lose the first few fields and i do not know which one it is. 1)How can i make the first 2 fields in my alv static(they do not move) , so that when i scroll to the right ,they ar

  • Want to know the buffer size on the 5SD mk3...

    ... and/or the number of full res raw files it can hold. Wondering if I usually shoot a max of six shot bursts, does the card write speed even matter? Solved! Go to Solution.

  • Error handling in Web Dynpro

    Hello, in a web dynpro applicatio we are currently developing we have the following scenario for error handling: We want to redirect the user to an error page everytime an error occurs. This page should be called whenever an exception is raised in th

  • Crystal reports 2011 exporting report having sub reports to excel

    I have recently upgraded to crystal reports 2011 , but found crystal report engine problem when exporting to excel which has got subreport and in the subreport  having groups defined.IT gets hanged when calling reportdocument. export in visual studio

  • Graphics Card Dilemma... 9800 Pro or 9600 Pro

    I have a dual 867 G4 in which I have just recently upgraded the stock graphics card to the new dual PC/Mac ATI Radeon 9600 Pro. I now have the opportunity to install a ATI Radeon 9800 Pro which is the genuine Mac version and not a PC reflashed one. M