struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Per Johansson <perj...@gmail.com>
Subject How to import a struts 2 action into a jsp?
Date Thu, 24 Sep 2009 09:18:29 GMT
Hi,

I am new to Struts and want to import a Struts 2 action into a jsp by
jstl import:
  	<c:import url="/HelloWorld_input.action" />
But neither Tomcat nor Jboss seem to like this - but gives the reply:
Importing /HelloWorld_input.action: The requested resource
(/HelloImport/HelloWorld_input.action) is not available

Using c:import does not seem to trigger the processing of the struts
filter dispatcher.

If I import via an intermediate jsp instead, it works:
<c:import url="/hello.jsp" />

With hello.jsp:
---
    <body>
        <form action="/HelloImport/HelloWorld.action" >
            <input type="text" name="userName" />
            <input type="submit" />
        </form>
    </body>
---

And struts.xml:
<struts>
    <package name="default" extends="struts-default">
        <action name="HelloWorld_input" >
            <result>/hello.jsp</result>
        </action>
        <action name="HelloWorld" class="test.HelloWorld">
            <result >/success.jsp</result>
        </action>
    </package>
</struts>


With Struts you should never access jsp:s directly, but always work
with actions.
Is there any trick to import a Struts 2 action directly into a JSP?


/Best regards, Per Johansson

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message