我在Java Web应用程序(JSF1.2,RichFaces)中创建了一些"保存"bean功能.它使用JAXB将其转换为XML字符串,然后将其存储在数据库中.如果用户将其加载回来,我想通知用户是否更改了(bean)内容并且应该再次保存.
我的想法是覆盖hashCode()'with'函数org.apache.commons.lang.builder.HashCodeBuilder,但是我有很多字段和子元素.有没有其他方法来处理这种功能?
编辑
"比较"是在另一个视图上完成的!
任何帮助,将不胜感激!
有时我发现自己多次重复选择器.我应该以某种方式将jquery对象存储到变量然后只使用那个?作为一个简单的例子,以下是什么?:
$('a.contactus').css('padding', '10px');
$('a.contactus').css('margin', '4px');
$('a.contactus').css('display', 'block');
Run Code Online (Sandbox Code Playgroud)
现在我知道这不是一个很好的例子,因为有效地你可以链接每个css函数.但是假设每一个都是条件性陈述或某些东西阻止你链接.
我可以在变量中存储jquery对象吗?如果是这样,我什么时候可以?
我在配置OpenLDAP服务器时遇到了严重问题,无法启用memberOf覆盖.我正在使用Ubuntu 11.04并从标准的apt-get repo安装我的slapd.所有说明都是指编辑slapd.conf文件,但我使用的是更高版本的OpenLDAP,它使用动态配置而不是旧的静态文件.
我不确定文档是否只是没有更新,或者是否有一些配置文件我打算填写?
我有一个方法,返回格式化的XML字符串.我想以一种很好的包装,可读的方式在JSF页面上显示它.我先用这个解决方案.
<pre><h:outputText value="myBean.xml"/></pre>
Run Code Online (Sandbox Code Playgroud)
结果是缩进的,但它不会包含很长的行(例如,有很多属性)
RichFaces也可以在我的项目中使用.你会建议什么?
谢谢,丹尼尔
我的问题是RichFaces reRender不能在元素树中的当前元素下"工作"; 只有上层元素才会被重新渲染.
有没有办法用AJAX访问下层元素?
任何帮助,将不胜感激!丹尼尔
编辑我把这个问题编辑成更普遍的问题.如果对原始问题感兴趣,请参阅修订版.
这是Uni的一个非常基本的程序,它将用户数据写入文件.我已经清楚地遵循了说明,但它似乎没有将数据输出到文件中.它只是创建一个空文件.我正在使用Ubuntu,如果这有所不同.
import java.util.Scanner;
import java.io.*;
/**
This program writes data to a file.
*/
public class FileWriteDemo
{
public static void main(String[] args) throws IOException
{
String fileName; // File name
String friendName; // Friend's name
int numFriends; // Number of friends
// Create a Scanner object for keyboard input
Scanner keyboard = new Scanner(System.in);
// Get the number of friends
System.out.print("How many friends do you have? ");
numFriends = keyboard.nextInt();
// Consume the remaining new line character
keyboard.nextLine();
// …Run Code Online (Sandbox Code Playgroud) 我的JSF Web应用程序使用PrimeFaces Captcha.它在Firefox和IE下正常运行,但在Chrome下无法显示.我在页面生成时没有出现任何错误,但如果我尝试使用隐形Captcha发布数据,则会显示以下错误消息:
j_idt25:j_idt32: Validation Error: Value is not valid.
Run Code Online (Sandbox Code Playgroud)
XHTML源代码中没有id为'j_idt32'的元素.我用两个浏览器检查过这个.
任何帮助将不胜感激,提前谢谢!丹尼尔
我在GlassFish 3.1.2.2上设置了一个CAS 3.5.2服务器,现在我正在尝试使用Spring Security 3.2.0通过官方文档来保护使用CAS的Jersey REST Web服务.我的配置:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>springtest</display-name>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<!-- - Location of the XML file that defines the root application context
- Applied by ContextLoaderListener. -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext-security.xml
</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>cas.root</param-value>
</context-param>
<!-- Include the character encoding Filter as per JASIG recommenation when
doing Single Sign Out https://wiki.jasig.org/display/CASC/Configuring+Single+Sign+Out -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param> …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Java Swing更新mysql记录.似乎MySql Update语句存在一些问题.我已粘贴代码如下:
conDBase = getConnection();
stmt = conDBase.createStatement();
String sql = "update user set role = " + jComboBox1.getSelectedItem()+ "where userID =" + jComboBox2.getSelectedItem();
stmt.executeUpdate(sql);
conDBase.close();
JOptionPane.showMessageDialog(null, "User Role Updated");
this.dispose();
new Admin().setVisible(true);
Run Code Online (Sandbox Code Playgroud) 我的html视图.htgroup在屏幕上显示文件的内容,例如:
download: user1 user2 user3
movies: test test2 user1 user2 user3
Run Code Online (Sandbox Code Playgroud)
我想将组名称(download和movies)封装在<strong>标记中,以便它们在浏览器中显示为粗体.我怎么能在PHP5中这样做?我确信有一种优雅的方式来实现这个功能preg_replace(),但我在正则表达式上非常糟糕.
行分隔符是\n.