这可能是一个非常微不足道的问题,但我无法通过网络搜索引擎或php.net找到答案.如果您没有时间解释,请告诉我我可以阅读的内容.
问题
Map <String,String>属性的摘要序列化(摘录):
{
"attributes": {
"entry": [
{
"key": "operating system",
"value": "GNU/Linux"
},
{
"key": "allergies",
"value": "weed"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
用于反序列化的POJO:
class Contact implements Comparable<Contact>, Serializable {
@JsonProperty("attributes")
private Map<String, String> attributes;
...
}
Run Code Online (Sandbox Code Playgroud)
导致此异常:
Thread-4889 An exception occurred during request network execution :Could not read JSON: Can not deserialize instance of java.lang.String out of START_ARRAY token
at [Source: libcore.net.http.FixedLengthInputStream@43822760; line: 1, column: 17] (through reference chain: com.example.model.Contact["attributes"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Can …Run Code Online (Sandbox Code Playgroud) 我是MVC模式的新手,但一直试图掌握它,例如通过阅读我想尝试的CakePHP框架的文档.但是,现在我偶然发现了一个我不确定如何处理的场景.
我正在处理的网站包含九个固定页面,也就是说,除了那些页面之外,永远不会存在任何其他页面.每个页面都包含特定的内容,例如访客留言页面包含留言簿备注.但是,此外,每个页面都有一个小的新闻框和一个管理员应该能够编辑的简短的事实框.从我的角度来看,那些应该被视为模型,例如NewsPost和ShortFact,属于控件NewsPostController和ShortFactController.请注意,它们彼此完全无关.
现在,我的问题是,如何创建包含留言簿备注以及新闻邮箱和短暂事实的单一视图(网页)?我是:
为留言簿设置一个唯一的控制器GuestBookController(带有index()动作),以便访问www.domain.com/guest_book让索引操作获取最新的新闻帖子和随机的短暂事实?
将静态页面放在/ pages /中让PagesController进行提取?
<请在这里填写正确的方法.>
提前致谢!