T
tomjbr.41840400
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 ?
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 ?