This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts and how to insert a bean-value into a attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts and how to insert a bean-value into a attribute " Watch "Struts and how to insert a bean-value into a attribute " New topic
Author

Struts and how to insert a bean-value into a attribute

Kai Unewisse
Greenhorn

Joined: Nov 10, 2002
Posts: 10
Hi all,
I am using Struts 1.0.2 and have problems to stay complete xml-conform.
I have to change some code into XML format, but I need some help.
Is there any tutorial with xml-comform JSP code ?
what can I do to fill an attribute like "alt" within <img > with conglomerated elements ?
With xml-nonconform code would it be :
<%
String filename = "abc.txt";
%>
<img alt="download this <%filename%>" />
I can use <jsp eclaration> for the the 1st part, but how to combine the stuff ?
thanks a lot for any useful idea...
Jesse Beaumont
Ranch Hand

Joined: May 30, 2002
Posts: 43
Use <jsp:expression>expression</jsp:expression> (=<%= expression %>
or <jsp:text>text</jsp:text>
Another alternative would be to use JSTL (<c ut>
Hope this helps
Jesse


---<br />Time flies like an arrow,<br />Fruit flies like a banana
Kai Unewisse
Greenhorn

Joined: Nov 10, 2002
Posts: 10
Originally posted by Jesse Beaumont:
Use <jsp:expression>expression</jsp:expression> (=<%= expression %>
or <jsp:text>text</jsp:text>


But I can't say <img alt="download this <jsp:expression>filename</jsp:expression>" /> ??
Can you give me an example ?
Thank you,
Kai
Jesse Beaumont
Ranch Hand

Joined: May 30, 2002
Posts: 43
Here is a sample:

It's a little more complicated than <%= filename%>
Hope that helps.
Jesse
Jesse Beaumont
Ranch Hand

Joined: May 30, 2002
Posts: 43
Doh. Correction to the above. The < in the img and > after it should be &lt; and $amp;gt;
Sorry about that... (curse the interpreter...)
Jesse
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts and how to insert a bean-value into a attribute
 
Similar Threads
html:img usage
jsp
Weird JSTL Behavior
Struts 2 value append while using s:text
html:file tag and custom image