admin管理员组

文章数量:1125047

I have a Struts application in which I need to create a basic user management panel, but I can't get the view to display the data that I pass from the action. I have followed the instructions on how to do it, but still, it doesn't work. My JSP receive the object, but the textfield doesnt show the info.

If someone could explain to me what the problem is, I would be grateful.

"I'm starting to get a little desperate because I can't find the error.

This is part of my jsp:

                <fieldset style="width:60%; padding-left: 2vw; padding-right: 2vw; padding-top: 20px; padding-bottom: 20px;">
                    <div style="display: flex; flex-wrap: wrap; gap: 10px;">
                        <div style="flex: 1; min-width: 30%;">
                            <label for="ctcNumfichero"><s:property value='getText("datosPersonales.ctcNumfichero")'/></label>
                            <s:textfield id="ctcNumfichero" name="gdrBenefiBean.ctcNumfichero" style="width: 100%;" class="size-8" value="%{gdrBenefiBean.ctcNumfichero}"/>
                        </div>
                        <div style="flex: 1; min-width: 30%;">
                            <label for="ccaCodccaa"><s:property value='getText("datosPersonalesaCodccaa")'/></label>
                            <s:textfield id="ccaCodccaa" name="gdrBenefiBeanaCodccaa" style="width: 100%;" class="size-8" value="%{gdrBenefiBeanaCodccaa}"/>
                        </div>
            
                        <div style="flex: 1; min-width: 30%;">
                            <label for="gbeNombre"><s:property value='getText("datosPersonales.gbeNombre")'/></label>
                            <s:textfield id="gbeNombre" name="gdrBenefiBean.gbeNombre" style="width: 100%;" class="size-8" value="%{gdrBenefiBean.gbeNombre}"/>
                        </div>

This is my struts

<?xml version="1.0" encoding="ISO-8859-15"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        ".5.dtd">


<struts>
    <package name="struts-datosPersonales" namespace="/datosPersonales" extends="struts-comun">                         
    
        <action name="mostrarDatosPersonalesDetalle" method="getUser" class="datosPersonalesAction">        
            <param name="derCdn"></param>
            <param name="sistema">PunicADM</param>
            <result name="success" type="tiles" >datosPersonales.tiles</result>
        </action>       
        
        <action name="mostrarDatosPersonales" method="mostrar" class="datosPersonalesAction">       
            <param name="derCdn"></param>
            <param name="sistema">PunicADM</param>
            <result name="success" type="tiles" >datosPersonales.tiles</result>
        </action>               
        
        <!-- Columns DretsTitularAction -->
        <action name="colsDatosPersonales" method="obtenerColsGrid" class="datosPersonalesAction">
            <result type="stream" name="success">
                <param name="contentType">application/json</param>
                <param name="contentCharSet">UTF-8</param>
                <param name="inputName">colsGridStream</param>
            </result>
        </action>                   
        
        <!-- Rows DretsTitularAction -->
        <action name="rowsDatosPersonales" method="obtenerRowsGrid" class="datosPersonalesAction">
            <result type="stream" name="success">
                <param name="contentType">application/json</param>
                <param name="contentCharSet">UTF-8</param>
                <param name="inputName">rowsGridStream</param>
            </result>
        </action>   
                
    </package>
</struts>

And this is my action

public String getUser() {
        String derCdn = request.getParameter("derCdn");
        GdrBenefiEntity benefiEntity = gdrBenefiService.findByDerCdn(derCdn);
        GdrBenefiBean benefiBean = new GdrBenefiBean();
        if (benefiEntity != null) {
            benefiBean.fromEntity(benefiEntity);
            request.setAttribute("gdrBenefiBean", benefiBean);
            LOGGER.info("Enviando Benefi: " + benefiBean.toString());
        } else {
            LOGGER.warn("No se encontró ninguna usuario para derCdn: " + derCdn);
        }
        return SUCCESS;
    }

本文标签: javaHos can i show my data from the action in the jspwith strutsStack Overflow