Requested: Simple JSF example for ASP.NET developers

Discussion in 'Java' started by tomjbr.41840400@bloglines.com, Mar 6, 2007.

  1. Guest

    Is it possible with JSF to define what method that should execute when
    a button is clicked, and then from that method get values from the
    form (without using a request object), and then set values to the
    generated page ?

    For those who understand some basic ASP.NET, the following kind of
    code example is what I would like to see for JSF.


    <html>
    <body>
    <form runat="server">
    Enter your name:
    <asp:TextBox id="txt1" runat="server" />

    <asp:Button OnClick="myMethod" Text="Submit" runat="server" />

    <p><asp:Label id="lbl1" runat="server" /></p>
    </form>
    </body>
    </html>

    <script runat="server">
    Sub myMethod(sender As Object, e As EventArgs)
    lbl1.Text="Your name is " & txt1.Text
    End Sub
    </script>


    Here are the relevant ASP.NET parts I am interested in and would like
    to see for JSF:
    Here we define a method named "myMethod" which will execute when the
    button is clicked.
    <asp:Button OnClick="myMethod" ... />
    And here is the implementation of the VB.NET method:
    (the name of the method could be chosen, for example "myMethod" while
    the parameters are prefined by ASP.NET)
    Sub myMethod(sender As Object, e As EventArgs)
    ' here we do a "get" and a "set":
    ' "lbl1.Text=..." is a "set" and the "txt1.Text" is a "get"
    lbl1.Text="Your name is " & txt1.Text '
    End Sub

    How do you do this in JSF ?
     
    , Mar 6, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dudu
    Replies:
    0
    Views:
    389
  2. Sebastian Fey

    JSF debugging / JSF newsgroup

    Sebastian Fey, Apr 7, 2006, in forum: Java
    Replies:
    1
    Views:
    7,645
    Danno
    Apr 7, 2006
  3. Replies:
    3
    Views:
    7,722
  4. laura8610
    Replies:
    0
    Views:
    581
    laura8610
    Sep 30, 2009
  5. luser- -droog
    Replies:
    3
    Views:
    166
    luser- -droog
    Jul 31, 2013
Loading...

Share This Page