• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

validations in a tabbedpanel

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Am trying to implement "edit profile" screen.I have a tabbed panel.In one of the divs i have a jsp form which takes these "edit profile" details.i have some default values populated from DB, after that user can change the values.i have validation xml for this action which is not getting called.that is am not able to do basic validations which am able to in other jsp pages.this is what i have in my struts.xml
<action name="doLogin" class="com.xyz.admin.Login">
<interceptor-ref name="params" />
<interceptor-ref name="validation" />
<interceptor-ref name="resourceInterceptor" />
<result name="input">/pages/login.jsp</result>
<result name="error">/pages/login.jsp</result>
<result name="superuserPage" type="redirect">
superuser.action
</result>
</result>
<result type="chain" name="adminPage">
<param name="actionName">doEditProfile</param>
</result>
<result>/pages/login.jsp</result>
</action>
<action name="doEditProfile" method="showData"
class="com.xyz.admin.EditProfile">
<interceptor-ref name="params" />
<interceptor-ref name="resourceInterceptor" />
<!-- <interceptor-ref name="validation" /> -->
<result name="input">/pages/login.jsp</result>
<result name="error">/pages/login.jsp</result>
<result>/pages/employeehomepage.jsp</result>
</action>

<action name="editProfile_save"
class="com.xyz.admin.EditProfile">
<interceptor-ref name="validation" />
<interceptor-ref name="params" />
<interceptor-ref name="resourceInterceptor" />
<result name="error">/pages/login.jsp</result>
<result>/pages/editProfileSuccess.jsp</result>
</action>

I have 2 methods in my action class.One for showing default data in the screen,other one is for saving the modified details to DB.

Can anyone help how to get the validations work from validation-xml

Regards,
Unaren


 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

Wel come to JavaRanch.............

for validation please make sure your validation xml must start with your Action name.

like in your case if you want to validate your edit profile data user your xml name like :

doEditProfile-validation.xml

Then in this your validation name must match with your jsp fields name.

Further more information refer this link :- http://struts.apache.org/2.x/docs/validation.html


 
newtostruts allu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I have the validation file name in the same format.
I still have the problem.
when i clicke on the that particular tab in the scree, it displays a form with default values from database.when i modify some or all values and click on save it should actually validate.But it is not.
Thanks,
Unaren
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi it's my mistake make your xml name

EditProfile-validation.xml


Please check with remove all your interceptor from your struts.xml file.




 
newtostruts allu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes i have the validaiton xml with the same name.
i need the interceptors for database connectivity.Is there any other way that i can get things working.
 
Nishan Patel
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Hi,

First remove your interceptor for testing.

Because if order of your interceptor is not correct order then your flow and validation not working properly that's why i told you that see after removing your interceptor.

Or better change of your interceptor order.

Choice is yours at last.



 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The validation process also uses the "workflow" interceptor. You've removed a number of interceptors that S2 uses to do important things--it's best not to remove interceptors unless you know what they're doing and are sure you don't need them.
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic