struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Loschen" <Chris.Losc...@Siebel.com>
Subject RE: Combining html:image and bean:define
Date Wed, 04 May 2005 19:07:31 GMT
Thanks very much -- that's much more straightforward! I'm starting to
find the same problem in a series of other pages as well, so I'm putting
your solution to a lot of use right away. I appreciate the help.

Chris 

-----Original Message-----
From: Niall Pemberton [mailto:niall.pemberton@blueyonder.co.uk] 
Sent: Tuesday, May 03, 2005 6:22 PM
To: Struts Users Mailing List
Subject: Re: Combining html:image and bean:define

Chris,

Firstly, it looks like hard work using an <input type="image"> and then
defining  an "onclick" event - why don't you just wrap a link around an
image - i.e. something like...
  <a href="..."><img src=""/></a>

Secondly, struts provides the pageKey and titleKey attributes on the
<html:img> and <html:image> tags which make it easier to use message
resources for the "src" and "title" attributes.

Putting that all together, how about the following....

<html:link action="/main_edit.do"
           paramName="hierarchyTreeForm"
           paramProperty="nodeId"
           paramId="nodeId">
     <html:img pageKey="image.common.button.cancel"
 
titleKey="jsp.hierarchy.bs_detailsJsp.details.cancel_title"/>
</html:link>

http://struts.apache.org/userGuide/struts-html.html#link
http://struts.apache.org/userGuide/struts-html.html#image
http://struts.apache.org/userGuide/struts-html.html#img

Niall

----- Original Message -----
From: "Chris Loschen" <Chris.Loschen@Siebel.com>
Sent: Tuesday, May 03, 2005 9:55 PM


Responding to my own question, I did manage to get this working by doing
this:

<bean:define id="nodeid" name="hierarchyTreeForm" property="nodeId" />
<bean:define id="requestPath" value="<%=request.getContextPath()%>" />
<bean:define id="cancel_page"><bean:message
key="image.common.button.cancel"/></bean:define>
<bean:define id="cancel_title"><bean:message
key="jsp.hierarchy.bs_detailsJsp.details.cancel_title"/></bean:define>
<input type="image" title="<%=cancel_title%>"
src="<%=requestPath%><%=cancel_page%>" onclick="return
doAction('<%=requestPath%>/hierarchy/business/main_edit.do?nodeId=<%=nod
eid%>','')" />

Is that the best way to do it? (It works, which is the main thing, but
if there's a more efficient method, please let me know...)

-----Original Message-----
From: Chris Loschen
To: Struts Users Mailing List

Hi all,

I'm using Struts 1.1, and just received from another team updates to a
JSP page that look like this:

<bean:define id="nodeid" name="hierarchyTreeForm" property="nodeId" />
<bean:define id="requestPath" value="<%=request.getContextPath()%>" />
<html:image pageKey="image.common.button.cancel"
titleKey="jsp.hierarchy.bs_detailsJsp.details.cancel_title"
onclick="return
doAction('<%=requestPath%>/hierarchy/business/main_edit.do?nodeId=<%=nod
eid%>','')"
/>

However, these aren't working -- in the source of the generated HTML,
the JSP tags are not getting converted to the appropriate scripting
variable and are just getting rendered as-is. I checked and the defined
beans are fine, just not when they're used inside the html:image tag.

I gather than I cannot combine JSP tags and Struts tags, but I don't see
how I can avoid it in this situation: we need the localization elements,
and we also need the specific variables. There has got to be a way
around this -- any suggestions?



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





_______________
Siebel
IT'S ALL ABOUT THE CUSTOMER
Visit www.siebel.com

This e-mail message is for the sole use of the intended recipient(s) and contains confidential
and/or privileged information belonging to Siebel Systems, Inc. or its customers or partners.
Any unauthorized review, use, copying, disclosure or distribution of this message is strictly
prohibited. If you are not an intended recipient of this message, please contact the sender
by reply e-mail and destroy all soft and hard copies of the message and any attachments. Thank
you for your cooperation.


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


Mime
View raw message