Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

<s:textfield error

 
siva np
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<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.
 
siva np
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic