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