本文将带您了解关于java–EclipseDynamicWebProject如何组织文件?的新内容,同时我们还将为您解释eclipse创建文件夹项目分组的相关知识,另外,我们还将为您提供关于'Wher
本文将带您了解关于java – Eclipse Dynamic Web Project如何组织文件?的新内容,同时我们还将为您解释eclipse创建文件夹 项目分组的相关知识,另外,我们还将为您提供关于'WhereIterable的实用信息。
本文目录一览:- java – Eclipse Dynamic Web Project如何组织文件?(eclipse创建文件夹 项目分组)
- 'WhereIterable
>' 不是类型 'List >' 的子类型 - '_InternalLinkedHashMap
' 不是类型转换中类型 'Map ' 的子类型 - c# json 转换成 dynamic 对象,然后在 dynamic 对象中动态获取指定字符串列表中的值
- Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer
java – Eclipse Dynamic Web Project如何组织文件?(eclipse创建文件夹 项目分组)
我应该将我的HTML页面放在WebContent中吗?我在哪里放置JSP和servlet源文件?全球遵循什么样的惯例?
这是eclipse提供的模板结构
>部署描述符
> JavaScript资源
> WebContent
> ECMAScript内置库
> ECMA 3浏览器支持库
> src
> JRE系统库
> Apache Tomcat v8
> Web App库
> EAR图书馆
>构建
> WebContent
> meta-inf
> WEB-INF
> lib
解决方法
Eclipse帮助页面referenced by android-weblineindia声明WebContent是:
The mandatory location of all Web resources,including HTML,JSP,graphic files,and so on. If the files are not placed in this directory (or in a subdirectory structure under this directory),the files will not be available when the application is executed on a server. The Web content folder represents the contents of the WAR file that will be deployed to the server. Any files not under the Web content folder are considered development-time resources (for example,.java files,.sql files,and .mif files),and are not deployed when the project is unit tested or published.
所以浏览器所需的CSS文件和JS文件也应该放在这里.
将java源文件(包括servlet源)放在src目录中.相同的帮助页面为源目录指出了这一点(虽然它表明它被称为JavaSource,看起来像文档中的错误):
Contains the project’s Java source code for classes,beans,and servlets. When these resources are added to a Web project,they are automatically compiled and the generated files are added to the WEB-INF/classes directory. The contents of the source directory are not packaged in WAR files unless an option is specified when a WAR file is created.
如果你看项目属性 – >部署程序集您应该看到从src编译的文件部署到WEB-INF / classes,WebContent中的文件部署到WAR文件的根目录
'WhereIterable>' 不是类型 'List>' 的子类型
如何解决''WhereIterable<Map<dynamic, dynamic>>'' 不是类型 ''List<Map<dynamic, dynamic>>'' 的子类型
有人请帮忙...我快被这个气疯了!
如果我有:
void main() {
List<Map> people = [];
people.add({''name'': ''Patrick'',''age'': 56});
people.add({''name'': ''Jeannette'',''age'': 55});
print(people.where((person) => person[''name''] == ''Patrick''));
}
正如预期的那样,输出是: ({姓名:帕特里克,年龄:56})
但是如果我把 where 放在一个类中,就像这样:
class People {
List<Map> people = [];
void add(Map data) {
people.add(data);
}
List<Map> get filtered {
return people.where((m) => m[''name''] == ''Patrick'');
}
}
void main() {
People people = People();
people.add({''name'': ''Patrick'',''age'': 55});
print(people.filtered);
}
我得到:
未处理的异常:
类型 ''WhereIterable
'_InternalLinkedHashMap' 不是类型转换中类型 'Map' 的子类型
如何解决''_InternalLinkedHashMap<dynamic, dynamic>'' 不是类型转换中类型 ''Map<String, dynamic>'' 的子类型
我有这个通用函数:
ValueType get<ValueType>(String keyToRead) {
try {
return _dataClient.get(keyToRead) as ValueType;
} on SocketException catch (error) {...
我这样称呼它:
@override
Map<String,dynamic> getUserRegistration() {
return dataClient.get<Map<String,dynamic>>(UserRegistrationFieldKeys.self);
}
但是由于我将 _dataClient 使用 get_storage 框更改为 hive 框,因此我收到此错误:
The following ProviderException was thrown building LoggedOutPageView(dirty,dependencies: [UncontrolledProviderScope],state: _ConsumerState#6c90b):
An exception was thrown while building AutodisposeProvider<Registerviewmodel>#00006().
Thrown exception:
type ''_InternalLinkedHashMap<dynamic,dynamic>'' is not a subtype of type ''Map<String,dynamic>'' in type cast
Stack trace:
#0 LocalDataClient.get
package:vepo/…/data_clients/local_data_client.dart:51
#1 UserRegistrationLocalDataSource.getUserRegistration
package:vepo/…/user_registration/user_registration_local_data_source.dart:22
#2 UserRegistrationRepository.getUserRegistration
package:vepo/…/user-registration/user_registration_repository.dart:31
Hive 必须将数据存储为不同的格式,这可能是由于加密的原因,但我该如何解释并消除此错误?
解决方法
尝试使用
Map<String,dynamic>.from(dataClient.get(UserRegistrationFieldKeys.self))`;
如果你使用它,你也可以删除泛型函数。
,这是因为您的 _dataClient.get(keyToRead)
函数返回 _InternalLinkedHashMap<dynamic,dynamic>
数据类型。当您像这样为函数的输出分配类型 Map<String,dynamic>
时:dataClient.get<Map<String,dynamic>>()
,这意味着您期望函数的输出是 Map 而不是,从而导致错误。
在这种情况下,您应该在获得该函数的输出后进行类型转换,例如:
@override
Map<String,dynamic> getUserRegistration() {
return Map<String,dynamic>.from(dataClient.get(UserRegistrationFieldKeys.self));
}
c# json 转换成 dynamic 对象,然后在 dynamic 对象中动态获取指定字符串列表中的值
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
string ss = TestAA();
Console.WriteLine(ss);
Console.ReadKey();
}
private static string TestAA()
{
string allowAttr = string.Empty;
string json = "{\"UserName\":\"Jack\",\"LoS\":\"Beijing\",\"Group\":\"34\"}";
// 此处模拟在不建实体类的情况下,反转将 json 返回成 dynamic 对象
var DynamicObject = JsonConvert.DeserializeObject<dynamic>(json);
//var _value = DynamicObject["LoS"];
List<string> ssList = new List<string>();
ssList.Add("LoS");
ssList.Add("Test2");
foreach(string item in ssList)
{
var value2 = DynamicObject [item];// 动态获取字符串列表中的字段去 dynamic 对象中找对应字段的值
if(value2!=null)
{
allowAttr = string.Format("{0}{1}", value2, "_Attribute");
//string allowAttr2 = string.Format("{0}{1}", value2.Value, "_Attribute");
}
}
return allowAttr;
//Console.WriteLine(DynamicObject.LoS);
//Type Ts = DynamicObject.GetType();
//object o = Ts.GetProperty("Name").GetValue(DynamicObject, null);
//string Value = Convert.ToString(o);
//if (string.IsNullOrEmpty(Value))
//{
// return null;
//}
//else
//{
// return Value;
//}
}
}
}
Eclipse Maven 编译错误 Dynamic Web Module 3.0 requires Java 1.6 or newer
处理办法
第一在 pom.xml 中添加如下代码 <build> </build > 包含的代码块
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>comstudy.shiro</groupId>
<artifactId>shiro</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<!-- 解决新建Maven web项目 报红叉问题 start-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<!-- end -->
</project>
第二种办法:选择如图的选项
最后:项目右击–>Maven–>Update Project Configuration,红叉即消失。
今天的关于java – Eclipse Dynamic Web Project如何组织文件?和eclipse创建文件夹 项目分组的分享已经结束,谢谢您的关注,如果想了解更多关于'WhereIterable
本文标签: