1

I'm doing my first steps in jspx. I really like the xml-Syntax. Feels much more familiar than jsp and it forces me to undo my dirty hacks that jsp forgives. One of that hacks is this:

<img src="<b:Resource name="myImage.png" />" alt="some text" title="even more text" />

How to do it right in jspx?

My first thought: Write your own tag, but I really don't want to rewrite all the html-elements that could need an resource-reference with all of its possible attributes. Or is there maybe an existing library with those html-elements which I could extend to support my needed functionality?

Another idea: Doing something like:

<b:Resource name="myImage.png" var="imgVar"/>
<img src="${imgVar}" alt="some text" title="even more text" />

But I have to thing about my web developer agencies. They dont feel really happy with jsp. If I start using syntax like this, they'll totally quit.

Is there a good solution.

B.t.w. Using &#160; instead of &nbsp; is disliked by some of my web developers, too. Is there a better way in jspx?

Bharat Sinha
  • 13,973
  • 6
  • 39
  • 63
mibutec
  • 2,929
  • 6
  • 27
  • 39

1 Answers1

0

you might consider writing a custom EL function, so you could use:

<img src="${b:resource('myImage.png')}"
     alt="some text"
     title="even more text" />
Community
  • 1
  • 1
Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102