You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emi Lu <em...@encs.concordia.ca> on 2011/05/30 17:30:20 UTC

How to allow to accept dynamic src image file?

Hello list,

A question about <s:submit> in struts2.2.3


Icon is dynamic:

<%
  String pdf_icon= request.getContextPath() + "/img/pdficon.png" ;
%>

<s:submit type="image" src="<%= pdf_icon%>" 
action="preview_pdfProcessAction" />

But <s:submit> does not support src = "<%%>"

Is there a way, can make s:submit accept dynamic src image location?

Thanks a lot!
Emi

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to allow to accept dynamic src image file?

Posted by Burton Rhodes <bu...@gmail.com>.
You can override the freemarker template to do this. It's fairly easy.
Just look for the submit tpl file, copy it a templates dir, and modify
it to accept 'src' parameter. There are examples of how to override
struts templates by googling it.

On Monday, May 30, 2011, Emi Lu <em...@encs.concordia.ca> wrote:
> Hello list,
>
> A question about <s:submit> in struts2.2.3
>
>
> Icon is dynamic:
>
> <%
>  String pdf_icon= request.getContextPath() + "/img/pdficon.png" ;
> %>
>
> <s:submit type="image" src="<%= pdf_icon%>" action="preview_pdfProcessAction" />
>
> But <s:submit> does not support src = "<%%>"
>
> Is there a way, can make s:submit accept dynamic src image location?
>
> Thanks a lot!
> Emi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to allow to accept dynamic src image file?

Posted by Emi Lu <em...@encs.concordia.ca>.
On 05/30/2011 03:05 PM, Chris Pratt wrote:
> Argh, hit send too early.
>
> No, EL is disabled in the struts for security reasons.  But OGNL should work
> fine.  Something like src="%{#imageName}" should do the trick.
>    (*Chris*)
>

Thank you very much Chris! It works.

bean.java

private String image_filename ;
===================================
show.jsp

<s:submit type="image" src="%{image_filename}" theme="simple" 
action="methodnameProcessAction" />

Emi





> On May 30, 2011 12:01 PM, "Chris Pratt"<th...@gmail.com>  wrote:
>>
>> No, EL is disabled in the struts for security reasons.  But src="%{#}"
>>
>> On May 30, 2011 9:37 AM, "Dave Newton"<da...@gmail.com>  wrote:
>>> On Mon, May 30, 2011 at 11:30 AM, Emi Lu<em...@encs.concordia.ca>
> wrote:
>>>> But<s:submit>  does not support src = "<%%>"
>>>
>>> Does normal EL work?
>>>
>>> Dave
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>


-- 
Emi Lu, ENCS, Concordia University, Montreal H3G 1M8
emilu@encs.concordia.ca        +1 514 848-2424 x5884

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to allow to accept dynamic src image file?

Posted by Chris Pratt <th...@gmail.com>.
Argh, hit send too early.

No, EL is disabled in the struts for security reasons.  But OGNL should work
fine.  Something like src="%{#imageName}" should do the trick.
  (*Chris*)

On May 30, 2011 12:01 PM, "Chris Pratt" <th...@gmail.com> wrote:
>
> No, EL is disabled in the struts for security reasons.  But src="%{#}"
>
> On May 30, 2011 9:37 AM, "Dave Newton" <da...@gmail.com> wrote:
> > On Mon, May 30, 2011 at 11:30 AM, Emi Lu <em...@encs.concordia.ca>
wrote:
> >> But <s:submit> does not support src = "<%%>"
> >
> > Does normal EL work?
> >
> > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >

Re: How to allow to accept dynamic src image file?

Posted by Chris Pratt <th...@gmail.com>.
No, EL is disabled in the struts for security reasons.  But src="%{#}"
On May 30, 2011 9:37 AM, "Dave Newton" <da...@gmail.com> wrote:
> On Mon, May 30, 2011 at 11:30 AM, Emi Lu <em...@encs.concordia.ca> wrote:
>> But <s:submit> does not support src = "<%%>"
>
> Does normal EL work?
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

Re: How to allow to accept dynamic src image file?

Posted by Dave Newton <da...@gmail.com>.
On Mon, May 30, 2011 at 11:30 AM, Emi Lu <em...@encs.concordia.ca> wrote:
> But <s:submit> does not support src = "<%%>"

Does normal EL work?

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org