Problem filling up a form
Hello all,
My problem is the following:
I have two jsp files. The first one opens the second one when a link is pressed by the user(<a> struts2 tag).
The second jsp has a form with two textfields and a combobox. I need to set the values of these input field but only the first jsp file knows which are these values.
How can I pass these values from the first jsp file to the second?
This is the first jsf file:
<%@ taglib prefix="str" uri="/struts-tags" %>
<jsp:include page="checkpass.jsp" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Parametros Configuración Sistema</title>
<script>
function onEliminarClick(parametro){
document.forms[0].inParametro.value = parametro;
document.forms[0].submit();
}
</script>
<link href="<str:url value="/css/configuracion.css"/>" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="container">
<div id="content">
<table class="dataTable">
<tr>
<th>Parametro</th>
<th>Valor</th>
<th>Obligatorio</th>
</tr>
<str:bean name="es.uv.lisitt.dtx2.configuracion.DatosConfigu racion">
<str:iterator value="total" status="stat">
<tr>
<td><str:property value="total[#stat.index].parametro" /></td>
<td><str:property value="total[#stat.index].valor" /></td>
<td><str:property value="total[#stat.index].obligatorio" /></td>
<td><str:form action="EliminarParametro">
<str:a href="#" onclick="onEliminarClick('%{parametro} ')">[Eliminar]</str:a><br/>
<str:hidden name="inParametro"></str:hidden>
</str:form>
</td>
<td>
<str:a href="SECOND.jsp" targets="center_frame">[Editar]</str:a>
</td>
</tr>
</str:iterator>
<tr>
<th colspan="3" align="right" >Número de Paramertros</th>
<td><str:property value="NumeroDeParametros"/></td>
</tr>
</str:bean>
</table>
</div>
</div>
</body>
</html>
The second jsp file:
<%@ taglib prefix="str" uri="/struts-tags" %>
<jsp:include page="checkpass.jsp" />
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Parametros Configuración Sistema</title>
<link href="<str:url value="/css/header.css"/>" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="container">
<div id="top">
<h2>Editar Parametro</h2>
</div>
<div id="content">
<str:form name="editForm" action="EditarParametro">
<str:textfield name="paramField" label="Parametro" value=''/>
<str:textfield label="Valor" name="valor" value=''/>
<str:combobox list="{'SI','NO'}" label="Obligatorio" name="obligatorio"/>
<str:submit value="Guardar" />
</str:form>
</div>
</div>
</body>
</html>
|