File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Validate problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Validate problem" Watch "Struts Validate problem" New topic

Struts Validate problem

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152

We are using struts framework to build our application. We r facing 1 small problem.We are using struts validate method to perform validations.Problem here is, whenever user submits incomplete information our validate method checks that and return errors back to the same page but the data entered by the user on the form is not maintained and blank fields are displayed.My ActionForm is in request scope.

Kindly Help
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Moving to our Struts forum...

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
David Pizon

Joined: Oct 03, 2004
Posts: 10
<%@ page language="java" %>
<%@ taglib uri="" prefix="bean" %>
<%@ taglib uri="" prefix="html" %>
<%@ taglib uri="" prefix="logic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html:html xhtml="true" locale="true">
<html:base />
<title>Sample form</title>
<html:form action="/Sample">
<%-- input field for properties --%>
<p>Sample field: <html:text property="field1" /></p>
<p>Sample field: <html:text property="field2" /></p>
<html:submit property="submit" value="submit" />
David Pizon

Joined: Oct 03, 2004
Posts: 10
Are you using struts tags or generic <input> tags?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This is a frequently encountered problem. Read this thread and this otherthread. Hopefully they will answer your question. If you still have doubts, let us know.

Consultant, Sima Solutions
Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152
we are using struts tags of (struts 1.1). I have solved the problem, but its quite unusual. We have used html:form tags for our form element.And we have used three of its attribute namely action, name and type. Now if I remove name and type from the html:form then everything works fine and values are also maintained but when I use them entered values are lost.

I will also look at those thread's.
I agree. Here's the link:
subject: Struts Validate problem
It's not a secret anymore!