Hi,
Hopefully this will answer some of your questions.
regards,
David
On May 31, 6:38 pm, LoneWolf <[EMAIL PROTECTED]> wrote:
> Hi.
> I have been reading Forms page of RIFE Wiki and a couple of questions
> poped up :
> 1- "To generate a form, you simply have to call the
> generateForm(Template template, Object beanInstance)"
> What does generating a form mean?
> Isn't supposed that forms are in the HTML page ?
In RIFE forms are most often connected to Java classes. For example
if you are creating a blog application, you might have a Java
class that represents an article in the blog; another class might
represent replies to posts and so on. In order to enter an article
into your blog
since this is a web application, it would be processed using a form.
The fields in the Article entry form can be directly mapped to the
underlying article
class and RIFE can do all the work of managing those form elements,
validating the users' input and then filling instances of the class.
In this call you cited above, the form generation refers to the
"template" (a RIFE object that holds a copy of your HTML form and
other info) and a "bean instance" which is
an instance of the underlying class for the object that the form
represents. In our hypothetical blog, above, the HTML-based Article
form template is presented
to the user who fills it in; RIFE manages the process and, provided
the user fills in the form correctly, will return a filled in Article
bean.
> 2-
> bean.addConstraint(
> new ConstrainedProperty("colors").inList(new String[] {"black",
> "red", "blue"}));
> What is this bean object ? instance of what ? what is its role ?
This is the bean that is being checked as part of a some process (most
often while the user is entering data into a form). If we stick to
our Blog app example, "bean" in this case could be an "Article"
object. In this case this object's "colors" member variable is being
checked to ensure it's
either "black," "red," or "blue." RIFE has a really nice system
where you can declare your data types (beans) and then declare
constraints that the member
variables must meet and then through a process called "metadata
merging" a behind the scenes merged class is created that binds the
two together and RIFEs
Element and Validation classes do the rest in terms of display,
incremental validation, etc. (http://rifers.org/wiki/display/RIFE/Meta
+data+merging)
> 3- How can perform forwards and redirects in RIFE ?
There are several ways: 1) you can redirect from one page to another
using RIFE's "exits" which in essence means telling
RIFE to jump to another page inside of a RIFE application using that
target page's Element ID (which is set up inside the site wiring XML
file);
2) you can use explicit redirects in the site wiring file (http://
rifers.org/wiki/display/RIFE/Redirect) which can take the user to some
other site, or to
another element ID in the same application. 3) you can use the forward
method to redirect either internally or externally
(http://rifers.org/wiki/display/RIFE/Deferment+and+forwarding+to
+elements)
> 4- RIFE offers methods like getParameterInt() and for other types.
> Would be better to offer something like what WebWork do ?
> In WebWork, you write :
> <ww:textfield name="user.name" />
> And the framework will create instance of User class automatically,
> and with the support
> of type converters, developer's life is so enjoyable.
Unfortunately, I can't answer this question as I am not very well
versed in WebWork
> 5- What is FormBuilder ?
> Again, isn't forms supposed to exist in the HTML page ?
I haven't use it in my development but FormBuilder looks to be an API
that can be used to construct web forms programatically
instead of pulling them in as HTML or XML off disk.
Form
> 6- We all know these URLs :
> /catalog/item.do?id=23
> How to generate such URL in RIFE ? Or RIFE is like JSF (post for every
> thing) ?
The generation of the URLs is handled internally by RIFE. The inputs
and outputs can be handled several ways, but the most
common is to declare them in an application-level XML file the
describes how components fit together, then the framework
does all the rest of the work. I'm note sure what you mean by a "post
for everything," in that web applications are stateless,
every interaction with the server involved a post or a get ....
> 7- bean.addConstraint(
> new ConstrainedProperty("login").maxLength(8);
> With the following :
> <!--V 'FORM:INPUT:property'-->size="10"<!--/V-->
> will generate :
> <input type="text" name="login" size="10" maxlength="8" />
> Why not just writing :
> <!--V 'FORM:INPUT:property'-->size="10" maxlength="8"<!--/V-->
In RIFE the presentation is generally separated from the processing,
these are two different processes at work, the first (with the input
field specifying only the field size) is
specifying a presentation-level detail about an item on a HTML form
(input box, 10 chars wide); the second (the constraint definition) is
telling RIFE's metadata system to
ensure that text entered into that field is no more than 8 characters
long.
> Sorry, I'm a new comer but RIFE looks cool.
> Thanks.
Hope this is helpful; I am sure others will chime in if I am off the
mark on any of my explanations.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"rife-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rife-users?hl=en
-~----------~----~----~----~------~----~------~--~---