wood burning stoves 2.0*
The moose likes Struts and the fly likes <s:textfield error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "<s:textfield error" Watch "<s:textfield error" New topic
Author

<s:textfield error

siva np
Greenhorn

Joined: Feb 12, 2009
Posts: 9
Hi All,

I can get the values from the db and set the values.

In the action file :

private String test; and setter & getter method.

I am not able set the values in the jsp file

<s:textfield name="test" value="%{test}">

But i get the values from the text box & using out.println(test);

<input type="text" name="test" id="test" value ="<%=test %>"/>

Please guide me


Thanks & regards,

Siva N P
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211


<s:textfield name="test" value="%{test}">


That should work.
If you have a getTest() method in your Action class, you can simplify it to -
<s:textfield name="test" />


<input type="text" name="test" id="test" value ="<%=test %>"/>

This, OTOH, should not be working, unless you are creating a variable 'test' in your JSP.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
siva np
Greenhorn

Joined: Feb 12, 2009
Posts: 9
Dear Sir,

I have changed the coding.

But it didn't work.


My action page is salesAction.java


My jsp page name is sales.jsp


The output is not coming.

regards,

Siva N P
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

For those struts tags to work, the Action must be present on the value stack.
That requires that your interceptors are set up correctly, and you are getting to the JSP by invoking an Action.

Have a look at the A Request Walk-through section in this InfoQ article.

HTH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <s:textfield error
 
Similar Threads
struts2 textfield tag not populating with correct value from action class
JSF Backing bean in session Scope and State_Saving_Method = Client
how to pass parameter from jsp page to struts action class
Setting the value in <s:textfield from request scope
Struts2 text boxes