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]

Reply via email to