• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Resolve variables inside a string - JSTL?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have been trying to figure out if what I am trying is possible using JSTL? I am storing the following inside a table



thus I am storing the following String in a column in a table

"<assign name="LocationID" expr="'${row.locationId}'"/>
<submit next="/aotg/dynApp" namelist="UserID AppID LocationID"/>"


thus the above string for example gets written to ${row.actionText} and gets resolved. But of course the output in the JSTL is exactly as above without resolving
the variable ${row.locationId} inside the String. Can you also somehow resolve the inner variable as well?

Is something like this even possible or do I need to hard code any parameters I might be using inside the JSTL page instead of trying to dynamically read it from
the table?

Thanks so much for any insight!
Mike

 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope. The time to parse the EL is long past at that point.

You might want to consider a tag file.
 
Mike Alba
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

Thanks so much for the quick response! That is what I was thinking. My first thought was to resolve tags inside the String with the proper values and then pass that to the JSP.
Basically have my own pre-parser. As I am new to this and have never used a tag file would learning how to do that be the preferable approach then creating a pre-parser?
And when you say use a tag file do you mean generate a unique dynamic tag file each time I call this code and then use that?

Thanks again!
Mike
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For creating a reusable HTML fragment\ with dynamic data, a tag file cannot be beat.
 
Mike Alba
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear I will need to look into this at a later date as I don't have a lot of time.
For now I just created a map and put the string values and variable values in upfront
and just did string replaces. Sure it is not the most optimal way but will get the job
done until I can research more into tag files...



Thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic