Surely the tags in Struts2 support EL so you should avoid scriptlets and do something like this instead:
<s:textfield value="${tDate}" />
I'd also be a bit surprised if this really isn't even the best way. Most tag libraries in the popular frameworks pull in data from the request and bind it back automatically. But I don't know enough about Struts2 to say how in this case. But the above example *should* work.
Kartik Talasu
Ranch Hand
Joined: Aug 21, 2009
Posts: 98
posted
0
Hi Gregg,
I tried with your statement but its giving error like
<s:textfield value="${tDate}" name="toDate" id="toDate" />
org.apache.jasper.JasperException: /jsp/ToDate.jsp(4,0) According to TLD or attribute directive in tag file, attribute value does not accept any expressions
Hi David,
I tried with the OGNL also but it is not displaying any value, instead of value it is displaying the code.
But if am using property instead of textfield its working fine.
I had used both the ways but still no luck. Instead of value its displaying "#request.hello"
But its working for property
sandy safikri
Greenhorn
Joined: Apr 21, 2010
Posts: 1
posted
0
hii i have a same problem how to get struts 2 property?
@Kartik: wait, are you trying to access *parameters*?! Use #parameters then, otherwise you're attempting to access *attributes*. But in general you should never need to access a request parameter directly in a JSP-why are you doing this?
David Newton wrote:@Kartik: wait, are you trying to access *parameters*?! Use #parameters then, otherwise you're attempting to access *attributes*. But in general you should never need to access a request parameter directly in a JSP-why are you doing this?
I hope Kartik is still not stuck with this problem after almost 1 year ...