Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Include JSP Files

 
laser jim
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"laser jim", please check your private messages for an important administrative matter.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean, "class that wraps the JSP"?

Perhaps showing the code/JSP that isn't working would help.
 
laser jim
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic