so i would suggest you to use the action class as a controller to handle
the data from the business logic and provide them to the user interface
(jsp documents) by putting them as beans into the scope (e.g. request or
session).
Why do you want to use the action without a action forward? Maybe there
exists another possibility. I'm not very familar to all type of Actions.
Maybe there are more Actions, whose methods are returning something else
than "ActionForward"...
Lalchandra Rampersaud schrieb:
Yes, I can use my action to put data into the request or session scope.
-----Original Message-----
From: Ingo Villnow [mailto:[EMAIL PROTECTED]
Sent: Friday, January 25, 2008 1:08 PM
To: Struts Users Mailing List
Subject: Re: actions help
where in your jsp do you want to use your action? can you use your action to
put your returning object into the request or session scope?
so you can forward to the input page like "return mapping.getInputForward()"
and in your jsp you have access to that object with the bean- or logic-tags
i am telling according struts 1
Lalchandra Rampersaud schrieb:
Yes, something like that except that it returns a list or an object.
-----Original Message-----
From: Ingo Villnow [mailto:[EMAIL PROTECTED]
Sent: Friday, January 25, 2008 12:28 PM
To: Struts Users Mailing List
Subject: Re: actions help
Do you mean something like this? you can use actions to get data as a
stream, for example to use it with the img-tag
/****action****/
public class DiagramGanttAction extends DownloadAction {
protected StreamInfo getStreamInfo(ActionMapping mapping,
ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String contentType = "image/png";
byte[] imagebytes = null; // Get the bytes from somewhere
final GanttDiagram gantt = new
GanttDiagram(project.getName(),project);
imagebytes = gantt.getImagearray();
return new ByteArrayStreamInfo(contentType, imagebytes);
}
protected class ByteArrayStreamInfo implements StreamInfo {
protected String contentType;
protected byte[] bytes;
public ByteArrayStreamInfo(String contentType, byte[] bytes) {
this.contentType = contentType;
this.bytes = bytes;
}
public String getContentType() {
return contentType;
}
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(bytes);
}
}
}
now you can use it in your jsp:
<%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib
uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@ taglib
uri="http://struts.apache.org/tags-html" prefix="html"%> <html:img
action="/diagramGantt" alt="hier müßte das Bild kommen" />
struts-config:
<action
attribute="diagramGanttForm"
input="gantt.jsp"
name="diagramGanttForm"
path="/diagramGantt"
scope="request"
type="kpm.presentation.actions.DiagramGanttAction"
validate="false" />
</action-mappings>
Lalchandra Rampersaud schrieb:
Hi
Is it possible execute an action which just puts data into the
request object without returning an ActionFoward?
I tried to return null but the page just becomes blank.
Ravi
__________________________________________
Participe en Universidad 2008.
11 al 15 de febrero del 2008.
Palacio de las Convenciones, Ciudad de la Habana, Cuba
http://www.universidad2008.cu
__________________________________________
Participe en Universidad 2008.
11 al 15 de febrero del 2008.
Palacio de las Convenciones, Ciudad de la Habana, Cuba
http://www.universidad2008.cu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
__________________________________________
Participe en Universidad 2008.
11 al 15 de febrero del 2008.
Palacio de las Convenciones, Ciudad de la Habana, Cuba
http://www.universidad2008.cu
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]