• 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

adding messages in Non action class

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
i have a class which is not a action class.It is normal class containing business logic. But in tihs class i wanted to store some messages using saveMessage(request,msg). But it's giving error when compiling the class.
Error is
'saveMessage() is not a Non-Static method.

can i save any message in any non action class and save it to the request.

After that i would able to display it in jsp file.

please help

Is their any other way.
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess a better way to implement your task would be to complete the business logic in your non-Action class and return some sort of value. Depending on this value you could set your message directly to your request object in the Action class.

Also, the compilation error you're facing could be because of the reason that you're directly accessing the method in that class... like XYZClass.setMessage(). In this case, your method needs to be public static.
 
The City calls upon her steadfast protectors. Now for a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic