i think you need to pass some kinda value through because http doesn't pass through blanks...

struts has a mechanism that helps deal with this where selects default to on or off or something...

or you could just assign a temporary value when the item is selected for deletion..

hope this is helpful mark


Giovedì, 6 feb 2003, alle 16:55 Europe/Rome, Rong Yu ha scritto:

Hi,

I have a question as follow: how to delete one item from the select component? Each time I try to click "Delete Selected" button, inside QuestionSubjectDeleteAction class, subjectToDelete alway prints out as empty. How to relate a selected item of <html:select> to "deleteSubject" value in QuestionForm?

Thanks

-Rong

I have the following code:

----------------------------------
<html:form action="/subjdelete">

<html:select property="deleteSubject" size="6" multiple="true" onclick="true">
<logic:iterate id="test" name="questionForm" property="subject" scope="session">
<html:option value=""><bean:write name="test"/></html:option>
</logic:iterate>

</html:select>

<html:submit property="delete" value="Delete Selected"/>
</html:form>
-----------------------------------

public final class QuestionForm extends ActionForm {

private String lastName;
private String question;

private String newSubject;
private String deleteSubject;
private String newType;

private List subject;
private List type;

.....
}
-------------------------------------------
public final class QuestionSubjectDeleteAction extends Action{

public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {

QuestionForm f = (QuestionForm) form; // get the form bean

String subjectToDelete = f.getDeleteSubject();
System.out.println("size of subject = " + f.getSubject().size());
System.out.println("subjectToDelete = " + subjectToDelete);

}
}

----------------------------------------------------------------------- --------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to