Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

including content in jsp from action class ?

 
kamesh aru
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to include the content from two different action classes in a jsp page .
<html>
<head><title>An Include Test</title></head>
<body bgcolor="white">
<font color="blue">
The current date and time are
<%@ include file="http://host1:9080/example1.do" %>
<%@ include file="http://host2:9080/example2.do" %>

</font>
</body>

</html>
can any one guide me in this regard
thanks in advance
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The include directive <%@ include...> tag results in a tranlation time merge of source code.

Look into using the include action:
<jsp:include...>

See our FAQ for more information of the difference between the include action and directive. http://faq.javaranch.com/view?IncludesActionDirective
 
kamesh aru
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the responce
following is the code i used it s giving error :-
Error 500: Server caught unhandled exception from servlet [action]: Response already committed


[ January 25, 2006: Message edited by: kamesh aru ]
 
kamesh aru
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one help me out ?
[ January 25, 2006: Message edited by: kamesh aru ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing what the action does, it's impossible to say for sure. But the usual suspects for this type of problem are trying to forward or redirect after some output has been emitted, or trying to emit output after a forward or redirect.

Why are you doing things this way in the first place? It's rather messy. Rather, factor out the functionality you want for the action and put it in a custom tag rather than trying to include an entire servlet/action.
 
kamesh aru
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need the out put of action classes from two different servers and present it on the third server ?so i am getiing the error i would like to know can we call an action class in a jsp with url ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64828
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kamesh aru:
i would like to know can we call an action class in a jsp with url ?


Well, that's pretty much already been answered: it depends what the calling JSP is doing and what the action does. See the previous responses about what can cause the illegal state exception.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic