我有 JSF UI 应用程序,我想显示翻译的国家/地区名称。
我正在使用 Java Locale 获取国家/地区名称。但无法得到我的翻译要求。Java 1.6 Locale 仅提供 44 个独特的国家/地区。
Locale[] localeArray = Locale.getAvailableLocales();
System.out.println("localeArray---->"+localeArray.length);
for (Locale locale : localeArray) {
counter++;
System.out.print("locale-->"+locale+"-------");
System.out.print("locale getISO3Language-->"+locale.getISO3Language());
System.out.println("-----locale.getDisplayCountry(locale)--->"+locale.getDisplayCountry(locale));
System.out.println("-----locale.getDisplayCountry()--->"+locale.getDisplayCountry());
System.out.println("-----locale.getCountry()--->"+locale.getCountry());
System.out.println("----------------------------------------------------"+counter);
}
Run Code Online (Sandbox Code Playgroud)
请让我们知道如何执行我的要求?
Oracle 文档提供链接。
除了 Java 之外,是否还有其他可用的库来执行强大的语言环境特定要求?
当我创建angular 2应用程序时,我得到了错误.我按照链接创建示例应用程序.我跑的时候
npm start
Run Code Online (Sandbox Code Playgroud)
我有吼声错误,
events.js:154
throw er; // Unhandled 'error' event
^
Error: watch node_modules/weinre/web/weinre/target/WiRuntimeImpl.amd.js ENOSPC
at exports._errnoException (util.js:856:11)
at FSWatcher.start (fs.js:1313:19)
at Object.fs.watch (fs.js:1341:11)
at createFsWatchInstance (/home/mts/project/testSails1/frontend/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/mts/project/testSails1/frontend/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/mts/project/testSails1/frontend/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleFile (/home/mts/project/testSails1/frontend/node_modules/chokidar/lib/nodefs-handler.js:255:21)
at FSWatcher.<anonymous> (/home/mts/project/testSails1/frontend/node_modules/chokidar/lib/nodefs-handler.js:473:21)
at FSReqWrap.oncomplete (fs.js:82:15)
Run Code Online (Sandbox Code Playgroud)
我有这样的npm日志,
npm
ERR! Linux 3.19.0-51-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lite"
npm ERR! node v5.6.0
npm ERR! npm v3.8.0
npm ERR! code ELIFECYCLE
npm ERR! frontend@1.0.0 lite: `lite-server`
npm ERR! Exit status 1 …Run Code Online (Sandbox Code Playgroud) 我的问题是我想将一个xml文件从服务器返回给客户端并使用jquery的jjax函数解析它.这是代码:
客户:
$("#submit").click(function(){
$.ajax({
type: "POST",
url: "search.php",
data: "whatever",
dataType: "xml",
async: false,
success: function(xml){
var data = $('doctor',xml).text();
alert(data);
}
});
});
Run Code Online (Sandbox Code Playgroud)
服务器(php文件),
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="utf-8"?>';
echo "<tables>";
echo "<doctor>Someone</doctor>";
echo "</tables>";
Run Code Online (Sandbox Code Playgroud)
我有一个空白的警报,我不知道为什么?
//some code
include("other.php");
//some other code
Run Code Online (Sandbox Code Playgroud)
other.php文件是我上面发布的文件.我剪切/粘贴标题,以便最终的php文件
//some code
header('Content-type: text/xml');
include("other.php");
//some other code
Run Code Online (Sandbox Code Playgroud)
和其他.php
echo '<?xml version="1.0" encoding="utf-8"?>';
echo "<tables>";
echo "<doctor>Someone</doctor>";
echo "</tables>";
Run Code Online (Sandbox Code Playgroud)
现在它完美无缺.谢谢你的快速回复!
如果我们可以在javascript函数中调用java,请告诉我?
<HTML><HEAD></HEAD><BODY>
<SCRIPT>
function getScreenDimension() {
<% System.out.println("Hiiiiiiiii"); %>
}
</SCRIPT>
<FORM>
<INPUT type="button" value="call Java method direct" onClick = "getScreenDimension()">
</FORM>
</BODY></HTML>
Run Code Online (Sandbox Code Playgroud) 我开发了 RestEasy Web 服务(我用于开发 Web 服务的 maven/java/tomcat)然后我得到了消息无法使用这样的内容类型。为什么我得到这样的错误,
2015-10-19 17:55:02,823 [http-nio-8080-exec-10] WARN org.jboss.resteasy.core.ExceptionHandler - failed to execute
javax.ws.rs.NotSupportedException: Cannot consume content type
at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:380)
at org.jboss.resteasy.core.registry.SegmentNode.match(SegmentNode.java:114)
at org.jboss.resteasy.core.registry.RootNode.match(RootNode.java:43)
at org.jboss.resteasy.core.registry.RootClassNode.match(RootClassNode.java:48)
at org.jboss.resteasy.core.ResourceMethodRegistry.getResourceInvoker(ResourceMethodRegistry.java:444)
at org.jboss.resteasy.core.SynchronousDispatcher.getInvoker(SynchronousDispatcher.java:234)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:171)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1526)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1482)
at …Run Code Online (Sandbox Code Playgroud) 需要检查$ message长度是否为7个字符或更少,如果是,请执行操作A,如果不是,请执行操作B.这是正确的语法吗?我觉得我做错了什么?
<?php
if (strlen($message) <= 7) {
echo $actiona;
} else {
echo $actionb;
}
?>
Run Code Online (Sandbox Code Playgroud) 我想将php变量值作为动作传递给html表单.我正在尝试如下,但它不起作用.
<?php
$url='test.php';
?>
<html>
<body>
<form name="upload" action="<?=$url?>" method="post" >
<input type="submit" value="submit">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
所有这些代码都在一个php文件中.
参考标题.我有一个我编码的数组: -
$query = "SELECT * FROM server";
$result = mysql_query($query);
$dServer = array();
while($row = mysql_fetch_assoc($result)) {
$dServer[] = $row['model'];
}
Run Code Online (Sandbox Code Playgroud)
现在,如何将$ dServer数组传递给Javascript数组?
例如,这个数组:
var a = new Array();
Run Code Online (Sandbox Code Playgroud) 我试图通过单击表单按钮填充表单上的文本框.下面是我到目前为止的代码 - 从选择框示例修改此代码 -
<!DOCTYPE html>
<html>
<head>
<script>
function moveNumbers(){
var no=document.getElementById("no");
var txt=document.getElementById("result").value;
txt=txt + option;
document.getElementById("result").value=txt;
}
</script>
</head>
<body>
<form>
Select numbers:<br>
<input type="button" value="1" name="no" onclick="moveNumbers()">
<input type="button" value="2" name="no" onclick="moveNumbers()">
<input type="button" value="3" name="no" onclick="moveNumbers()">
<input type="text" id="result" size="20">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我有一个使用Yeoman Generator Angular Fullstack生成器生成的 MEAN 堆栈应用程序。您只能通过登录来访问该网站。
EnsureLoggedIn 的存储库在这里
注销时,如果我尝试导航到“/products”,我会被重定向到“/login”。但是,当 url 为“/”或什至“localhost:9000”且不带斜杠时,我在重定向未登录的用户时遇到问题。
如果我没有登录,在登录屏幕上,我将“/login”修改为“/”或“”,我会被发送到 AngularJS 中的“main”并被视为已登录(我假设是因为它识别会话?)并能够单击“/products”或“/users”的链接。
我当前的routes.js 如下所示:
/**
* Main application routes
*/
'use strict';
var errors = require('./components/errors');
var auth = require('./controllers/auth');
var passport = require('passport');
var ensureLoggedIn = require('connect-ensure-login').ensureLoggedIn;
module.exports = function(app) {
// Insert routes below
// All undefined asset or api routes should return a 404
app.route('/:url(api|auth|components|app|bower_components|assets)/*').get(errors[404]);
app.route('/login').get(auth.login).post(auth.loginUser);
app.route('/logout').get(auth.logout);
// All other routes should redirect to the index.html
app.all('*', ensureLoggedIn('/login'));
app.route('/*').get(function(req, res) {
res.sendfile(app.get('appPath') + …Run Code Online (Sandbox Code Playgroud) javascript ×3
php ×3
html ×2
java ×2
ajax ×1
angular ×1
angularjs ×1
content-type ×1
express ×1
httpresponse ×1
jquery ×1
locale ×1
maven ×1
node.js ×1
npm ×1
passport.js ×1
resteasy ×1
return ×1
types ×1
xml ×1