You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "VEDRE, RANAPRATAP REDDY" <VE...@engr.sc.edu> on 2002/10/25 03:59:12 UTC

Validation Framework Question..

 I use html links that point to an action in my jsps, so that i can do some
initialization before displaying a jsp.
 for example:
 <html:link href="department.do">New Department</html:link>

  clicking on link "department.do" takes the control to the action
class(DepartmentAction) which forwards to department.jsp

  I use validation framework to validate my form(DepartmentForm).

   as i have a ".do" link, validation fails due to validator framework,
since the newly created form is empty and as a result   my input which is
department.jsp is displayed with validation errors even for the first time
its displayed.
 
 i use the same action(DepartmentAction)  for creating,editing too. i want
to "bypass" the validation framework when the action is executed by clicking
the .do link, but "active" when submit button(for create , edit) is clicked.

 
  if i do the validation in my action class by coding the validation in a
validate method , i can bypass calling the validation method in the action
class when link is clicked and call the validate method only for create ,
edit when submit button is used.
  
   This is not a problem if i link directly to a jsp  using 
   <html:link href="department.jsp">New Department</html:link> 
   but by doing this i am navigating to a jsp(view) from another jsp(view)
without the controller in between thus breaking MVC.
      what is the best solution to this problem.  any commnets are welcome.
thanks ....


     <form-bean
		name="departmentForm"	
		type="DepartmentForm">
	</form-bean>

      <action path="/department"
              type="DepartmentAction"
              name="departmentForm"
              scope="request"
              validate="true"
		  input="department.jsp">
          <forward name="success" path="department.jsp"/>
          <forward name="failure" path="failure.jsp"/>
      </action>

      

  

   
  
  
  






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Validation Framework Question..

Posted by Tony Baity <to...@yahoo.com>.
Hi,
Could  you perhaps use a different path for new departments... for instance...
"newDepartment.do"
that maps to DepartmentAction but does not do the validation?
-Tony (is it close enough to Friday to post a [FRIDAY] yet?)
 "VEDRE, RANAPRATAP REDDY" <VE...@engr.sc.edu> wrote:
I use html links that point to an action in my jsps, so that i can do some
initialization before displaying a jsp.
for example:
New Department

clicking on link "department.do" takes the control to the action
class(DepartmentAction) which forwards to department.jsp

I use validation framework to validate my form(DepartmentForm).

as i have a ".do" link, validation fails due to validator framework,
since the newly created form is empty and as a result my input which is
department.jsp is displayed with validation errors even for the first time
its displayed.

i use the same action(DepartmentAction) for creating,editing too. i want
to "bypass" the validation framework when the action is executed by clicking
the .do link, but "active" when submit button(for create , edit) is clicked.


if i do the validation in my action class by coding the validation in a
validate method , i can bypass calling the validation method in the action
class when link is clicked and call the validate method only for create ,
edit when submit button is used.

This is not a problem if i link directly to a jsp using 
New Department 
but by doing this i am navigating to a jsp(view) from another jsp(view)
without the controller in between thus breaking MVC.
what is the best solution to this problem. any commnets are welcome.
thanks ....


name="departmentForm" 
type="DepartmentForm">


type="DepartmentAction"
name="departmentForm"
scope="request"
validate="true"
input="department.jsp">


















--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site