Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 8th, 2008, 03:44 AM
Authorized User
 
Join Date: Jul 2006
Location: Valencia, Valencia, Spain.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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&uacute;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>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for Auto-filling a pre-made Word form dan_thorman Excel VBA 0 January 25th, 2007 10:46 AM
Filling and submitting web form by C# application Mystic C# 0 May 2nd, 2006 04:29 AM
Filling a form in specified time (Reply ASAP) software_developer_kk Classic ASP Basics 1 March 29th, 2005 04:20 AM
Auto Filling Combo on Form penta Access 2 December 3rd, 2004 06:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.