Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Head First: Phraseomatic Servlet - convert to Spring MVC  RSS feed

Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranch folk and critters

I am a Java Learner who just won't go where I am told. I learn best by making things my way, so I may be in trouble here. It's a kind of long dumb question.

I have latched on to the Phraseomatic because it amuses me, and that's my number 1 priority to stay with something. I have Got the Phraseomatic servlet running on my local Spring Tool Suite setup, on the tc server they provide, and I fancied it up, then I put the phrases into an embedded database and that's working purty good, podners.

But now I am trying to figure out this whole Spring thing, have made it through some Hello this and that tutorials.

I have figured out that in Spring, this Servlet app (KathyServlet and PhraseOMatic2) ought to be converted to a Spring MVC app somehow, and I started that, and I got a thing to work, still with the database,  but tain't right. It generates the Phrase once when the app starts, not every time you hit the link.

I have  the PhraseOMatic2.makePhrase() method in a very similar format to the original in the book and it's called from the html template via a Controller but I don't think I am using the right design in Spring.

Is there some way in Spring web apps that you should just call a java program such as PhraseOMatic2 in the straightforward way that it's done in the KathyServlet in the book? It just calls the method right there in the PrintWriter line like this

and we see the phrase on that line regenerated with a page refresh.

How would we do that in a Spring MVC web app page?

Posts: 5745
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've put this post into the Spring forum (under Frameworks) to see if can get more traction there.
a wee bit from the empire
Become a Java guru with IntelliJ IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!