some help urgent

hi

in my jsp there are 2 radio buttons (yes and no) and a continue button.

if the no radio button is selected and continue button is pressed then it should goto the next page whose action is defined in the struts config and if the yes radio button is selected and continue button is pressed then a popup page should be opened . how do i do this

thanks

makthar

[397 byte] By [makthara] at [2007-11-27 6:39:03]
# 1

Hi,

Do the following procedure

<input type="radio" name="rbutton" onClick="window.open('demo.html')">Yes

<input type="radio" name="rbutton" onClick="location.href='welcome.do';">No

Incase of demo.html give the file name to be displayed in the popup window. Incase of welcome.do give the action class you want to call.

If you have any queries let me know or send a mail to me at doubtsplz@gmail.com

Thanks & Regards,

Santhosh Reddy Mandadi

santhosh-mcaa at 2007-7-12 18:08:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]Alright here is an example for you hope that gives you some understanding.

present.jsp:

==========

<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html>

<body>

<html:form action="validate.do"/>

Yes: <html:radio property="radio" value="yes" onclick="window.open('<bean:message key="label.popup.link.yes"/>')"/><br>

No: <html:radio property="radio" value="no"/><br>

<html:submit/>

</html:form>

</body>

</html>

Struts-config.xml:

==============

<form-beans>

<form-bean name="validateFormBean"

type="com.forms.ValidateForm"/>

</form-beans>

<action-mappings>

<action path="/validate" type="com.actions.ValidateAction" name="validateFormBean" scope="request">

<forward name="no" path="/next.jsp"/>

<forward name="yes" path="/present.jsp"/>

</action>

</action-mappings>

ValidateForm.java:

===============

public class ValidateForm extends ActionForm{

private String radio = "";

public void setRadio(String radio){

this.radio = radio;

}

public String getRadio(){

return radio;

}

}

ValidateAction.java

===============

public class ValidateAction extends Action{

public ActionForward execute( ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws Exception {

String fwd = ((ValidateForm) form).getRadio();

return mapping.findForward(fwd);

}

}

next.jsp:

=======

<%@ page language="java" %>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<html>

<body>

<bean:write name="validateFormBean" property="radio"/>

</body>

</html>

Hope that might help :)

REGARDS,

RaHuL[/nobr]

RahulSharnaa at 2007-7-12 18:08:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...