• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Validate problem

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to our Struts forum...
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%@ 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
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using struts tags or generic <input> tags?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic