aspose file tools*
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
Author

Struts Validate problem

Sahil Sharma
Ranch Hand

Joined: Aug 27, 2003
Posts: 152
Hi,

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
author
Sheriff

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
Greenhorn

Joined: Oct 03, 2004
Posts: 10
<%@ page language="java" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html:html xhtml="true" locale="true">
<head>
<html:base />
<title>Sample form</title>
</head>
<body>
<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" />
</html:form>
</body>
</html:html>
David Pizon
Greenhorn

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.


Merrill
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: http://aspose.com/file-tools
 
subject: Struts Validate problem