
Radio Button no muestra valor
Publicado por Juan Carlos (6 intervenciones) el 21/09/2016 00:50:52
Resulta que quiero validar cuando un Radio este seleccionado me mande un String con una URL, pero este solo me manda el valor. Ya no entiendo que hacer para que funcione este tema.
Adjunto mi codigo a ver si alguien puede echarle un vistazo :)
Adjunto mi codigo a ver si alguien puede echarle un vistazo :)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<%@ page import="java.io.OutputStreamWriter" %>
<%@ page import="java.io.InputStreamReader" %>
<%@ page import="java.io.BufferedReader" %>
<%@ page import="java.net.URLConnection"%>
<%@ page import="java.net.URL"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
String ip = request.getParameter("iptxt");
String radioBtn = request.getParameter("ambiente");
String urlServlet="";
System.out.println("ambiente = " + radioBtn);
try{
URL url = new URL(urlServlet);
if(radioBtn != null) {
if (radioBtn.equals("1")){
urlServlet = "http://**.***.***.***/servlet/consultaSesionesR?Valor=" + ip + "&Tipo=noIP";
ip = urlServlet;
System.out.println("ambiente ip= " + ip);
} else {
urlServlet = "http://**.***.***.**/servlet/consultaSesionesR?Valor=" + ip + "&Tipo=noIP";
System.out.println("ambiente = " + urlServlet);
}
}
System.out.println("URL Servlet:" + urlServlet);
int timeOut = 40000;
System.out.println("Timeout servlet:" + timeOut);
URLConnection conn = url.openConnection();
conn.setConnectTimeout(timeOut);
// Lector para la respuesta del servidor
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String xmlServlet = new String();
StringBuffer tmp = new StringBuffer();
String str;
System.out.println(in);
while ((str = in.readLine()) != null) {
tmp.append(str);
System.out.println(str+"###");
}
in.close();
xmlServlet = tmp.toString();
System.out.println("XML"+xmlServlet);
}
catch(Exception e){
e.printStackTrace();
System.out.println(e.getMessage());
System.out.println("Error al procesar la URL");
}
%>
<form action="index.jsp" method="post">
<label>Ip</label>
<input type="text" name ="iptxt" id='iptxt' size="40"></input>
<br>
<label>Ambiente</label>
<input type="radio" name="ambiente" id="radioDes" checked="checked" value="1" >Preproducción
<input type="radio" name="ambiente" id="radioProd" value="2">Producción
<br>
<input type = "submit" />
<br>
<iframe style="border:none" width="50%" height="450" id="resultadoRadius"></iframe>
</body>
</html>
Valora esta pregunta


0