This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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

 
Greenhorn
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?


 
Marshal
Posts: 5632
147
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.
 
please buy my thing and then I'll have more money:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!