I am trying to find the "Best Practice" of doing a simple action
redirect based on user input (pressing Submit button to login and then
sending to the next page). I think I have some fogginess on how this
should be done based on 3.0 and 4.0 documentation being mixed together.
I can see that the "success" attribute is tying this form to execute the
doSubmit() method. I know you can also do this from a .page file. Is
there a way to do it with annotations being that the page name,
Login.html, is directly tied to Login.java?
<html jwcid="@Shell" title="Add New Project">
<body jwcid="@Body">
<h1>Add New Project</h1>
<form jwcid="[EMAIL PROTECTED]" success="listener:doSubmit">
Id<input jwcid="[EMAIL PROTECTED]" value="ognl:project.name" size="40"/>
Password<input jwcid="[EMAIL PROTECTED]" value="ognl:project.name"
size="40"/>
<input type="submit" value="Login"/>
</form>
</body>
</html>
Then the Java code could have many different looks depending on whether
xml configs or annotations are used. Below there is an @InjectPage with
an abstract getter method and then the doSubmit returns that object
which is a IPage and somehow that then directs the user to the
ShowProject.html page which relates or maps directly to the
ShowProject.java file.
public IPage doSubmit()
{
ShowProject showProject = getShowProject();
showProject.setProject(getProject());
return showProject;
}
@InjectPage("ShowProject")
public abstract ShowProject getShowProject();
So my question is, is the above how things should be done or should I be
doing it like the following, and what if the resultant page needs to be
determined at runtime based on database values and user input?
public void doSubmit(IRequestCycle cycle) {
cycle.activate("Home");
}
@InjectPage("Home")
public abstract ShowProject getHome();
Thanks in advance for any assistance,
Aaron Bartell