gpt4 book ai didi

java - Android Webview可以运行JSP吗?

转载 作者:行者123 更新时间:2023-12-02 11:42:49 24 4
gpt4 key购买 nike

这是我的 logcat,我不知道为什么我的网络系统无法在 webview 上加载:

01-24 11:47:45.907 12101-12223/ews.sys.mobile_portal_do_professorW/cr_CrashFileManager:/data/user/0/ews.sys.mobile_portal_do_professor/cache/WebView/Crash Reports does not exist or is not a directory 01-24 11:47:46.020 3370-3410/? D/ActivityTrigger: ActivityTrigger activityStopTrigger 01-24 11:47:46.045 671-671/? W/SurfaceFlinger: couldn't log to binary event log: overflow. 01-24 11:47:46.159 12101-12101/ews.sys.mobile_portal_do_professor I/chromium: [INFO:CONSOLE(6)] "Uncaught SyntaxError: Unexpected end of input", source: http://177.154.128.149:8080/ews/index.jsp (6)

那是我的 webview 类:

 private android.webkit.WebView wv;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.portal_do_aluno);

wv = (android.webkit.WebView) findViewById(R.id.webView);


wv.setWebViewClient(new WebViewClient());

WebSettings ws = wv.getSettings();
ws.setJavaScriptEnabled(true);




wv.loadUrl("http://177.154.128.149:8080/ews/index.jsp");

最佳答案

如果我加载你的网址,我会得到一个格式错误的 HTML 文档:

开始于

</head>

它包含不正确的 javascript(没有结束分号),我怀疑它是错误所述的后者(第 6 行对应于警报语句):

<script language="JavaScript">
alert(navigator.appName);
if(navigator.appName!='Microsoft Internet Explorer'){
alert('NAVEGADOR NÃO INDICADO!\nO Navegador que você está usando não é o adequado para a visualização desse site.\nEste site foi projetado para ser visualizado com Microsoft Internet Explorer, versão 6 ou superior');
</script>

某些浏览器会尝试纠正该问题并读取您的 HTML/js,而其他浏览器(例如 Android 的 WebViewClient)将会失败。

关于java - Android Webview可以运行JSP吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48424113/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com