files * .do instead of jsp?

1

I am helping in the development of an application, made with java and jsp. The links appear as .do instead of .jsp, even though the files are .jsp. The most I could find is that it has to do with struts or something like that extension, but my question is if I create a new .jsp file, how and where I have to configure it to open it later. I feel the ambiguity, to see if at least you can give me information about this extension.

Thanks to Pablo, I found the file "struts-config.xml", and I configured my jsp "mostrarCargos.jsp" in the following way, but it still does not work, so something else is missing.

<global-forwards>
        <forward name="MostrarCargos"
            path="/WEB-INF/page/administracion/mostrarCargos.jsp" />
</global-forwards>
<action-mappings>
        <action path="/MostrarCargos" forward="/mostrarCargos.jsp" />
</action-mappings>
    
asked by Sergio 03.01.2019 в 13:24
source

1 answer

2

In Struts you can reach a jsp, by means of a Action (Controller) in the following way:

    <action path="/MuestraCargos"
        type="com.mkyong.common.action.MostrarCargosAction"
        name="MostrarCargosForm">
    </action>

and in my action class only refer to the forward , which you have configured in the global-forwards , as follows:

       public class MostrarCargosAction extends Action{

           public ActionForward execute(ActionMapping mapping,ActionForm form,
              HttpServletRequest request,HttpServletResponse response)
              throws Exception {

                return mapping.findForward("MostrarCargos");
           }

        }

which will make it redirect to /WEB-INF/page/administracion/mostrarCargos.jsp, and the way to call it in the url will be:

     http://localhost:8080/tuContexto/MuestraCargos.do

The other way is how you have it configured, by means of a Action but without a class, with what you have configured in the action-mappings :

       <action path="/MostrarCargos" forward="/mostrarCargos.jsp" />

The way to call it is slightly different at the end of ShowCharges.do

       http://localhost:8080/tuContexto/MostrarCargos.do

The error that marks you on the 404, is because you are looking at webapp or WebContent the jsp showCargos.jsp , you can configure it as the one you have in the global-forwards that redirects to /WEB-INF/page/administration/showCharges.jsp or put the jsp in the webapp folder strong> or WebContent directly.

    
answered by 04.01.2019 / 16:28
source