myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Yee <richard.k....@gmail.com>
Subject Re: EL expression not evaluated in myfaces/Trinidad 1.2 archetype application on Tomcat 6
Date Thu, 03 Mar 2011 14:43:18 GMT
Scott, the archetype generates a simple two page application. The
first page has a inputText where the use is prompted to enter their
name and press a submit button. However, instead of being blank, it
shows so #{helloWorldBacking.name}

This is the source of the index.jspx page:
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:tr="http://myfaces.apache.org/trinidad" >
  <jsp:directive.page contentType="text/html;charset=utf-8"/>
  <f:view>
    <tr:document title="Apache MyFaces Trinidad Archetype Demo">
       <tr:form>

        <tr:panelPage>
          <tr:inputText label="Your name" id="input1"
value="#{helloWorldBacking.name}" required="true"/>
          <tr:commandButton id="button1" text="press me"
action="#{helloWorldBacking.send}" />
        </tr:panelPage>

       </tr:form>
    </tr:document>
  </f:view>
</jsp:root>

This is the backing bean
public class HelloWorldBacking
{

  //properties
  private String _name = "";

  /**
   * default empty constructor
   */
  public HelloWorldBacking()
  {
  }

  //-------------------getter & setter
  public String getName()
  {
    return _name;
  }

  public void setName(String name)
  {
    this._name = name;
  }

  /**
   * Method that is backed to a submit button of a form.
   */
  public String send()
  {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ExtendedRenderKitService service = (ExtendedRenderKitService)
      Service.getRenderKitService(facesContext, ExtendedRenderKitService.class);
 //   service.addScript(facesContext, "alert('Script added by
ExtendedRenderKitService')");

    //do real logic
    return ("success");
  }
}

The Maven archetype I used has a groupId of
org.apache.myfaces.buildtools  the archetypeArtifactId is
myfaces-archetype-trinidad

I didn't change the the generated sources at all except for commenting
a line in the send() method to prevent a javascript alert from being
displayed.

I'm running this on a Macbook Pro and have tried it using Tomcat
6.0.32 and 7.0.8.

What shows is "#{helloWorldBacking.name}" is the visible value of the
inputText when the first page is displayed.
The second page then displays "Hello #{helloWorldBacking.name}. We
hope you enjoy Apache MyFaces Trinidad"

BTW, this is the first time I've deployed a JSF app on tomcat 6 or 7.
I'm not sure if there is anything extra I need to set up. I"m using
the stock distributions.

Thanks for your help!

Richard


Sent from my iPhone

On Mar 3, 2011, at 5:21 AM, "Scott O'Bryan" <darkarena@gmail.com> wrote:

> An example for one.  ;)
>
> Might be helpful Richard to send us a code fragment or something and
> let us know what doesn't work.  Maybe we can help..
>
> On Mar 3, 2011, at 1:25 AM, Richard Yee <richard.k.yee@gmail.com> wrote:
>
>> I generated a basic application from the maven archetype and deployed it to tomcat
6. Although the Trinidad tags are evaluated, the EL expression in the input text box is not
evaluated. What am I missing?
>>
>> Thanks,
>> Richard
>>
>> Sent from my iPhone

Mime
View raw message