I am not sure whats good for you because I usually put the logic for same
"page" in the same Action. So for your case I would just write one Action.
However I do understand the need of separating modification logic from pure
display data logic.
In your case you could at one param in redirectAction for each parameter you
have so your Institution will get populated, but of course these parameters
will be transferred via Get parameters and shown on the browser URL.
or you could put them in session and take the values out when you get to
Institution.

These are the 2 ways i can think of write now.
dont know if anyone else can suggest better way of doing these

On Wed, Jun 1, 2011 at 12:34 AM, Sachin Lale <lalesach...@gmail.com> wrote:

> So in the given below scenario what is the best approach so that the form
> values on UI get populated with hidden values/parameters?
>
>
> On 31-05-2011 08:07, Steven Yang wrote:
>
>> chaining is not recommended.
>>
>> basically as you have observed, chaining is a server-side redirect.
>> you go to another page without changing client's browser url.
>> i have not seen a formal argument of the bad of it (or i forgot)
>> but what i have observed is that the user may hit Reload on browser and
>> get
>> unexpected behavior for both the user and developer
>>
>> On Tue, May 31, 2011 at 5:13 AM, Sachin Lale<lalesach...@gmail.com>
>>  wrote:
>>
>>  Hi,
>>> I am migrating an application from struts1.1 to struts 2.2.3.  I have two
>>> action
>>>
>>>  1. InstitutuionAction : The purpose is to prepare the data required
>>>     to display and then forward to a Institution.JSP (using tiles)
>>>  2. InstitutionAddEditAction: This action exposed two methods insert,
>>>     update and validate.
>>>
>>> The insert and validate method of InstitutionAddEditAction class looks
>>> like
>>> below
>>>
>>> public String insert() throws Exception
>>>    {
>>>        log.info("In
>>> InstitutionStrutsAddEditAction"+institution.getName());
>>>        return Action.SUCCESS;
>>>    }
>>>
>>> public void validate()
>>>    {
>>>        if(institution.getName().equals("abc"))
>>>            addActionError("<font color=\"red\">  Invalid Name .</font>");
>>>    }
>>>
>>> struts.xml
>>>
>>> <action name="Institution" method="execute"
>>> class="edu.wustl.clinportal.action.struts2.InstitutionStruts2Action">
>>> <result name="success" type="tiles">.clinportal.institutionDef</result>
>>> <result name="failure" type="tiles">.clinportal.institutionDef</result>
>>> <result name="access_denied">/ManageAdministrativeData.do</result>
>>> </action>
>>> <action name="InstitutionAddEdit_*" method="{1}"
>>>
>>> class="edu.wustl.clinportal.action.struts2.InstitutionStrutsAddEditAction">
>>> <result name="input" type="redirectAction">
>>> <param name="actionName">Institution</param>
>>> <param name="operation">add</param>
>>> <param name="pageOf">pageOfInstitution</param>
>>> <param name="menuSelected">2</param>
>>> </result>
>>> <result name="success" type="redirectAction">
>>> <param name="actionName">Institution</param>
>>> </result>
>>> </action>
>>>
>>> After a validation error it is getting redirect to Institution.action but
>>> not re-populating the data entered by the users obvious reason as the
>>> request is redirected and not forward. Everything works fine if i replace
>>> the result type to chain and could populate the Institution name (this
>>> object is in InstitutionAddEditAction class).
>>>
>>> I added a Institution object in InstitutuionAction  class. I tried the
>>> same
>>> scenarion using chain this time. Its worked as well. Is ChainInterceptor
>>> populating this object?
>>>
>>> But is using chain a recommended approach. What is harm in using chain.?
>>>
>>> Best regards,
>>> Sachin
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

Reply via email to