HTML:MESSAGES,HTML:ERRORS,用法
=======<html:messages>============
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.addMessages(request,message);
return ActionForward;
JSP 页面中 :
<html:messages id=" 指定使用消息的标识 " property=" 消息句柄 " message="true|false">
<bean:write name=" 以上所指 ID 标识 "/>
</html:messages>
==========<html:errors>==============
Action 中 :
ActionMessages message = new ActionMessages();
message.add(" 消息句柄 ",new ActionMessage(" 资源文件中 Key 值 ",String 类型描述信息 ));
this.saveErrors(request,message);
return ActionForward;
JSP 页面中 :
<html:errors property=" 消息句柄 "/>
如果Action中这样设定(false),页面的提示信息将不从资源文件里读取:
ActionMessages message = new ActionMessages();
message.add("消息句柄",new ActionMessage("String类型描述信息",false));
this.saveErrors(request,message);
return ActionForward;
JSP页面:
<html:errors/>或<html:errors property="消息句柄"/>
相关文档:
1. web.config
<connectionStrings>
<add name ="myconn" connectionString="Data Source=who\SQLEXPRESS; Initial Catalog=dbname;Integrated Security=True;" providerName="System.Data.SqlClient"/>
</connectionStrings>
2.
string htmlPath = "D:\\htmlFiles";
......
Ajax现在已经是相当流行的技术了,Ajax不仅是想服务器端发送消息,更重要的是无刷新的重载页面。
如果页面单纯的使用js来创建,要写大量的代码,而且不直观。
在asp.net中,其实我们可以创建用户自定义控件,通过Ajax请求返回用户自定义控件HTML代码。
public static string RangerUsControl(string controlName) ......
首先在layout文件夹下的xml中 加入WebView控件
<WebView
android:id="@+id/wv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
再在主文件中输入如下代码
public class TestDemo extends Activity {
/** Called when the activity is first created. */ ......