Bean:message tag

hi
sup i wanna use bean:message tag for the image file which is definrd in properties file
<img align="top" src="/assets/images/common/buttons/bt_bl_continue_v1_en.gif" border="0" style="vertical-align:top; _vertical-align:middle;"></a>
like
<bean:message key="com.something.continue_img">
then how shud i provide the formatting to it like style etc

All you need do is put the <bean:message> tag as the src attribute.
In the message bundle the message is the file name to load.
<img align="top" src="<bean:message key="com.something.continue_img">
" border="0" style="vertical-align:top; _vertical-align:middle;"></a>

Similar Messages

  • bean:message/ tag is not working in tiles:insertAttribute/

    I have a bean:message tag inside my tiles:insertAttribute as shown below.
    <tiles:insertAttribute name='<bean:message="user.menu"/>'/>But <bean:message/> is not getting the value from resource bundle, my resource bundle is in correct place. If i hard code the value then it s working fine.
    How to make it work? Any help?

    sunish_jose wrote:
    <tiles:insertAttribute><bean:message="user.menu"/></tiles:insertAttribute>this way it s not working. Could you pls tell how solve it by using EL. I was not able to find a similar sample evenafter searching for some time.
    thanks in advance.I did say that I don't know if it will or not, I was just giving a sample of how it would work if the tag allowed the value for 'name' to be put in the body.
    I'm not very familiar with the Struts bean tags and in any case, I believe you should use the JSTL tags where ever possible. So you'd pick the <fmt:message> tag from there. I don't think the <bean:message> tag allows you to get the value in to a variable.
    <fmt:message var="tilesAttributeNameValue" key="user.menu" />
    //create an EL variable named tilesAttributeNameValue with the value from the resource bundle
    <tiles:insertAttribute name="${tilesAttributeNameValue}"></tiles:insertAttribute>
    //use EL to put the valueTake a look here [1] for a JSTL introduction:
    [1] http://www.ibm.com/developerworks/java/library/j-jstl0415/

  • Using EL variable in struts bean:message tag(not struts EL tag)

    Is there any work around to use an EL variable inside struts bean:message tag as key:
    I have like this:
    <bean:message key="${bean.keyName}"/>
    which is throwing error , I know this can be resolved by using struts-el tags but i cannot use them for specific reasons.
    I dont want to use bean:define tag to define my 'bean' and then use like this:
    <bean:message key="<%=bean.getKeyName%>"/> (this actually works, but i want to use EL variable)
    Is there any work around to use EL variable and make the message display on the jsp.
    i tried multiple ways like scriplets and jsp:useBean but nothing worked, Please let me know..
    Thanks in advance

    Im pretty sure that EL does not work in the normal struts tag unless its struts-el tag.Have you tried it?
    As I said, in a properly configured JSP2.0 container you can use EL expressions anywhere you could traditionally use a standard runtime expression <%= expr %>.
    What server are you using? What JSP version?
    The Struts-el tags were written so that you could use EL with struts in JSP1.2 containers.
    The c_rt tags were written so you could use runtime expressions with JSTL tags in JSP1.2 containers. Their use was discouraged even then. Now I consider their use absolutely unnecessary.
    Please read this thread: http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0
    Cheers,
    evnafets

  • Error on bean:message and resource properties file ??

    Hi everyone! I'm new to struts and i just can't figure out why tomcat's giving me an error. I've manage to run a simple example but when i use the bean:message tag i get this error
    ERROR IS:
    java.lang.NullPointerException
         org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1175)
         org.apache.struts.taglib.TagUtils.message(TagUtils.java:1038)
         org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:224)
         org.apache.jsp.index_jsp._jspx_meth_bean_message_0(org.apache.jsp.index_jsp:135)
         org.apache.jsp.index_jsp._jspx_meth_html_html_0(org.apache.jsp.index_jsp:101)
         org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:69)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Can anyone help me with this problem?
    my ApplicationResources.propeties file is in WEB-INF/classes
    index.jsp
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <html:html locale="true">
    <head>
        <title> <bean:message key="index.title"/> </title>
    </head>
    <body>
    <html:link module="/exercise" action="/welcome">Taglib Test Pages</html:link>
    </body>
    </html:html>
    web.xml
    <?xml version="1.0" encoding="iso-8859-1"?>
    <!DOCTYPE web-app
      PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
      "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
      <!-- Action Servlet Configuration -->
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <!-- Resources bundle base class -->
        <init-param>
          <param-name>application</param-name>
          <param-value>ApplicationResources</param-value>
        </init-param>
          <!-- Context-relative path to the XML resource containing Struts configuration information -->
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <!-- The debugging detail level for this servlet, which controls how much information is logged. -->
        <init-param>
         <param-name>debug</param-name>
         <param-value>2</param-value>
        </init-param>
        <init-param>
         <param-name>detail</param-name>
         <param-value>2</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <!-- Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
    <!-- The Welcome File List -->
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
      <!-- Struts Tag Library Descriptors -->
      <taglib>
        <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>
      <taglib>
        <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib>
      <!-- Application Tag Library Descriptor -->
      <taglib>
        <taglib-uri>/WEB-INF/app.tld</taglib-uri>
        <taglib-location>/WEB-INF/app.tld</taglib-location>
      </taglib>
    </web-app>Please help..thanks in advance

    I have that on my struts-config.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
    <struts-config>
      <form-beans>
    </form-beans>
      <global-forwards>
      </global-forwards>
      <action-mappings>
      </action-mappings>
      <message-resources parameter="ApplicationResources"/>
    </struts-config>and I also include it on my web.xml file
    <!-- Resources bundle base class -->
        <init-param>
          <param-name>application</param-name>
          <param-value>ApplicationResources</param-value>
        </init-param>

  • Using a heirachical key name in bean:message

    This is sort of an odd requirement but it will help me out greatly if I can find a way to do this.
    I am working on creating a JSP which generates vxml. I am using a resource properties file to read in text that I need to speak, or the names of wave files that I need to play. I grab these using a bean:message tag lib call. This all works fine but now I need to extend this app to handle several different States (Kentucky, Ohio, etc) which may or may not have small variations in their verbiage.
    Tell me if I am going about this entirely wrong but this is what I think would be nice to do:
    I would like to use the name of the key in this form:
    "prompt.company.state"
    Where an example resource properties file might be like this:
    mainmenu.columbia.ky=mainmenu_ky.wav
    mainmenu.columbia=MM_Columbia.wav
    mainmenu=mainmenu.wavWhat I would like to happen is if I request the key "mainmenu.columbia.ky" it returns the "mainmenu_ky.wav", but if I request "mainmenu.columbia.oh" it would return "MM_Columbia.wav"
    The idea is that a company may operate in different states and customize its prompts for that state if custom prompts exist but if they do not exist it uses the default for that company. Also there could be different company names also so if I asked for "mainmenu.northface" I would receive "mainmenu.wav"
    This is sort of like localization but I want to have all the keys in one file.
    My thought is that I would need to create my own taglib that extends bean:message and then parses the key name accordingly until I find a matching key. My problem is I have no idea where to start when doing that. I am while I have a strong Java background its been almost 4 years since I've worked on a project using it, and all this Struts and JSP and JSTL stuff is quite new to me.
    Does anyone have any tips for me? Maybe there is another tag lib out there which does exactly what I need and I just don't see it. Help anyone?

    This is sort of an odd requirement but it will help me out greatly if I can find a way to do this.
    I am working on creating a JSP which generates vxml. I am using a resource properties file to read in text that I need to speak, or the names of wave files that I need to play. I grab these using a bean:message tag lib call. This all works fine but now I need to extend this app to handle several different States (Kentucky, Ohio, etc) which may or may not have small variations in their verbiage.
    Tell me if I am going about this entirely wrong but this is what I think would be nice to do:
    I would like to use the name of the key in this form:
    "prompt.company.state"
    Where an example resource properties file might be like this:
    mainmenu.columbia.ky=mainmenu_ky.wav
    mainmenu.columbia=MM_Columbia.wav
    mainmenu=mainmenu.wavWhat I would like to happen is if I request the key "mainmenu.columbia.ky" it returns the "mainmenu_ky.wav", but if I request "mainmenu.columbia.oh" it would return "MM_Columbia.wav"
    The idea is that a company may operate in different states and customize its prompts for that state if custom prompts exist but if they do not exist it uses the default for that company. Also there could be different company names also so if I asked for "mainmenu.northface" I would receive "mainmenu.wav"
    This is sort of like localization but I want to have all the keys in one file.
    My thought is that I would need to create my own taglib that extends bean:message and then parses the key name accordingly until I find a matching key. My problem is I have no idea where to start when doing that. I am while I have a strong Java background its been almost 4 years since I've worked on a project using it, and all this Struts and JSP and JSTL stuff is quite new to me.
    Does anyone have any tips for me? Maybe there is another tag lib out there which does exactly what I need and I just don't see it. Help anyone?

  • Dynamic key in bean:message

    hi,
    i would like to use a <bean:message> in my page but with a dynamic key:
    <logic:iterate id="vSendMode" name="SvGetCommandRavelForm" property="recSendModeList">
    <bean:message key="sendMode.agence${vSendMode.idSmod} .modeead${vSendMode.idAgency}" />
    </logic:iterate>
    only it tells me that the key sendMode.agence${vSendMode.idSmod} .modeead${vSendMode.idAgency} doesn't exist. which is true but for example sendMode.agence0 .modeead0 exists...
    how can i do that ?
    thanks :-)

    Yes you can use runtime expressions with the bean:message tag.
    However your container has to recognise the ${expr} as a runtime expression.
    1 - You need a JSP2.0 container (eg Tomcat 5)
    2 - your web.xml file needs to declare itself as version 2.4
    ie:<?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
        version="2.4">
    ...If you just put ${vSendMod.idSmod} on the page does it print the appropriate value?
    If EL is working, then try this:
    <c:set var="myKey" value="sendMode.agence${vSendMode.idSmod} .modeead${vSendMode.idAgency}" />
    <bean:message key="${myKey}"/>
    If you only have a JSP1.2 container, take a look at the struts-el taglib, or use a <%= expr %> instead of EL.
    Cheers,
    evnafets

  • Struts tag bean:message in jsp

    Hi
    I used
    <bean:message key="inputform.username" property="username"/>
    in my jsp page to access value using this key from resource bundle.
    While requesting the page the error is showing that----
    javax.servlet.ServletException: Missing message for key "inputform.username"
    Please help me in this problem
    Thanks in advance
    Sudheesh

    I've tried with <bean:write... but since I catch exception saying MyActionForm can't be found in any scope. As far as I'm aware I've set request scope like:
    <action input="/jsp/something.jsp" name="MyActionForm" path="/jsp/myAction" scope="request" type="sth.MyAction">
    <forward name="success" path="/jsp/index.jsp"/>
    <forward name="failure" path="/jsp/something.jsp"/>
    </action>
    Edited by: D.A.R. on Sep 26, 2007 12:09 PM

  • Global Messages with h:messages tag.

    hi,according to the documentation of jsf1.1, global messages are those messages that are not associated with any client identifier, which means, messages that are not associated with any UIComponent. At the mean while, the [b]for attribute is mandatory for the h:message tag. so it means that global messages are not specified by the JSF page programmers. so how are these message produced? and what are they used for?
    Best Regards

    For example if you are using backing bean and there is error you want to show globally, without showing for any particular field then you can have something like this in backing bean
    catch (Exception e1) {
                        facesContext.addMessage(
                             null,
                             new FacesMessage(
                                  FacesMessage.SEVERITY_INFO,
                                  "Unable to Add User." + e1,
                        return "AddUser";
    And to show this message, you have have something like this in your page.
    <h:panelGrid width="100%" columns="1" border="0">
                        <h:messages layout="table" styleClass="errorMsg" id="allMsg"
                             showDetail="false"></h:messages>
                   </h:panelGrid>

  • h:messages tag display order

    From my observations, it seems that messages displayed by the messages tag show up with the messages created first at the end of the list (or table). On the surface, this makes sense --new messages are thrown on the pile, so to speak.  But this is the complete reverse order from how the fields show up on the form. Fields at the top of the form, which are validated first, show up on the bottom of the list. Fields at the bottom of the form, show up first. Not very intuitive for the user.
    Here are the options as I see them:
    1) write a custom component extending the messages component with the desired sorting behavior
    2) abandon the messages component, and code a panelGrid of message components for every field on the form (in the desired order).
    3) find a third party component... this seems basic enough so maybe this is already part of myFaces or ADF. So far, I've been getting by with the components included in the RI. Will something this trivial force me to switch?
    What are the approaches that I've missed?

    Here is an easy solution without having to create a custom component. I have a superclass bean for all of my backing beans with common functionality. In the validate() of my superclass bean I check for any messages to determine navigation and also capture all messages into a list if there are any.
         protected String validate() {
             String result = "success";
             FacesContext context = FacesContext.getCurrentInstance();
                        if(context.getMessages().hasNext()){
                 Iterator i = context.getMessages();
                 while(i.hasNext()){
              FacesMessage message = (FacesMessage)i.next();
              errorMessages.add(message.getDetail());
                 result = null;
             return result;
         }On the jsp I use JSTL to list the messages.
    <span style="width:100%">
         <h:outputText value="#{appBundle.ERR_HEADER}<br/>" escape="false" rendered="#{SelectAccountBean.messages == true}" styleClass="title"/>     
         <c:forEach items="${SelectAccountBean.errorMessages}" var="msg">
              <c:out value="<span class='message'>${msg}</span>" escapeXml="false"/>
         </c:forEach>
         <h:outputText value="<br/>" escape="false" rendered="#{SelectAccountBean.messages == true}"/>          
            </span>Edited by: minicpt on Jul 31, 2008 2:05 PM

  • Displaying messages without h:message or h:messages tag

    How can you display messages without h:message or h:messages tag. Is it possible to disply messages in another component. I have only a small piece of page reserved for displaying errors and it would be nice to show these errors in component with scrollbar.
    Regards, Simy

    Well you can access messages produced using
    getMessages() method of faces context. Store these messages in some attribute of backing bean and attach this attribute to some component in your jsf page.
    You can use the following conditions to determine the presence of any messages using:
    rendered="#{! empty facesContext.maximumSeverity}"

  • Storing bean:message value

    I want to be able to utilize a request.getParameter value to make the key attribute for the bean:message to be dynamic. I have parts of my application urls in the ApplicationProperties.properties and I want a parameter to dynamically tell bean:message which key to use. Then once bean:message pulls back that data, I want to store it into a field to use in an jsp:include. Can this be done?
    I pretty much would like to do the following if it was legal syntax:
    <jsp:include flush="true" page="bean:message key="<%= request.getParameter(pageType) %>""/>

    It is possible if u use JSTL-RT tag not the JSTL-EL tag. Please check
    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html
    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL5.html#65106
    Hope u got it.
    Hafizur Rahman
    SCJP

  • Problem displying user errors in message tag

    Hello !
    I have problem displaying errors in my JSF page. I'm using Oracle JDeveloper 10.1.3.4. Application is JSF + ADF
    I have one button in my JSF page, and I doing some checks when user clicks on the button. When something is not ok, I throwing an JboException from my Application module. The problem is that I get an error stack trace in my browser instead error message in the message tag. How can I catch those JboException messages with message tag on my JSF page ?
    Thanks,
    Miljan

    Hello John !
    In my faces-config file I defined backing bean, and from my .jspx page I calling a method of backing bean, and inside that method I calling client method from App Module.
    Faces-config:
    <managed-bean>
    <managed-bean-name>backingBean</managed-bean-name>
    <managed-bean-class>com.uss.cs.backing.BackingBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <managed-property>
    <property-name>bindingContainer</property-name>
    <value>#{data.indexPageDef}</value>
    </managed-property>
    </managed-bean>
    BackinBean:
    public AppModule getApp(){
    AppModule app = (AppModule)getBindingContainer().getDataControl().getApplicationModule();
    return app;
    public void createStavka(){
    getApp().createStavka();
    AppModuleImpl:
    public void createStavka(){
    //for example:
    if (true) throw new JboException("Morate u stavkama da popunite polje razlog !!!");
    }

  • h:messages tag not rendering right

    Hi All,
    I have an <h:messages /> tag in my jsf page and it's not rendering correctly.
    This is the tag in my page, verbatim:
    <h:messages />
    And this is the output when validation errors are created:
    Validation Error: "lastName": Value is required.      Validation Error: "firstName": Value is required.
    That's it. No List, no nothing, just space-delimited validation errors!
    When I specifiy layout="table", things are fine, but specifying layout="list" doesn't solve the problem.
    I'm using v1.1 of the jsf implementation.
    What gives?
    Thanks,
    John

    I got the exact same problem.. Is this already logged as a bug in JSF?

  • Message Driven bean: message always removed from queue

    We use MDB to dequeue messages from database queue (AQ) and want to handle errors: if the transaction rolls back, message should have retry_count updated and after defined retries should move to exception queue.
    The problem is, that with all combinations of transactions settings, the message is removed from queue before onMessage is called. If I use Container managed transactions with Mandatory transaction attribute, call to setRollbackOnly fails with message "java.lang.IllegalStateException: Cannot call setRollbackOnly() current thread is NOT associated with a transaction."
    How can I write a MDB, which can commit or rollback message depending on whether exception is or is not thrown? I use JDev 10.1.3.
    Thanks,
    Viliam
    Here are my files:
    ejb-jar.xml:
    <?xml version = '1.0' encoding = 'windows-1250'?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
      <enterprise-beans>
        <message-driven>
          <description>Message Driven Bean</description>
          <display-name>SendSMSBean</display-name>
          <ejb-name>SendSMSBean</ejb-name>
          <ejb-class>sk.transacty.cc.ejb.SendSMSBeanBean</ejb-class>
          <transaction-type>Container</transaction-type>
          <acknowledge-mode>Auto-acknowledge</acknowledge-mode>
          <message-driven-destination>
            <destination-type>javax.jms.Queue</destination-type>
          </message-driven-destination>
          <resource-ref>
            <res-ref-name>jdbc/CCDataSource</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
          </resource-ref>
        </message-driven>
      </enterprise-beans>
      <assembly-descriptor>
        <container-transaction>
          <method>
            <ejb-name>SendSMSBean</ejb-name>
            <method-name>*</method-name>
          </method>
          <trans-attribute>Mandatory</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
    </ejb-jar>orion-ejb-jar.xml:
    <?xml version = '1.0' encoding = 'windows-1250'?>
    <!DOCTYPE orion-ejb-jar PUBLIC "-//Evermind//DTD Enterprise JavaBeans 1.1 runtime//EN" "http://xmlns.oracle.com/ias/dtds/orion-ejb-jar.dtd">
    <orion-ejb-jar>
      <enterprise-beans>
        <message-driven-deployment max-instances="1" name="SendSMSBean" connection-factory-location="java:comp/resource/jmsAQ/QueueConnectionFactories/aqQue" destination-location="java:comp/resource/jmsAQ/Queues/msg_queue" listener-threads="1" min-instances="0"/>
      </enterprise-beans>
      <assembly-descriptor>
        <default-method-access>
          <security-role-mapping impliesAll="true" name="<default-ejb-caller-role>"/>
        </default-method-access>
      </assembly-descriptor>
    </orion-ejb-jar>

    As far as I know XMLType JMS messages are not supported when using OJMS. They might be for OC4J 10.1.3, but I thought it's an AQ limitation rather than an OC4J one.. To be sure you might just log a TAR on Metalink.
    hth,
    Bastiaan

  • The "unified messaging" tag under the properties of my exchange server is hidden

    hello all, 
    i have a probleme and hope you will help me to fix it.
    when I tried to go the properties of my exchange server , i do not found the "unified messaging" tag  in the left menu
    what's the probleme? what can i do to resolve it?
    Thanks 

    Hi,
    If I recall correctly that setting was added there in a later build.
    Since you are still on Exchange 2013 RTM (15.0.516.32), it would be a good idea to install Exchange 2013 SP1.
    Microsoft Exchange Server 2013 Service Pack 1 (SP1)
    http://www.microsoft.com/en-us/download/details.aspx?id=41994
    Martina Miskovic

Maybe you are looking for