Execute action to process the variables in the class, and then use the strust2 tag to obtain the values of the variables in the action class.
<% @ Taglib prefix = " S " Uri = " /Struts-tags " %>
< Html >
< Head >
< Title > Hello world! </ Title >
</ Head >
< Body >
< H2 > < S: Property Value = "Message" /> </ H2 >
</ Body >
</ Html >
There is a message variable in the action class.
Method 2: implement with valuestack
<%
// Obtain the valuestack object.
Valuestack = (Valuestack) request. getattribute ( " Struts. valuestack " );
%>
< Html >
< Head >
< Title > Hello world! </ Title >
</ Head >
< Body >
< H2 > <% = Vs. findstring ( " Message " ) %> </ H2 >
</ Body >
</ Html >
struts2 puts the variables in the action class into the valuestack container during execution, and obtains the instance through request. getattribute ("struts. valuestack") on the JSP page. Struts. valuestack should be named as agreed.