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 form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts form" Watch "struts form" New topic

struts form

Keith Lockey
Ranch Hand

Joined: Oct 05, 2001
Posts: 48
I hava a form which does is doing two posts every time I click the submit button. Why would this happen?

Thanks,<br />Keith
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
My guess is that the action is mapped to itself in struts.xml
Keith Lockey
Ranch Hand

Joined: Oct 05, 2001
Posts: 48
<action name="CreateWorkFlowItemBean" path="/createworkflow" scope="session" type="com.unitrin.paws.action.CreateWorkFlowItemAction" validate="false">
<forward name="CreateWorkFlowItemJsp"path="/jsp/CreateWorkFlowItem.jsp" />
I don't have it mapped to itself.
Greg Schultz

Joined: Oct 08, 2003
Posts: 16
Can your post the JSP form code and submit button code?
Keith Lockey
Ranch Hand

Joined: Oct 05, 2001
Posts: 48
I think the java script onLoad attribute is making it load additionally to the form submit.
So now instead of using javascript i need to figure out how to put the a collection in my bean so it will show up in the select options tag, maybe you can point me towards this?
sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
u could use jstl like this
<c:set var="speclist" value="${applicationScope.profileCache.professionSpecialtyListMap}"/>
<c:forEach var="entry" items="${speclist}">
<c:if test='${entry.key == prof}'>
<select name="specialty" class="text10">
<option value="">---------- Select One ----------</option>
<c:forEach var="specialty" items="${entry.value}">
<c:set var="specid" value="${specialty.specialtyID}"/>
<c:set var="name" value="${specialty.description}"/>
<option value="<c ut value="${specid}"/>" <c:if test='${specid == spec}'> selected </c:if> ><c ut value="${name}"/></option>
and java script should be fine but why would it cause the form to submit unless u are using an html:img tag........i had a problem when i was using html:img buttons initially coz i was accidentally calling the form on the click of the image.............make sure that its not the same thing....

I agree. Here's the link:
subject: struts form
jQuery in Action, 3rd edition