Use a Message from a bundle in a JavaScript string?

I cannot use an h:outputText in a JavaScript string, for example:
function init()
setTitle("<h:outputText value="#{msgs.title}"/>");
How can I get a text string from messages.properties that I want to use in some client side JavaScript code?
Thanks in advance,
Sam

Hi Sergey,
I followed your methos but got the following error msg:
root cause
java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot@7dcf98 not expected type. Expected: UIOutput. Perhaps you're missing a tag?
     com.sun.faces.taglib.html_basic.OutputTextTag.setProperties(OutputTextTag.java:90)
     javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:712)
     javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:429)
     com.sun.faces.taglib.html_basic.OutputTextTag.doStartTag(OutputTextTag.java:155)
     org.apache.jsp.main_jsp._jspx_meth_h_outputText_0(main_jsp.java:185)
     org.apache.jsp.main_jsp._jspService(main_jsp.java:129)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
     com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
     com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
     com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
     com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
     com.stufftolet.view.util.SecurityFilter.doFilter(SecurityFilter.java:76)
     de.mindmatters.faces.spring.RequestHandledFilter.doFilter(RequestHandledFilter.java:117)
My javascript function is like below:
          <script type="text/javascript">
          <!--
          function init(){
               setTitle("<h:outputText value='#{main_msg.browser_title}'/>");
          // -->
          </script>     
and the declared resource bundle:
<f:loadBundle basename="com.abc.view.bundle.main" var="main_msg"/>
and I got main_en.properties and main_zh.properties.
I call the init() function like:
<body onLoad="init()">          
please help, Thanks !
regards,
kmthien

Similar Messages

  • Dynamic Error Message from a Bundle Showed in a rich:fileUpload

    Hello.
    There is a way to show a dynamic error message from a bundle (i.e, There is a problem in the word {0} in line {1}.) in a rich:fileUpload after the Managed Bean method in fileUploadListener="#{MyManagedBean.myMethod}" attribute was performed? That's because the error message parameters are discovered only after the MyManagedBean.myMethod execution.
    As far I know, I'm able only to show a static message with transferErrorLabel="#{myBundle.myErrorMessage}" attribute.
    Here is my rich:fileUpload component code:
      <rich:fileUpload id="upload"   
         fileUploadListener="#{PlanilhaManagedBean.importar}"  
         maxFilesQuantity="100" 
         immediateUpload="true" listHeight="130" acceptedTypes="xls"  
         addControlLabel="#{bundle.geralProcurarArquivo}" 
         ontyperejected="alert('#{bundle.geralExtensaoInvalida}')"    
         cancelEntryControlLabel="#{bundle.geralCancelar}" 
         clearAllControlLabel="#{bundle.geralLimparTudo}"     
         clearControlLabel="#{bundle.geralLimpar}" 
         doneLabel="#{bundle.geralArquivoTransferidoComSucesso}"  
         progressLabel="#{bundle.geralTransferindoArquivo}" 
         stopControlLabel="#{bundle.geralParar}"  
         stopEntryControlLabel="#{bundle.geralParar}" 
         transferErrorLabel="#{bundle.geralErroNaTransferenciaDoArquivo}" /> Any idea?
    Thanks in advance.

    Hi, BalusC. Thanks for your reply.
    I already tried that. I put a navigation-rule in faces-config.xml to the same page of the rich:fileUpload, but the rich:fileUpload component doesn't starts a get or a post request. So the navigation-rule is ignored and the page wasn't rendered again.
    I also tried to put the <a4j:support ...> in the rich:fileUpload to re-render the <h:messages ...> component, but didn't work too. The <h:messages ...> wasn't re-render.
    Thanks in advance.
    Edited by: reolca on May 10, 2009 5:40 AM

  • How to do search of business partner data, using a message from external sy

    Hi CRM Gems,
    please send the answer to the following question.
    1.How to do search of business partner data, using a message from external system. What FM’s, BAPI etc that can be used for this functionality?
    your answer will be valuble to me.
    Regards,
    Krishna..

    Hi krishna,
      Look at BAPI   BAPI_BUPA_SEARCH.
    Regards.
    Manuel

  • How to display Image as Error instead of Error Message from Resource Bundle

    hi,
    I want to display images as error instead of error message from Application Properties in struts1.1
    Ex:
    I want to prompt a user to type password length min. of 6 char. If failed, need to show simple image as error rather
    "Length should be min. 6".
    reagrds
    parthiban.

    BalusC wrote:
    RahulSharna wrote:
    in the respective resource bundle modify the value by something was below
    error.password.length=<img src="/images/password-Length.gif" alt="Password Length Issue" align="center"/>
    OK, it apparently allows HTML in error messages.Yes struts allows it :)

  • Does iMessage use text message from carrier

    Does imessage count against your text messages from your carrier?

    No...only against your data allowance if sent over 3G.

  • Windows Server 2012 Used: Error Message from Windows 7 PC: Remote session was disconnected because there are no remote desktop license servers available to provide a license. Please contact the server administrator.

    We are using Windows Server 2012 Standard installed in VMWare / Virtual machine and to access this we use vSphere client and Remote Desktop Connection / service was already enabled and was working fine with User PCs / laptops remote desktop into the server
    2012, until it gave an error message of: Remote session was disconnected because there are no remote desktop license servers available to provide a license.  Please contact the server administrator. whilst logging into the server. 
    We DON'T use Active Directory nor and we don't use domain and not looking to use it any-time soon. 
    I checked the RD Licensing Diagnoser and it says the grace period has expired and the licensing mode for the remote desktop session host server is not configured.  I have checked the Remote Desktop Gateway has been stopped and I tried to start it and it
    resumed to stop, here I assume its where the licensing part comes in to re-enabled this. 
    I have been trying to follow these articles online: http://ryanmangansitblog.com/2013/03/27/deploying-remote-desktop-gateway-rds-2012/ and http://www.concurrency.com/blog/rds8-add-a-licensing-server-2/#Install  the overview part that I cannot get into,
    because I think we have to be is AD DS for this which we don't.  Is there a way around this for non domain / just standalone set-up?  Is it a must / requirement we need to be in a domain in order for Remote Desktop Connection to work? 
    Also, we have a Windows Server 2012 RDS CALs - 10 (software and licence key), will the licence key work for the Windows 2012 Server Standard?  We do not want to install the other Server mentioned which comes with CAL / licence key as its time consuming
    to reinstall other programs.  I have installed  Server role service of Remote Desktop Licencing and automatically installed other associated services needed.  in the RD Licencing Manager, the Server had a red cross and I "Activate Server"
    where I followed: http://www.concurrency.com/blog/rds8-add-a-licensing-server-2/#Install in Install Licences section and I have used the licence key of CAL - 10 mentioned above; it stated I have successfully completed the install licences wizard and displayed:
    10 Windows Server 2012 - RDS Per User CAL installed, and in the RD Licensing Manager the server turned into a green tick and added the licence.  
    I then tested the Remote desktop connection from my PC and the same error message was there and checked the RD Licensing Diagnoser and the same error messages was there.  I haven't restart the services of Remote Gateway / the server itself; do I really
    need to reboot server?  
    Any advice / guidance would be very much appreciated and this is a urgent matter.  
    Thank you for your time.

    Hotfix Released here:
    http://support.microsoft.com/kb/2916846

  • Use descriptive message from Exception

    This piece of code
    if (AliasesDB.validateAddress(personInfo, add).equals("invalid.format")) {
        log.info(LogHead.getLogInfo(request, personInfo) + add + "Add alias failed - invalid format.");
        actionErrors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage("error.webapp.format"));
        saveErrors(request, actionErrors);
        return (mapping.findForward(INVALIDALIAS));
    }calls AliasesDB.validateAddress() - a method that validates an email address and returns a descriptive String such as 'SUCCESS' or a descriptive error message such as 'invalid.format' depending on the results of the validation of the email string.
    I think that this may be a clunky design, due to my incomplete understanding of how Java exceptions work. I have available to me another method that I could use to validate an email string.
    public static boolean isNameInUse(String name, Connection c,  Ldap dir) throws  IOException, SQLException, NamingException
         PreparedStatement nameQ = c.prepareStatement("SELECT username FROM creservednames WHERE username=?");
         nameQ.setString(1,name);
         ResultSet rs = nameQ.executeQuery();
         if(rs.next() == true)
              rs.close();
              nameQ.close();
              return true;
         rs.close();
         nameQ.close();
         // search LDAP with base dc=company,dc=com
         // this includes current accounts in ou=people
         // and reserved identifiers in ou=reserve
         DirContext dc = dir.getContext();
         SearchControls sc = new SearchControls();
         sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
         sc.setReturningAttributes(new String[] {"uid"});
         javax.naming.NamingEnumeration ne = dc.search("dc=company,dc=com","(|(uid="+name+")(altnName="+name+")(mailLocalAddress="+name+"@company.com))",sc);
         if(ne.hasMore()){
              return true;
         return false;
    }My requirements are that I need to be able to do something based on the results of a validation operation that could have several different outcomes. I took a look at the javadoc for NamingException - is it possible to rewrite my code so that a custom string is returned when NamingException is thrown?

    Thank you!
    I was going to ask ...
    the problem with the isNameInUse() method is it is boolean, but I'd like to allow for multiple error conditions so that I can redirect with an error message based on several types of error conditions. I was wondering if there was a way to use the NamingException class to generate multiple types of error message depending on the error condition.

  • NI Ethernet/IP as adaptor using explicit messaging from ControlLogix PLC

    I am successfully using a ControlLogix PLC with an implicit i/o connection to a NI9792 WSN Gateway. This I/O connection only communicates control and status of the program on the 9792, however there is a bunch of data (500 bytes) that is collected every few hours that I would like to get from the 9792 with an explicit message using a couple of assemblies. How do I need to set up the MSG instruction in Logix to get this data from the 9792? According to references it should be Service 0x0e, Class 0x04, Instance n, Attribute 0x03 but this gives me an error on the PLC MSG instruction. I have tried a variety of things to get this working but have had no luck, the implicit I/O connection works fine, but the explicit connection return an error code of 0x0005 'Class or instance not supported'. I have tried a couple different assemblies and get the same result. I can however change the MSG instruction to get the identity of the NI driver (Service 0x01, Class 0x01, Instance 1, Attribute 0x00) and this works fine so I know the MSG function is working with the correct path and destination element.
    In the first attachment, the bottom while loop contains the assembly I'm trying to access via the explicit MSG, the top loop is the implicit I/O connection which works fine.
    The second attachment is my ControlLogix MSG instruction configuration with the error shown.
    Thanks,
    Dave
    David Gaylord
    Controls Engineer
    Alcoa Howmet Research Center
    Attachments:
    screenshot.1.jpg ‏323 KB
    screenshot.3.jpg ‏95 KB

    Sorry about that, I think I had too many things going on here at the same time.  I agree that the Create Assembly Instances is working as an adaptor.  Perhaps my terminology is incorrect by calling the other a scanner, it was my impression that by giving it a IP address to communicate with that it was a scanner, as it was making the request for data or setting the data in a remote device.  Either way, I would prefer to keep the system as a simple adaptor so the setup of these systems is easier on our customers.
    I do see one VI in the example that i forgot about, the Remove Assembly Instance, I'll add that to my vi and see what happens, though I doubt that will cure my problem.  I've seen on the forums that there is a limit to the amount of about 500 bytes per assembly but is there maybe a limit to the amount of assemblies or total bytes used by the EIP toolkit? 
    David Gaylord
    Controls Engineer
    Alcoa Howmet Research Center

  • Using Mail files from OSX10.4 with Mail on a OSX10.3 Mac

    Disk died on my OSX 10.4 Mac but I have everything on backup. The Mail program on my other Mac is running under OSX 10.3 (it's a G3 Mac). I can put the mailboxes etc into the library/mail/ directory but the files do not open with the older Mail application. Is there a way to "bring out" the mail messages from the bundled format of 10.4 so that I can access my mail records until I get a new drive on the 10.4 Mac?

    The mailbox format used by Mail changed drastically in Mac OS X 10.4 (Tiger). Mail 2.x knows about the old format and can import or convert in place mailboxes created by Mail 1.x, but Mail 1.x obviously knows nothing about the new format used by Mail 2.x. Actually, the conversion from Mail 1.x to Mail 2.x mailboxes is broken and Mail 2.x sometimes can only import Mail 1.x mailboxes as Other, but that’s another story...
    Mail’s mailboxes are located in ~/Library/Mail/. Although .mbox packages appear to be files in Mac OS X 10.3, they’re actually folders just like in Mac OS X 10.4. Ctrl-click on an .mbox package and choose Show Package Contents from the contextual menu to see the files it contains.
    For each mailbox, Mail 1.x stores all the messages in a single file in standard mbox format (the mbox file within the .mbox folder/package), whereas Mail 2.x stores messages in individual .emlx files within a Messages folder that Mail 1.x knows nothing about.
    You’d need something like emlx to mbox Converter or Emailchemy to convert the .emlx files to standard mbox format in order to be able to import them (as Other / Standard mbox) in Mail 1.x.
    Note: For those not familiarized with the ~/ notation, it refers to the user’s home folder. That is, ~/Library is the Library folder within the user’s home folder, i.e. /Users/username/Library.

  • I am having some trouble with receiving messages from iMessage users when I don't have my iMessage turned on. When I called for support, I spent 30 min waiting and the woman's response to me was "Turn on your iMessage." I prefer not to use it

    I have an iPhone 5s and a MacBook Pro. Ever since I updated my computer software to Yosemite, it linked my Apple ID with my phone number and I am not receiving messages from iMessage users on my phone, but rather to my computer. I don't like to use iMessage so I keep it off and would like to receive all messages as SMS texts. I have already tried changing my Apple ID password, logging off of my Apple ID in iMessage on my phone and turning it off, and changing settings on messages on my computer. Nothing is working. Either the messages continue to go to my computer or the messages trying to be sent say they cannot be sent.
    After spending 30 + minutes waiting for technical support, the woman helping me (who did not give me her name) told me I should just turn on iMessage. After explaining that I don't like having iMessage on and asking why it worked for at least a year up until this point she said "things change and sometimes we don't know why things do what they do". She asked me about various other things on my phone such as bluetooth and told me to turn on and off airplane mode and the call disconnected. I have not been contacted since, even though she has my phone number.
    I am hoping for some help and also hoping people don't get the type of service I received tonight.

    I think you can solve your problems by removing your AppleID email address from BOTH the Messages setting on your iPhone and the iMessages settings on your Mac.
    On iPhone:
    Settings > Messages > iMessage > Dissabled
    Settings > Messages > Send & Receive > touch the "(i)" < touch "Remove This Email"
    On Mac:
    Open "Messages" application
    Click "Messages menu > Preferences
    Click "Accounts"
    Select your AppleID account
    Under the "You can be reached for messages at" settings, uncheck your AppleID email address and your phone number
    Then uncheck the "Enable this account" setting
    And lastly, ask all of your friends with iPhones to delete all iMessage conversations (blue bubbles) in their entirety.
    To test, send a friend a new text using their phone number (not their email address) and watch the color of the bubble.  If it's green then you are using SMS.

  • When I use the shortcut to open a new window in safari (command N), I get a 404 error message from Google. How do I change where 'Command N' routes to?

    When I use the shortcut to open a new window in safari (command N) on my Macbook Pro, I get a 404 error message from Google. How do I change where 'Command N' routes to? 

    It's not necessary to change the Command N keystroke..
    From your Safari menu bar click Safari > Preferences then select the Privacy tab.
    Click:   Remove All Website Data
    Then delete the cache.
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.
    If that didn't help, troubleshoot Safari extensions.
    From the Safari menu bar click Safari > Preferences then select the Extensions tab. Turn that OFF, quit and relaunch Safari to test.
    If that helped, turn one extension on then quit and relaunch Safari to test until you find the incompatible extension then click uninstall.

  • TS2755 Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help of how to set up messages on each

    Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help on how to set up messages on each device separately and to start using messages app on each device independently. Thanks

    search google for "iphone remove picture from contact"

  • While my friend was setting up his iphone, i used my icloud. So now, when i send him a message i get the exact same message from myself. How do i fix this?

    While my friend was setting up his iphone because i had recently updated it for him he needed a itunes account to use for "bump" so i could transfer his contacts back. So i used my itunes and icloud account to sign in so he could download that because he didnt have any of those accounts. So when i logged in he was basically me, my name was his phones name aswell. Well i used "bump" his name was the same as mine. I got the contacts to work but now every time i send him a text message, (imessage) i get the exact same message from myself. How to i unverify him off of my icloud so i can be the only one using it?

    The fact that the problem only occurs when iphones are texting you leads me to think that iMessage may be the culprit. The fact that it is only iphones using SPRINT however is weird. Try turning imessage off on both yours and your sons phones to see if the problem persists. If it does, it may be a carrier problem.

  • I have an iPhone 4S and my friend has two ipods with two Apple ID's.  Why can't he receive messages on "Message" on one and he uses a free text app on the other which receives messages from my phone just fine.

    My friend has two ipods.  Two Apple ID's and on one ipod he has a free text app on it and only Message on the other.  He cannot receive a message from my iphone 4S on the one with Message, but receives it fine on the one with the free text app.
    He can also receive a message from my iPad on the one with Message.
    My question is how can he recieve a text from my iPhone to the ipod which has a different Apple ID than the other but does not have a free text app?
    Also on the ipod he has the free text app he has not upgraded to ios7 and won't.

    Are the use the correct email address for the contact? Those are listed in Settings>Messages>Send and Receive. When Messaging somene the iOS devices used the email address (or phone number if applicable) listed in the Contact app for that person.
    Thus, it appears the you Contact apps only has that one email address listed for the person you are trying to Message.
    If he can send you a Messages can you reply to it? If so save the sender to your Contact app.

  • Use VZ Messages+ to get text from one phone on another??

    Here is my situation. I have 2 phones, an IPhone 5c from work and a Casio Commando 4g. I only want to carry one of them and would prefer it to be the Commando. I am trying to use VZ Messages to get my work texts on the Commando. No matter how many times I  clear the setting, uninstall, reinstall the app, etc whenever I start the app on my android phone, it just says "Starting Service" and then displays the texts from that account. When I install the app on my android tablet or even on the IPhone, it 1st asks what number I want to link the app to, I receive a text on that phone with the pin and everything works fine.. So in other words, I have been able to install the Messages app on my IPhone, link it to my android phone, and get the android phone texts on the IPhone with no problem. What I need to be able to do now is install the app on my android phone, link it to the IPhone and and receive texts sent to the IPhone num,ber on my Android phone. Any help would be appreciated.

        Hi tgoggin - We certainly want technology to work to make life convenient! I can confirm at this time anytime you have VZMessages on an actual phone line with Android it will register to that lines number. I apologize as we are unable to adjust this setting.
    Thank you,
    YaleK_VZW
    Follow us on Twitter @VZWsupport

Maybe you are looking for