Toni Heightland

Greenhorn
+ Follow
since Oct 25, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Toni Heightland

Hi all,

In my application, a user can generate a file containing search results, which can later be emailed as an attachment. I'm wanting to give the user an option to preview the attachment before sending the email with a "Click here to preview attachment" kind of feature. The name of the file changes depending on the search that the user originally performed. I cannot figure out how to reference the file name.
I've done a lot of searching, but I have not come up with anything.
I've tried:

The attachmentFileName is a property of the form bean associated with this action, as shown below.



I hope this is clear. If not, let me know and I'll give another shot at explaining.
Any help would be greatly appreciated!
17 years ago
problem solved. thanks for your interest.
18 years ago
Just to clarify, are you trying to ensure that the user does not enter their phone number or email address in the content field?
18 years ago
Hi,

I have been debugging my first struts app. It uses a LookupDispatch Action to perform CRUD methods. When the detail page is displayed, the user has the option to Edit or Delete the information. If I clear out one of the required fields, and hit Edit, it seems that validation is skipped because I get a db exception where a null value was attempted to be put in a required db column. After further investigation, I was messing around with the Add portion. I notice that if I enter some of the required data, hit enter, the validate() method is called, and, as expected, the errors for the remaining required fields are displayed. Next, I enter more (but still not all) of the required data, and hit enter. Now, I have a similar db exception as was described above on the Edit page.

I don't understand why it seems that the validate() method is not called before every submit. Does anyone have any ideas on this matter?

Just to clarify, I am not using the validator plugin, just the validate() method in the action form bean.

Toni
18 years ago
That fixed it! I had an idea of what was happening, but I wasn't sure how to fix it. Thanks for the example. I am very grateful.
18 years ago
ManageInformation.do

Thanks a ton for taking the time to assist me with this problem! I'm still searching for a solution!
18 years ago
Hi,

I am new to struts, and while I've found the solutions to most of my problems, this one has had me stumped for days.

The form validation errors are displayed when the form is initially displayed, so before the user has even had an opportunity to enter data that would need to be validated.
I've completed a test struts application, and I do not have this problem in the test app.

I don't think it makes a difference, but in this application, I'm using LookupDispatchAction, instead of Action. Aside from that difference, the only significant difference is that my current app uses filters to set up some application support.

Here is the relevant part of my struts-config.xml:

<form-beans>

<form-bean
name="ManageContactForm"
type="edu.ohio.struts.formBeans.ManageContactForm" />

</form-beans>

<global-forwards>
<forward
name="welcome"
path="/Welcome.do"/>
</global-forwards>

<action-mappings>
<!-- Default "Welcome" action -->
<!-- Forwards to Welcome.jsp -->
<action
path="/Welcome"
forward="/pages/Welcome.jsp"/>

<action path="/ManageInformation"
name="ManageContactForm"
scope="request"
type="edu.ohio.struts.action.ManageContactAction"
validate="true"
input="/pages/ManageContactInformation.jsp" >
<forward name="show_result" path="/pages/Welcome.jsp" />
</action>
[...]

Here is the jsp that calls the form:

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<html:html locale="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><bean:message key="welcome.title"/></title>
<html:base/>
</head>
<body>
<h1><bean:message key="welcome.heading"/></h3>
<p><bean:message key="welcome.message"/></p>
<ul>
<li>
<html:link page="/ManageInformation.do">Add Contact</html:link>
</li>
<li>
<html:link page="/Search.do">Search Contacts </html:link>
</li>
</ul>
<div id="footer">
</div>
</body>
</html:html>


And here is the form that's showing the errors before data has been entered:
(I've cut a bunch of it out b/c it is a long form, but hopefully left enough relavent information)...

<html:html>
<head>
<!-- <title>${actionType.title}</title>-->
<title><bean:message key="add.title" /></title>

</head>

<body>
<h1><bean:message key="add.heading" /></h1>
<html:form action="ManageInformation.do" method="post" >


<html:errors property="contactType" />
<fieldset> <legend>Contact Type </legend>
<html:radio property="contactType" value="newspaper"/>Newspaper
<br>
<html:radio property="contactType" value="legislator" />Legislator
</fieldset>
<br>
<br>
<h2>Contact Information</h2>
<label>Name:
<html:text property="name" value=""size="26" maxlength="25"/>
</label> <html:errors property="name" />
<br>
<label>Contact Person:
<html:text property="contactPerson" value="" size="26" maxlength="25"/>
</label> <html:errors property="contactPerson" />
<br>

<html:submit property="action"> <bean:message key="button.add" /> </html:submit>
<html:cancel value="Cancel"/>
</html:form>

Can anyone help me with this?

Thanks in advance!
[ November 11, 2005: Message edited by: Toni Heightland ]
18 years ago