I am trying to figure out the design of the presentation layer in my
application. Please let me know your suggestions, and standard coding
techniques based on the MVC model -
Here's a typical case I need to design -
1. A form is displayed for the first time the user logs on.
2. After form submit, the data is either saved to the database or in case
of data-error, the form is re-displayed with the error message.
a. I would like to know if the following code represents a standard way of
implementing the above case.
b. As you can see, I am not using any screen java class corresponding to
form.java(the ones under the screen directory). So when is a screen class
used? Basically I am trying to figure out the line between an action and a
screen class.
public class FormAction extends VelocityAction
{
public void doView(Rundata data, Context context)
{
//get the request params
.
//on the basis of request params, populate the context for the template
.
setTemplate( data, "form.vm" )
.
//set data in HttpSession
}
public void doSubmit(Rundata data, Context context)
{
//get the request params
.
//get data from HttpSession
.
biz = new Biz( request );
biz.validate();
if ( formDataError )
{
context.put( "Data invalid. Please reenter data" );
this.doView(Rundata data, Context context);
}
biz.saveToDatabase();
}
}
- Re: Design question Akshay Kapur
- Re: Design question Eric Emminger
- Re: Design question m. lin
- Re: Design question Rodney Schneider
- Re: Design question Rodney Schneider
- Re: Design question Akshay Kapur
- Re: Design question Rodney Schneider
- Re: Design question Akshay Kapur
- Re: Design question Rodney Schneider
