You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Allen, Daniel" <Da...@kbcfp.com> on 2008/02/13 17:26:38 UTC

[s2] Forward directly to JSP w/o processing

Hi.

I have a few places in my web app where a URL goes to a page that is
more or less static. We still use JSPs for these static pages, since
we're looking to use Tiles to re-use header/footer code and so on.
Currently, though, my attempts to get Struts2 are just yielding no
response on the server, and I was wondering if perhaps this was because
I needed to do something else to describe the action for Struts to take.
If the below is incorrect, how can I forward a URL directly to a JSP
without any Action class in between? (I assume this must be possible,
since a) it was in Struts1, and b) 'class' is an option attribute for
<action>.)

Thanks for looking, 
~Dan Allen

_______________________
My struts.xml:
	<struts>
	   	<include file="struts-default.xml"/>
	   	
	   	<constant name="struts.devMode" value="true" />
	   	<constant name="struts.action.extension" value="do" />
	   	
		<package name="insurancederiv" extends="struts-default">
		
			<result-types>
				<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult"/>
			</result-types>
			
			<action name="home">
				<result name="success"
type="tiles">home</result>
			</action>
			
		</package>
   	</struts>
_________________________
My tiles-defs.xml:
<tiles-definitions>

	<definition name="home" template="/home.jsp"/>

</tiles-definitions>

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


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


Re: [s2] Forward directly to JSP w/o processing

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
I'm not sure what you mean by "no response from the server".
When you omit the class name on the action definition the default action 
will be used (usually ActionSupport) to set up the value stack and 
resources so you can use struts tags within the JSP.

Your tiles result looks fine.

If you don't want to explicitly define an action in struts.xml but want 
to forward to a JSP through Struts2, use the CodeBehind plugin.

http://struts.apache.org/2.x/docs/codebehind-plugin.html

Allen, Daniel wrote:
> Hi.
>
> I have a few places in my web app where a URL goes to a page that is
> more or less static. We still use JSPs for these static pages, since
> we're looking to use Tiles to re-use header/footer code and so on.
> Currently, though, my attempts to get Struts2 are just yielding no
> response on the server, and I was wondering if perhaps this was because
> I needed to do something else to describe the action for Struts to take.
> If the below is incorrect, how can I forward a URL directly to a JSP
> without any Action class in between? (I assume this must be possible,
> since a) it was in Struts1, and b) 'class' is an option attribute for
> <action>.)
>
> Thanks for looking, 
> ~Dan Allen
>
> _______________________
> My struts.xml:
> 	<struts>
> 	   	<include file="struts-default.xml"/>
> 	   	
> 	   	<constant name="struts.devMode" value="true" />
> 	   	<constant name="struts.action.extension" value="do" />
> 	   	
> 		<package name="insurancederiv" extends="struts-default">
> 		
> 			<result-types>
> 				<result-type name="tiles"
> class="org.apache.struts2.views.tiles.TilesResult"/>
> 			</result-types>
> 			
> 			<action name="home">
> 				<result name="success"
> type="tiles">home</result>
> 			</action>
> 			
> 		</package>
>    	</struts>
> _________________________
> My tiles-defs.xml:
> <tiles-definitions>
>
> 	<definition name="home" template="/home.jsp"/>
>
> </tiles-definitions>
>
>   


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