• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

ActionError history is not clearing automatically

 
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I have a small struts application in the login form I have the validate() to validate the userId and pwd whether is null or not and displaying the action error messages.

struts-config.xml
-------------------
<action path="/Login" parameter="/Login/login.jsp" type="org.apache.struts.actions.ForwardAction" />

In JSP
-------
<div style="color:red">
<html:errors />
</div>

Everytime while accessing the /Login.do am getting the validation errors also like(user is required and password is required). After refreshing the page is disappears.

I tried adding
<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
%>
but no use.. Everytime at first login I got the validation errors. Please assist me to resolve this.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please assist
 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Meet,
I think that is not because of chached errors...
that may be because , you are directly going to the Login Action without going thru JSP and as you have validatation hrnce it is fired and you are having Action Errors on the page...
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Saraf,

Could you please assist me.. How to resolve this issue...

You are Rite. I put some System.out.println in the validate method, yes it's firing the validate method ont he first hit.

Thanks
 
vijay saraf
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok...
i think ,you can break your action in to 2 action
1st for, just to redirect to Login.jsp,when user just click on Login Link.
2nd for, to validate and forward on action,when user enter userid/pass and hits submit button.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic