File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resolve variables inside a string - JSTL?

 
Mike Alba
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • 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

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64202
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
Author and ninkuma
Marshal
Pie
Posts: 64202
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic