There’s a strange requirement where I need to get server side data on page load using only html tags.
I have following field in Struts 2 action
private String myData; //with getter and setter.
...
myData = "myValue";
....
and to bind it with text field in jsp, I usually write
<s:textfield name="myData"></s:textfield>
When result is dispatched to jsp, Struts2 renders it something like this
<input type="text" name="myData" value="myValue"></input>
But when I write
<input type="text" name="myData"></input>
It does not bring any value with it.
Can I achieve this without using strut2 tags, scriptlets, or any such server side thing in jsp?
You have to give the
valueattribute in your tag… Any server programming language renders thier tag as html tags.