This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes Struts Include JSP Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Include JSP Files" Watch "Struts Include JSP Files" New topic
Author

Struts Include JSP Files

laser jim
Greenhorn

Joined: May 01, 2009
Posts: 2
Hello,

New to struts. Each of my JSP pages has an associated java class that provides the necessary data. The struts tags call the setters and getters and whatever.

My problem occurs when I try to include one jsp inside another. It seems that the java class that wraps the included jsp doesn't get called. Instead, the jsp gets included in a more literal sense, and the included JSP doesn't render any of it's data.

I tried both
<jsp:include page="terms.jsp" />
<s:include value="terms.jsp"></s:include>

how can I include the jsp in such a way that it will render with it's appropriate data?

Thanks@!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61084
    
  66

"laser jim", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What do you mean, "class that wraps the JSP"?

Perhaps showing the code/JSP that isn't working would help.
laser jim
Greenhorn

Joined: May 01, 2009
Posts: 2
A wrapper class would be the class you specify in the struts.xml file...
<action name="terms" class="bla.bla.bla.Terms">
<result>/struts/terms.jsp</result>
</action>


Anyway, one of my developers was able to find the solution:
<s:action name="terms" executeResult="true" />

Still don't know how to specify an action from a different package, but this is good for now.

Thanks to everyone who took a look at the problem
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Just call it an "action", not a "wrapper class"--nobody will know what you mean if you say wrapper class.

The action tag takes a "namespace" attribute to specify actions in a different namespace.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Include JSP Files