You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2014/01/23 12:26:38 UTC

[jira] [Comment Edited] (WW-3993) How to implement simple CRUD application

    [ https://issues.apache.org/jira/browse/WW-3993?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13879845#comment-13879845 ] 

Lukasz Lenart edited comment on WW-3993 at 1/23/14 11:24 AM:
-------------------------------------------------------------

This problem not resolved by paramsPrepareParamsStack.I resolved this problem by using input method instead of prepareInput and InputConfig annotation as below :

{code:java}
    @Override
    public String input() {
    	carModelsAvailable = personService.getCarModels();
    	sports = personService.getSports();
    	countries = personService.getCountries();
    	genders = personService.getGenders();

    	if (person != null && person.getPersonId() != null) {
    		person = personService.getPerson(person.getPersonId());
    	}
    	return INPUT;
    }
    
    @InputConfig(methodName=INPUT)
    public String save() {
    	System.out.println("Save Action");
        if (person.getPersonId() == null) {
            personService.insertPerson(person);
        } else {
            personService.updatePerson(person);
        }
        return SUCCESS;
    }
{code}


was (Author: pjpatel214):
This problem not resolved by paramsPrepareParamsStack.I resolved this problem by using input method instead of prepareInput and InputConfig annotation as below :

	@Override
    public String input() {
    	carModelsAvailable = personService.getCarModels();
    	sports = personService.getSports();
    	countries = personService.getCountries();
    	genders = personService.getGenders();

    	if (person != null && person.getPersonId() != null) {
    		person = personService.getPerson(person.getPersonId());
    	}
    	return INPUT;
    }
    
    @InputConfig(methodName=INPUT)
    public String save() {
    	System.out.println("Save Action");
        if (person.getPersonId() == null) {
            personService.insertPerson(person);
        } else {
            personService.updatePerson(person);
        }
        return SUCCESS;
    }

> How to implement simple CRUD application
> ----------------------------------------
>
>                 Key: WW-3993
>                 URL: https://issues.apache.org/jira/browse/WW-3993
>             Project: Struts 2
>          Issue Type: Sub-task
>          Components: Example Applications
>            Reporter: Lukasz Lenart
>            Priority: Minor
>             Fix For: 2.3.17
>
>         Attachments: crud-with-maven.7z, crud-with-maven.7z
>
>
> Rewrite to Maven based project and with the latest Struts version
> https://cwiki.apache.org/confluence/display/WW/CRUD+Demo+I



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)