• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts form

 
Keith Lockey
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hava a form which does is doing two posts every time I click the submit button. Why would this happen?
 
Ray Stojonic
Ranch Hand
Posts: 326
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My guess is that the action is mapped to itself in struts.xml
 
Keith Lockey
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<action name="CreateWorkFlowItemBean" path="/createworkflow" scope="session" type="com.unitrin.paws.action.CreateWorkFlowItemAction" validate="false">
<forward name="CreateWorkFlowItemJsp"path="/jsp/CreateWorkFlowItem.jsp" />
</action>
I don't have it mapped to itself.
 
Greg Schultz
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can your post the JSP form code and submit button code?
 
Keith Lockey
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
</c:forEach>
</select>
</c:if>
</c:forEach>
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....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic