随笔 - 14  文章 - 5  评论 - 0

安卓中webview读取html,同时嵌入Flex的SWF,交互

安卓activity与html交互很简单,用javascript接口即可,网上一堆的例子,基本上没多大问题。

在html里面嵌入swf并与之交互就有点麻烦,我用了ExternalInterface没有成功,那位兄台成功了可以交流交流。我用的是FlashVars,

不用改什么配置,html就可以向swf传递数据。

Html代码  
  1. <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="940" height="600">
  2. <param name="movie" value="client.swf?v=3">
  3. <param name="wmode" value="opaque"/>
  4. <param name="quality" value="high" />
  5. <param name="FlashVars" value="p1=222&p2=333" />
  6. <param name="menu" value="false"/>
  7. <embed src="client.swf" quality="high" wmode="opaque" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"  FlashVars="p1=222&p2=333" width="940" height="600">
  8. </embed>
  9. </object>

其中可以在FlashVars中指定,也可以通过movie或src中的swf url指定参数,例如上面的v。

Flex代码

  1. // 需要引入
  2. import mx.core.Application;
  3. // 获取 FlashVars 的 Object
  4. var params:*= Application.application.parameters;
  5. //  也可以指定某一个参数
  6. var p1:String = Application.application.parameters.p1;

Okay!

Android使用Webview播放Swf文件,实现与Flash数据交互

原创 2017年05月11日 14:08:24
  • 2600

HDSwfPlayer

 

谷歌中国API链接:https://developer.android.google.cn 

支持swf播放以及html带swf的播放。 

支持swf与js的交互。 

自动写入flash信任路径。 

提供播放回调。 

Android版本不要超过4.3。

目录

如何导入到项目

支持jcenter方式导入。 

支持本地Module方式导入。

jcenter方式导入

  • 在需要用到这个库的module中的build.gradle中的dependencies中加入

dependencies { compile 'com.yhd.hdswfplayer:hdswfplayer:1.0.0'}

  • 1
  • 2
  • 3

Module方式导入

  • 下载整个工程,将hdmediaplayer拷贝到工程根目录,settings.gradle中加入

include ':hdswfplayer'

  • 1
  • 在需要用到这个库的module中的build.gradle中的dependencies中加入

dependencies { compile project(':hdswfplayer')}

  • 1
  • 2
  • 3

如何使用

本类支持播放.swf文件、.html文件(.html可以包裹.swf文件并实现与android的交互)。 

在demo中提供.html文件模板实例,如果需要js与android数据交互,请移步demo参考。

HDSwfPlayerHelper

  • 初始化

private void initSwf() { //工程assets目录下swf文件对应的html文件路径,如果直接传入swf文件的路径也可以播放,但是不能与js交互 String assetsPath="file:///android_asset/main.html"; SwfPlayerHelper.getInstance(getApplicationContext()) .setJSCallClassName("jsCallClassName")//设置js调用的类名 .setJSCallMethodName("jsCallMethodName")//设置js调用的方法名 .setWebView(webView)//设置flash播放的载体 .setSwfPlayerCallBack(new SwfPlayerHelper.SwfPlayerCallBack() {//设置播放过程的回调 @Override public void onCallBack(SwfPlayerHelper.CallBackState state, final Object... args) { Log.v(TAG, state.toString()); //收到js调用方法发来的参数字符串信息 if(state== SwfPlayerHelper.CallBackState.JS_CALL_ANDROID_METHOD_WITH_PARAM){ runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(),(String)args[0],Toast.LENGTH_LONG).show(); } }); } } }) .playSwf(assetsPath);//传入绝对路径、带file://的绝对路径、url都行}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 为了让退出播放或者在播放时用户转到其它页面后flash不再播放,应该重写用于播放的Activity的onPause和onResume方法,并分别调用webview的隐藏方法”onPause”和”onResume

@Overrideprotected void onResume() { super.onResume(); SwfPlayerHelper.getInstance(getApplicationContext()).onResume();}@Overrideprotected void onPause() { super.onPause(); SwfPlayerHelper.getInstance(getApplicationContext()).onPause();}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 更多的操作

//WebView调用js的基本格式为:webView.loadUrl(“javascript:methodName(parameterValues)”)SwfPlayerHelper.getInstance(getApplicationContext()).androidCallJsMethod("jsMethodString");SwfPlayerHelper.getInstance(getApplicationContext()).androidCallJSMethodWithReturn("jsMethodString");

  • 1
  • 2
  • 3

关于我

欢迎 Star Fork交流地址:尹海德(123302687@qq.com)

  • 1
  • 2
  • 3

License

Copyright 2017 yinhaideLicensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

Github传送门https://github.com/yinhaide/HDSwfPlayer

版权声明:本文为博主原创文章,未经博主允许不得转载,转载请标出原文出处。
  • 本文已收录于以下专栏:
  • Android开源之路

    Android通过javascript与flash动画交互

    原创 2015年01月17日 12:35:52
    • 1473

    问题描述:当我们在Android应用上加载了flash,然后希望点击flash的相关控件,Android应用能够做出相应。

    这就涉及到Android通过javascript与flash动画交互技术。我们实现方案是:新建一个html文件显示flash动画,html文件嵌入javascript函数与flash交互,然后我们我们Android应用通过webview加载html文件,再与该html文件嵌入的javascript函数交互,最后可以实现Android的数据与flash的数据进行通信。有点绕口,不知读者是否看明白了。总之就一句话:html中的javascript函数是中介,Android与flash分别与它进行数据传输即可。

    贴代码:

    flash.html

    [html] view plain copy
    1. <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd;">
    2. <html xmlns="http://www.w3.org/1999/xhtml">
    3. <head>
    4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    5. <script language="JavaScript" type="text/JavaScript">
    6. var str1 = "hello";
    7. var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    8. function myFlash_DoFSCommand(command, args)                {
    9. var myFlashObj = InternetExplorer ? myFlash : document.myFlash;
    10. //flash传来的参数,如果有数据传来则调用Android代码的函数,将flash数据传给Android
    11. if(command =="file1_open"||command=="file2_open"||command=="file3_open"||command=="file4_open"||command=="file5_open"||command=="file6_open")
    12. {
    13. //alert(command);
    14. doFromCommand(command);
    15. }else{
    16. //alert(command);
    17. }
    18. }
    19. //下面的代码是网页加载flash的钩子
    20. if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
    21. navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
    22. document.write('<SCRIPT LANGUAGE=VBScript\> \n');
    23. document.write('on error resume next \n');
    24. document.write('Sub myFlash_FSCommand(ByVal command, ByVal args)\n');
    25. document.write(' call myFlash_DoFSCommand(command, args)\n');
    26. document.write('end sub\n');
    27. document.write('</SCRIPT\> \n');
    28. }
    29. //调用android的函数,runJs2Activity是Android代码定义的函数,<span style="font-family: Arial, Helvetica, sans-serif;">playerJs是Android中定义该类的别名,</span><span style="font-family: Arial, Helvetica, sans-serif;">目的是获得flash传来的数据</span>
    30. function doFromCommand(command){
    31. window.playerJs.runJs2Activity(command);
    32. }
    33. </script>
    34. </head>
    35. <body>
    36. <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
    37. codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=11,0,0,0"
    38. WIDTH="100%" HEIGHT="100%" id="myFlash">
    39. <PARAM NAME=movie VALUE="flash.swf">   <!--这里一堆代码是加载flash动画的-->
    40. <PARAM NAME=quality VALUE=high>
    41. <PARAM NAME=bgcolor VALUE=#CCCCCC>
    42. <param name="allowScriptAccess" value="always" />
    43. <param name="allowNetworking" value="all">
    44. <param name="allowFullScreen" value="true">
    45. <EMBED src="flash.swf" quality=high bgcolor=#CCCCCC  WIDTH="100%" HEIGHT="100%" NAME="myFlash" swLiveConnect="true" allowScriptAccess="always" allownetworking="all" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
    46. </OBJECT>
    47. <div id="show" style="color:#000000;font-size:30px;margin-left:50px" ></div>
    48. </body>
    49. </html>

    Android中定义的与thml交互的函数

    [java] view plain copy
    1. //类中类:定义js中调用的Android类
    2. lass RunJavaScript {
    3. public void runJs2Activity(String str) {
    4. strFromJs = str;
    5. mScriptHandler.removeCallbacks(mPlayerRunnable);
    6. mScriptHandler.postDelayed(mPlayerRunnable, 300);
    7. }

    Android中是Vebview加载html文件的,其中交互类的别名是这样定义的

    [java] view plain copy
    1. //给网页文件添加Android与JS交互函数的定义
    2. mWebView.addJavascriptInterface(new RunJavaScript(), "playerJs");

    下面是Android完整代码

    [java] view plain copy
    1. package com.ideal.swfplayer;
    2. /************************
    3. *用来加载flash.html文件*
    4. ************************/
    5. import java.io.File;
    6. import java.util.Timer;
    7. import java.util.TimerTask;
    8. import sunvision.database.DBOperation;
    9. import sunvision.dialog.MatchDialog;
    10. import sunvision.dialog.TipDialog;
    11. import sunvision.dialog.VersionDialog;
    12. import sunvision.file.FileOperation;
    13. import sunvision.tools.FlashPath;
    14. import sunvision.tools.IdealSystemProperties;
    15. import android.annotation.SuppressLint;
    16. import android.app.Activity;
    17. import android.content.Intent;
    18. import android.graphics.Bitmap;
    19. import android.os.Build;
    20. import android.os.Bundle;
    21. import android.os.Handler;
    22. import android.os.Message;
    23. import android.os.SystemClock;
    24. import android.util.Log;
    25. import android.view.Gravity;
    26. import android.view.KeyEvent;
    27. import android.view.LayoutInflater;
    28. import android.view.MotionEvent;
    29. import android.view.View;
    30. import android.view.ViewGroup;
    31. import android.view.WindowManager;
    32. import android.webkit.WebChromeClient;
    33. import android.webkit.WebSettings;
    34. import android.webkit.WebSettings.PluginState;
    35. import android.webkit.WebView;
    36. import android.webkit.WebViewClient;
    37. import android.widget.FrameLayout;
    38. import android.widget.ImageView;
    39. import android.widget.TextView;
    40. import android.widget.Toast;
    41. public class MainFlashActivity extends Activity {
    42. private WebView mWebView = null;
    43. private FrameLayout mFrameLayout = null;
    44. private ImageView mImageView = null;
    45. private Timer mTimer = null;
    46. private Timer mTimer2 = null;
    47. private WebSettings settings;
    48. private String strFromJs = "";
    49. private String TAG = "SwfPlayer";
    50. private int mLoadingIndex = 0;
    51. private int mWebViewLoadTimes = 0;
    52. private int versionloadtime=0;
    53. private MatchDialog mDialogManager;
    54. private Handler mHandler = null;
    55. private FileOperation mFileUnit;
    56. private boolean isversionup=true;
    57. Handler mScriptHandler = new Handler() {};
    58. //加载驱动
    59. public native void native_initPlayer( ) throws Exception;
    60. public native void native_prepare() throws Exception;
    61. public native void native_start();
    62. public native void native_finish();
    63. @Override
    64. public void onCreate(Bundle savedInstanceState) {
    65. super.onCreate(savedInstanceState);
    66. setContentView(R.layout.activity_flash);
    67. //初始化UI界面
    68. InitUI();
    69. //加载主界面
    70. loadSwf(FlashPath.MainPath);
    71. //等待消息传过来更新界面
    72. //mHandler.post(task);  //启动定时器1秒刷新一次
    73. mHandler = new Handler() {
    74. @SuppressLint("Recycle")
    75. public void handleMessage(Message msg) {
    76. Log.i(TAG, "PlayerActivity-mLoadingIndex==" + mLoadingIndex);
    77. switch (msg.arg1) {
    78. case 0:
    79. mImageView.setImageResource(R.drawable.flashloading);
    80. break;
    81. case 1:
    82. mTimer.cancel();
    83. mImageView.setVisibility(View.GONE);
    84. mImageView.destroyDrawingCache();
    85. mLoadingIndex = 0;
    86. break;
    87. case 6:
    88. mWebView.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(),SystemClock.uptimeMillis(),MotionEvent.ACTION_DOWN, mWebView.getLeft() + 5,mWebView.getTop() + 5, 0));
    89. mWebView.dispatchTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(),SystemClock.uptimeMillis(), MotionEvent.ACTION_UP,mWebView.getLeft() + 5, mWebView.getTop() + 5, 0));
    90. break;
    91. default:
    92. break;
    93. }
    94. super.handleMessage(msg);
    95. }
    96. };
    97. }
    98. //UI界面初始化函数
    99. private void InitUI() {
    100. mFileUnit = new FileOperation(getApplicationContext());
    101. mFileUnit.createFlashPlayerTrust();
    102. mFrameLayout = (FrameLayout) findViewById(R.id.player_frameLayout);
    103. mImageView = (ImageView) findViewById(R.id.swf_loading_img);
    104. mWebView = (WebView) findViewById(R.id.webView_show);
    105. }
    106. //加载Flash动画
    107. @SuppressLint({ "SetJavaScriptEnabled", "Recycle" })
    108. public void loadSwf(String swfPath) {
    109. //获得配置函数
    110. settings = mWebView.getSettings();
    111. //设置允许与js交互
    112. settings.setJavaScriptEnabled(true);
    113. //设置允许文件操作
    114. settings.setAllowFileAccess(true);
    115. //设置允许使用Adobe Flash播放视频
    116. settings.setPluginState(PluginState.ON);
    117. //设置加载方式是替换加载,而不是新页面加载
    118. settings.setLoadWithOverviewMode(true);
    119. //设置编码方式
    120. settings.setDefaultTextEncodingName("GBK");
    121. //设置透明背景
    122. mWebView.setBackgroundColor(0);
    123. //重写Flash加载辅助函数
    124. mWebView.setWebChromeClient(new WebChromeClient() {
    125. public void onShowCustomView(View view, int requestedOrientation,
    126. WebChromeClient.CustomViewCallback callback) {
    127. super.onShowCustomView(view, callback);
    128. //Android SDK版本
    129. if (Build.VERSION.SDK_INT >= 14) {
    130. if (view instanceof FrameLayout) {
    131. mFrameLayout.addView(view,new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT,Gravity.CENTER));
    132. mFrameLayout.setVisibility(View.VISIBLE);
    133. }
    134. }
    135. }
    136. @Override
    137. public void onHideCustomView() {
    138. super.onHideCustomView();
    139. }
    140. });
    141. //重写Flash加载主要函数
    142. mWebView.setWebViewClient(new WebViewClient() {
    143. @Override
    144. public boolean shouldOverrideUrlLoading(WebView view, String url) {
    145. view.loadUrl(url);
    146. return true;
    147. }
    148. //Flash启东时调用
    149. @Override
    150. public void onPageStarted(WebView view, String url, Bitmap favicon) {
    151. super.onPageStarted(view, url, favicon);
    152. mWebViewLoadTimes++;
    153. }
    154. //Flash加载完成之后调用
    155. @Override
    156. public void onPageFinished(WebView view, String url) {
    157. super.onPageFinished(view, url);
    158. //Flash加载之前会有一段时间是白屏,为了掩盖,让五张图片隔时刷新
    159. if (mWebViewLoadTimes == 1) {
    160. mTimer = new Timer();
    161. mTimer.schedule(new TimerTask() {
    162. @Override
    163. public void run() {
    164. Message msg = new Message();
    165. msg.what = 0;
    166. msg.arg1 = mLoadingIndex;
    167. mHandler.sendMessage(msg);
    168. mLoadingIndex++;
    169. }
    170. }, 0, 2000);
    171. //flash偶尔会失去焦点,让flash加载完成之后每隔2秒点击一次界面获得焦点
    172. mTimer2 = new Timer();
    173. mTimer2.schedule(new TimerTask() {
    174. @Override
    175. public void run() {
    176. Message msg = new Message();
    177. msg.what = 0;
    178. msg.arg1 = 6;
    179. mHandler.sendMessage(msg);
    180. }
    181. }, 0, 2000);
    182. } else if (mWebViewLoadTimes >= 2) {
    183. mWebViewLoadTimes = 0;
    184. String path = FlashPath.TIP_NO_FILE;
    185. Intent intent = new Intent(MainFlashActivity.this,NoFileFlashActivity.class);
    186. intent.putExtra("swfPath", path);
    187. startActivity(intent);
    188. MainFlashActivity.this.finish();
    189. }
    190. }
    191. });
    192. //给网页文件添加Android与JS交互函数的定义
    193. mWebView.addJavascriptInterface(new RunJavaScript(), "playerJs");
    194. //设置网页能够获得焦点
    195. mWebView.requestFocusFromTouch();
    196. mWebView.requestFocus();
    197. mWebView.setFocusable(true);
    198. //设置完毕之后加载Flash
    199. mWebView.loadUrl(swfPath);
    200. }
    201. //类中类:定义js中调用的Android类
    202. class RunJavaScript {
    203. public void runJs2Activity(String str) {
    204. strFromJs = str;
    205. mScriptHandler.removeCallbacks(mPlayerRunnable);
    206. mScriptHandler.postDelayed(mPlayerRunnable, 300);
    207. }
    208. }
    209. //类中接口:当js调用RunJavaScript时,新开辟线程处理消息,这里是接口
    210. Runnable mPlayerRunnable = new Runnable() {
    211. @Override
    212. public void run() {
    213. //文件操作行为
    214. if (strFromJs.equals("file1_open")||strFromJs.equals("file2_open")||strFromJs.equals("file3_open")||strFromJs.equals("file4_open")||strFromJs.equals("file5_open")||strFromJs.equals("file6_open") ) {
    215. File folder = new File("/mnt/external_sd/");
    216. //TF卡存在
    217. if(folder.length()>0){
    218. Intent intent = new Intent(MainFlashActivity.this,FileListActivity.class);
    219. intent.putExtra("filename", strFromJs);
    220. startActivity(intent);
    221. //TF卡不在
    222. }else{
    223. TipDialog mTipDialog = new TipDialog(MainFlashActivity.this, R.style.IdealDialog,R.drawable.no_tf_card,3);
    224. //设置背景透明度
    225. WindowManager.LayoutParams lp=mTipDialog.getWindow().getAttributes();
    226. lp.dimAmount=0.7f;
    227. mTipDialog.getWindow().setAttributes(lp);
    228. mTipDialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    229. mTipDialog.show();
    230. }
    231. }
    232. }
    233. };
    234. //加载Antivity是调用
    235. @SuppressLint("Recycle") @Override
    236. protected void onResume() {
    237. super.onResume();
    238. //flash在回到该Activity是能够继续播放
    239. try {
    240. mWebView.getClass().getMethod("onResume").invoke(mWebView, (Object[]) null);
    241. } catch (Exception e) {
    242. e.printStackTrace();
    243. }
    244. }
    245. //Activity停止时调用
    246. @Override
    247. protected void onPause() {
    248. super.onPause();
    249. //允许flash暂停播放
    250. try {
    251. mWebView.getClass().getMethod("onPause").invoke(mWebView, (Object[]) null);
    252. } catch (Exception e) {
    253. e.printStackTrace();
    254. }
    255. }
    256. //该Activity销毁时调用
    257. @Override
    258. protected void onDestroy() {
    259. super.onDestroy();
    260. mWebView.destroyDrawingCache();
    261. mWebView.destroy();
    262. try {
    263. mHandler.removeMessages(0);
    264. mTimer.cancel();
    265. } catch (Exception e) {
    266. }
    267. }
    268. }

    Android加载flash时有一些要注意的问题:Webview加载flash一开始会出现白屏,可以通过刷图的形式掩盖;刚加载完flash,它还无法获得Android用户的焦点事件,必须在代码里面模拟点击屏幕,才可以获得焦点;在运行flash的过程中可能会出现焦点丢失的情况,我的方案是每隔几秒点击屏幕一次;Android加载flash需要flash插件,必须确保插件装好了,但是。即使插件装好了也不能通信,必须要把要加载的flash的路径写到flash插件安装目录下的安全路径文件中,这点非常重要,如读者遇到该问题,需要帮助的话可在线留言~

flash数据交互的更多相关文章

  1. Flex数据交互之Remoting

    一 前言 Flex数据交互常用的有三种方式:WebService.HttpService以及Remoting. WebService方式已在这篇文章中给出,这篇文章主要讲解以Remoting方式进行数 ...

  2. Flex数据交互之Remoting[转]

    Flex数据交互之Remoting 一 前言 Flex数据交互常用的有三种方式:WebService.HttpService以及Remoting. WebService方式已在这篇文章中给出,这篇文章 ...

  3. Unity3D和网页数据交互的基本原理

    简介: 1.Unity3D的游戏引擎是和编辑器集成在一起的,所有它也是一个制作/开发平台. 2.Unity3D是使用JavaScript.C#作为核心脚本语言来驱动事个游戏引擎. 3.平台可以发布Ex ...

  4. Android客户端和服务器端数据交互

    网上有很多例子来演示Android客户端和服务器端数据如何实现交互不过这些例子大多比较繁杂,对于初学者来说这是不利的,现在介绍几种代码简单.逻辑清晰的交互例子,本篇博客介绍第四种: 一.服务器端: 代 ...

  5. 使用Jquery.AJAX方法和PHP后台数据交互小结

    使用jQuery的AJAX方法和后台PHP进行数据交互,交互采用的数据格式JSON格式. 我主要小小的总结了一下,我使用AJAX方法时候遇到一些小小的问题. 第一:在传递数据的时候,传输地址注意是否正 ...

  6. View与Control间的数据交互

    View与Control间的数据交互 1.ViewBag.Name ="Name1" 2.ViewData["VD"] = "view data&qu ...

  7. .net实现与excel的数据交互、导入导出

    应该说,一套成熟的基于web的管理系统,与用户做好的excel表格进行数据交互是一个不可或缺的功能,毕竟,一切以方便客(jin)户(qian)为宗旨. 本人之前从事PHP的开发工作,熟悉PHP的都应该 ...

  8. 无废话ExtJs 入门教程二十[数据交互:AJAX]

    无废话ExtJs 入门教程二十[数据交互:AJAX] extjs技术交流,欢迎加群(521711109) 1.代码如下: 1 <!DOCTYPE html PUBLIC "-//W3C ...

  9. JSP数据交互

    JSP数据交互   一.jsp中java小脚本 1.<% java代码段%> 2.<% =java表达式%>不能有分号 3.<%!成员变量和函数声明%>二.注释 1 ...

随机推荐

  1. 引用MinGW生成的.dll.a后出现的问题

    以前很少调用MinGW的运行时库,现在用到一个项目,用到了glib和gettext等. 遇到了一个问题,折腾了一个下午. gettext的运行时库之一是intl,MinGW只提供了.dll.a,于是参 ...

  2. MySQL数据库基础

    MySQL数据库基础 本文的所有操作是基于CMD环境,MySQL通过在命令行中输入SQL语句对数据库进行操作.配置问题可参考<打通MySQL的操作权限>中的内容,该文算是针对前期的环境配置 ...

  3. GitHub中开启二次验证Two-factor authentication,如何在命令行下更新和上传代码

    最近在使用GitHub管理代码,在git命令行管理代码时候遇到一些问题.如果开起了二次验证(Two-factor authentication两个要素认证),命令行会一直提示输入用户名和密码.查找了一 ...

  4. 共享表空间VS独立表空间

    基础概念:共享表空间 VS 独立表空间 [共享表空间] 又称为system tablespace系统表空间,a small set of data files (the ibdata files) . ...

  5. 自定义JpaUtil,快速完成Hql执行逻辑(一)

    这段时间学习Spring Data JPA功能模块.Java持久性API(简称JAP)是类和方法的集合,以海量数据关系映射持久并存储到数据库,这是由Oracle公司提供方案技术.在JAVA社区,深受爱 ...

  6. maven中的profile文件的解析

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  7. Yii2 给iOS App写推送的接口

    public function actionApns() { //手机注册时候返回的设备号,在xcode中输出的,复制过来去掉空格 $deviceToken = '7217a01836349b194b ...

  8. Eclipse 安装 SVN 插件的两种方法

    eclipse里安装SVN插件,一般来说,有两种方式: 直接下载SVN插件,将其解压到eclipse的对应目录里 使用eclipse 里Help菜单的“Install New Software”,通过 ...

  9. ContentProvider工作过程

    ContentProvider启动过程(通过query方法触发) ContentProvider.acquireProvider--> ApplicationContentResolver.ac ...

  10. Selenium里可以自行封装与get_attribute对应的set_attribute方法

    我们在做UI自动化测试的过程中,某些情况会遇到,需要操作WebElement属性的情况. 假设现在我们需要获取一个元素的title属性,我们可以先找到这个元素,然后利用get_attribute方法获 ...