File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting the value in <s:textfield from request scope

 
Jigar Naik
Ranch Hand
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to set the value in textfield, the value is in requet scope.

how do i do it ?
i tried to use <s:property tag but i am not able to nest it in ><s:textfield tag.

my action class which sets the value in request is as bellow



and my jsp

on which i want to set the value is as bellow

 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

You just remove request. from your text field tag.




And you will get the value.


 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's incorrect; OGNL expressions do not search JEE scopes. If a JSTL expression is used the request wrapper *will* search the value stack first *then* fall back to a scoped attr. The OGNL expression *would* require the request, but with a hash mark: #request.

The larger question is why do it this way at all? S2 provides an elegant mechanism making setting and using values like this in the request scope unnecessarily cumbersome--just make the values action properties:Then in the JSP:
 
Jigar Naik
Ranch Hand
Posts: 761
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David & Nishan.

Bellow worked... I found it by googling.



but i am not sure how it works... Can you please explain ? What do i get with "%" & "#"
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
%{} is the OGNL escape. The # means it's an action context "scope" variable, not on the stack.

Again--there's zero reason to do it like this, and at least a couple reasons not to.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic