• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Setting the value in <s:textfield from request scope

 
Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Ranch Hand
Posts: 689
Scala Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi,

You just remove request. from your text field tag.




And you will get the value.


 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 763
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic