Two Laptop Bag*
The moose likes JSP and the fly likes including content in jsp  from action class ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "including content in jsp  from action class ?" Watch "including content in jsp  from action class ?" New topic
Author

including content in jsp from action class ?

kamesh aru
Ranch Hand

Joined: Mar 16, 2002
Posts: 150
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

Joined: Dec 11, 2004
Posts: 13410

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


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
kamesh aru
Ranch Hand

Joined: Mar 16, 2002
Posts: 150
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

Joined: Mar 16, 2002
Posts: 150
can any one help me out ?
[ January 25, 2006: Message edited by: kamesh aru ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
kamesh aru
Ranch Hand

Joined: Mar 16, 2002
Posts: 150
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

Joined: Jan 10, 2002
Posts: 61103
    
  66

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: including content in jsp from action class ?