Fixing to go dark for a plane so forgive me if I d...
# adobe
r
Fixing to go dark for a plane so forgive me if I don't reply - but using the new Java in CF int in 2021, foo = java { ...., is there a simple way to write out content to the screen from Java code?
b
I know how you'd do it in Lucee, but not quite sure about CF 🤔 That's a good question.
If its possible, you'd probably have to get the page context from the ThreadLocal scope and call methods there.
a
Ooh, @raymondcamden... you gave me a blog article. Here's a shit way of doing it: https://blog.adamcameron.me/2022/08/cfml-outputting-text-from-within-inline.html
r
dude shit way is totally fine - ust wapping up a day of travel, will look tomorrow, but please know i appreciate it!
a
I look fwd to your... reaction.
r
well shit. not workng, but im behind a bit. going to try commandbox
jfc. so i commandbox a new CF server, latest, and... cfscript isnt working.
sorry no - the new Java stuff doesnt work at all
a
Weird. I saw your comment on the blog about
setPageContext
not being found, and I had been getting that earlier in the piece when I was passing the wrong type into the method, as Java was not finding a method overload for
setPageContext(WrongType)
. I'm on
2021,0,04,330004
, which is running in a container built from
adobecoldfusion/coldfusion2021:latest
y/day. Might be worth checking a
writeDump(getPageContext())
. For me it's a
coldfusion.runtime.NeoPageContext
, which I was not able to coerce the inline Java to find, but that extends
javax.servlet.jsp.PageContext
, and that's enough to expose the
getOut
method anyhow, so just ran with that.
sorry no - the new Java stuff doesnt work at all
Sounds to me like commandbox is spinning up CF2018, not CF2021.
r
Can confirm its coldfusion.runtime.NeoPageContext