struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ricardo Cortes" <rcor...@boltstaff.com>
Subject RE: JSTL and Multibox Submit Problem (SOLVED)
Date Tue, 25 May 2004 15:54:26 GMT
That makes sense.  I'm not sure why I didn't think of that.  I guess I was assuming the <html:link>
would take care of the form submission since it was embedded in an <html:form>.  So,
I've added an onclick attribute to my <html:link> as follows and it worked just fine:

<html:link onclick="document.forms[0].submit();" href="#" name="deleteNotesLink">delete</html:link>

Voila!  (It's the French Open this week.)

Thanks Richard.

-----Original Message-----
From: Richard Yee [mailto:ryee86@yahoo.com]
Sent: Tuesday, May 25, 2004 11:36 AM
To: Struts Users Mailing List
Subject: Re: JSTL and Multibox Submit Problem


Ricardo,
If you are going to use the html:link tag, then you
need to have it trigger a call to a JavaScript
function that will submit the form for you. Otherwise,
jjust clicking the link will not submit the form.

Regards,

Richard

--- Ricardo Cortes <rcortes@boltstaff.com> wrote:
> Hi there,
> 
> I am having a problem getting the checked values
> from a multibox that is submitted to my action and I
> was hoping one of you could help me out.  I followed
> Ted Husted's example of using a Multibox within an
> iteration but I have a feeling that my setup is a
> bit different and thus renders a different solution.
>  I'm using a JSTL forEach loop to loop through a
> list of MessageInstance objects.  I want the user to
> be able to check which MessageInstances should be
> deleted and the action to perform the deletion. 
> Everything gets rendered ok but when the form is
> submitted, the String[] object in the form is empty.
>  I should also note that everything works fine if I
> use an html:submit but when I try to use an
> html:link to do the submit I don't get any checked
> values in my String[] object.  I've included some
> code snippets below.  Any help would be awesome.
> 
> Thanks!
> Ricardo
> 
> JSP:
> ===
> 
>   Submit Link (inside ManageNotesForm):
>   ====================================
> 
>    <jsp:useBean id="deleteNotesLink" class=
> "java.util.HashMap"/>
>    <c:set target="${deleteNotesLink}"
> property="membername"
> value="${requestScope.membername}"/>
>    <c:set target="${deleteNotesLink}"
> property="task" value="delete"/>
>    <html:link action="/submitMain"
> name="deleteNotesLink">delete</html:link>
> 
>   forEach Loop (inside ManageNotesForm):
>   =====================================
> 
>   <c:forEach
> items="${sessionScope.messageInstances}"
> var="aMessageInstance" varStatus="status">
>    	<html:multibox name="${formName}"
> property="selectedItems">
> 		<c:out value="${aMessageInstance.id}"/>
> 	</html:multibox>
> 	<c:out value="${aMessageInstance.id}"/>
>   </c:forEach>
> 
> ManageNotesForm Bean:
> ====================
> 
>     private String[] selectedItems = {};
> 
>     public String[] getSelectedItems() {
>         return selectedItems;
>     }
> 
>     public void setSelectedItems(String[]
> selectedItems) {
>         this.selectedItems = selectedItems;
>     }
> 
> 
>                         
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message