想象一个JSF页关于若干组件,如<h:selectOneMenu>,<h:dataTable>,<h:panelGrid>等.每个部件都有一个ID.是否有任何方法或技术可以在调用bean的构造函数时以编程方式获取组件?
我想为我的会话生成唯一的会话ID.所以我使用了UUID.在这里我做了什么
if (session == null) {
session = httpServletRequest.getSession(true);
session.setAttribute("logedin", "0");
if (!httpServletRequest.isRequestedSessionIdFromCookie()) {
UUID sessionID = UUID.randomUUID();
Cookie sessionCookie = new Cookie("JSESSIONID", "sessionID"); //problem
}
Run Code Online (Sandbox Code Playgroud)
Cookie构造函数接受两个字符串,如何将我的UUID转换为字符串,以便获取唯一的UUID值?谢谢
我想问一下我是否将我的托管bean放在会话范围内,然后将它存储在会话中"就像我有这样的bean一样
@ManagedBean
@SessionScoped
public class SessionScopedBean implements Serializable {
.......
} //end of class SessionScopedBean
Run Code Online (Sandbox Code Playgroud)
然后它存储在会话中,在我的会话期间我可以使用它
session.getAttribut("SessionScopedBean");
Run Code Online (Sandbox Code Playgroud)
这将给我SessionScopedBean对象,当会话将被销毁时,我将得到null.现在我想问一下我的bean是否在视野范围内,那我怎么能得到它.喜欢
@ManagedBean
@ViewScoped
public class ViewScopedBean implements Serializable {
.......
} //end of class ViewScopedBean
Run Code Online (Sandbox Code Playgroud)
现在如果视图是持久化的,那么这个bean处于视图状态,当视图发生变化时,这个bean将会被破坏.现在我想问一下,如果视图仍然存在,我怎样才能从视图状态获取这个bean.喜欢
view.getAttrubute("ViewScopedBean"); //just a code. No actual implementation.
Run Code Online (Sandbox Code Playgroud)
谢谢
我有一个页面

我想打印这个页面.在打印按钮我使用这样的东西
<input id="print" type="submit" onclick="window.print();" />
Run Code Online (Sandbox Code Playgroud)
但问题是它不是打印整个页面.就像它只打印当前在视图中一样.当我点击打印按钮然后Email:tahir@7-cs.com打印页面.它不会打印滚动条下方的文本.

如何打印整个文本.就像假设我有一个非常大的页面,我使用选项卡来容纳我的页面.当点击打印按钮,然后我想包括整个页面,包括选项卡.我该怎么做?
谢谢
我正在验证用户
public static boolean login(DataManager dataManager, String userName, String password) {
boolean authenticated = false;
Connection connection = dataManager.getConnection();
if (connection != null) {
try {
Statement s = connection.createStatement();
String sql = "query";
try {
ResultSet rs = s.executeQuery(sql);
try {
while (rs.next()) {
String group_code = rs.getString(1);
String orgaunit = rs.getString(2);
authenticated = true;
} //end of while()
} finally {
rs.close();
}
} finally {
s.close();
}
} catch(SQLException e) {
//System.out.println("Could not login from dataabse:" + …Run Code Online (Sandbox Code Playgroud) 我需要什么配置才能通过spring发送HTTP post请求.我使用的是java应用程序,它不是一个Web项目.我可以使用spring发送HTTP post请求吗?我谷歌它,但几乎所有的例子都使用spring MVC.我可以使用spring发送HTTP post请求吗?
我在网上发现了这个豆子,但我不知道该怎么办.我使用的是spring3.2,这个帖子我认为是2008年...
<bean id="httpClient" class="org.springbyexample.httpclient.HttpClientTemplate">
<property name="defaultUri">
<value><![CDATA[http://localhost:8093/test]]></value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
有什么建议?
我有一个登录表单如下.
<li class="loginlink">
<a id="showlogin" href="#">
<span style="color: #666666">Login</span>
</a>
<div class="loginbox" style="display: block;">
<fieldset>
<label>User Name : </label>
<input id="input" type="text" value="" name="input">
</fieldset>
<label>
<span style="display: inline-block; ...;"> Password :</span>
</label>
<input id="password_txt" type="password" style="padding:5px;..;"
value="" name="password_txt">
<p>
<a class="loginlink" onclick="mojarra.jsfcljs(document.getElementById('headerForm'),
{'j_idt60':'j_idt60'},'');return false" style="color: #666666;.."
href="#">Forgot Password?
</a>
<a class="loginlink" onclick="mojarra.jsfcljs(document.getElementById('headerForm'),
{'j_idt63':'j_idt63'},'');return false" style="..."
href="#">Register
</a>
</p>
<div class="loginbuttons">
<input id="loginBtn" type="submit" value="Login" name="loginBtn">
<input id="cancellogin" type="button" value="Cancel">
</div>
</div>
</li>
Run Code Online (Sandbox Code Playgroud)
当您单击showlogin时.我用jQuery来显示它.喜欢
$('#showlogin').click(function(){
var loginBox = …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个视图,但我收到一个重复的列名错误.如果我单独运行select查询,则查询返回如下结果:
SELECT distinct app.APP_REF_NO, app.APP_STATUS, app.APP_DT, app.ATTEND_STAFF,
app.ATTEND_BRANCH, app.PRODUCT_TYPE, cust.CUST_ID,
cust.APP_JOINT_T, cust.ID1_TYPE, cust.ID1, cust.ID2_TYPE,
cust.ID2, cust.FIRST_NAME, cust.LAST_NAME, cust.FULL_NAME,
cust.FULL_NAME_CAP, cust.DOB, fac.FACILITY_NO, fac.PRODUCT_TYPE,
fac.PRODUCT_CODE, fac.MAIN_PROD_IND, fac.AMT_APPLIED
FROM
LOSA_APP app
LEFT JOIN
LOSA_CUST cust
ON
cust.APP_REF_NO = app.APP_REF_NO
LEFT JOIN
LOSA_FACILITIES fac
ON
fac.APP_REF_NO = app.APP_REF_NO
LEFT JOIN
OS_CURRENTSTEP STEP
ON
STEP.REF_ID = app.APP_REF_NO
WHERE (app.APP_STATUS ='P' OR app.APP_STATUS ='T' OR
((app.APP_STATUS='R' OR app.APP_STATUS='S') AND STEP.STEP_NAME='011'));
Run Code Online (Sandbox Code Playgroud)
此查询工作正常.但当我尝试将其作为一个视图运行时:
CREATE VIEW basit_test1 AS
SELECT distinct app.APP_REF_NO, app.APP_STATUS, app.APP_DT, app.ATTEND_STAFF,
app.ATTEND_BRANCH, app.PRODUCT_TYPE, cust.CUST_ID,
cust.APP_JOINT_T, cust.ID1_TYPE, …Run Code Online (Sandbox Code Playgroud) 我刚刚在玻璃鱼上部署了一个应用程序.我做了什么,我做了一个目录结构.HelloWorld-> index.jsp,WEB-INF-> sun-web.xml,web.xml.我的index.jsp只是一个打印HelloWorld的页面
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<title>Hello World! Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
然后我去了HelloWorld目录并发出以下命令
jar cvf helloworld.war .
Run Code Online (Sandbox Code Playgroud)
war文件已创建.然后我使用管理控制台将应用程序部署到GlassFish.在我写的/ HelloWorld的上下文中.但后来我尝试使用http:// localhost:8080/HelloWorld /打开应用程序
然后我得到了错误
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
Run Code Online (Sandbox Code Playgroud)
我的路径环境设置为
;C:\Program Files\Java\jdk1.6.0_06\bin;C:\Program Files\glassfish-3.0.1\bin;
Run Code Online (Sandbox Code Playgroud)
我的classpath上有java,为什么我收到这个错误?我正在使用Windows 7.
谢谢
我在我的服务器上安装了JDK 7 update 5(64位)(服务器有64位Windows操作系统).设置环境路径.当我做java -version.我得到输出java version 1.7_0_05,但当我尝试安装玻璃鱼,然后我得到错误This application needs version 1.6 or higher of the Java (TM)2 Runtime Environment.我在环境路径上设置了JDK bin文件夹和JRE bin文件夹.为什么我得到这个?
谢谢