Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP's Java retrieve variable from Action class

 
wai chun chor
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Action Class:
say I have an action class with variable integer "totalUsers" set to 40.

JSP:
I have no problem retrieving this value via Struts tag such as:

The code above works fine.

But how do I get this value via Java code inside my JSP file?
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
First, you should reconsider. Using Java in a JSP a sign that you are putting logic in the display tier.
That said, you can get to the Action via the ValueStack, which you can obtain from the static method in ServletActionContext
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic