I have a simple page in which the User accepts an input file and does some bussiness logic. I wanted to have validation in the ActionForm as i want to check for file format, size etc.
I have added the code to the validate method in ActionForm and if there are any errors, I create ActionMessage Object and add them to ActionErrors.
I have <html:errors/> in my JSP so that if there are any problems, errors are displayed and the page does not gets submitted
For some reason, it is not working.
I have validate attribute set to true in the struts-config file. Actually, i can see the code going through the validate method, but then it displays a blank page ( from the URL i see in the page, it seems to be pointing to the struts action link ). If i have a valid file, everything works fine
Any help will be appreciated greatly
Mona Tajik
Greenhorn
Joined: Apr 27, 2006
Posts: 11
posted
0
have you saved the errors? saveErrors(request, errors); where errors is ActionErrors and request is HttpServletRequest
and whats your mapping for this? do you include in the forward e.g. <forward name="has_error" path="/action.do">
check your mapping or post some of your codes...
sun cheng
Greenhorn
Joined: Jun 02, 2006
Posts: 17
posted
0
mark
Omer Dawelbeit
Greenhorn
Joined: Jun 09, 2006
Posts: 1
posted
0
are you using the input attribute in your action tag i.e. <action path="" input="" validate="true" />
SCJP, SCWCD, SCEA5(1)
sun cheng
Greenhorn
Joined: Jun 02, 2006
Posts: 17
posted
0
Are you include the taglig struts-html.tld <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
sun cheng
Greenhorn
Joined: Jun 02, 2006
Posts: 17
posted
0
do you return errors in your ActionForm?
Periakaruppan Thiagarajan
Ranch Hand
Joined: Jul 26, 2005
Posts: 65
posted
0
Raj,
You have not done anything wrong. If the validation ends in success, no issues. If not, the controller will will forward it to JSP. Have you given else where the forward path JSP when the validation fails?
If not, since the controller does not find any matching forward, it will display a blank page.
Thanks, Pk
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.