Is there any API I can use to create apps that use Bluetooth on PCs? I am not talking of the Java ME JSR 82 API. I need something which I can use with a bluetooth dongle. Thanks.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.text.DecimalFormat;
import com.sun.j3d.utils.timer.J3DTimer;
*in.youtube.com/comment_servlet?all_comments&v=GvctSMHHd7g&ytsession=p9A_Dz6f8kXK5uX7c4IxRXCHB9HQut1nIGY5pSuqgGeeKrFz1pYtma0JOAMlINEJELSf9R85VAbMqGZhLjBDGw-Jg8LGV1e2C3ZTLwiHnz5f7eHpk5aIrfFVkmJksyn4pw4ur6twt4OoW7N8aRmBD58Ft-kefWBBDA3BsU4PJ7IrnfR5Jd-HXVRcOI_fnGg1GAXU8k0OCbr-I024_h6l0AL3TaaGGAFdED_egjgErjDuWe3e_-R89fqmuZ8a8-hn-wnsNIl-O5BqZT26bLzr1wCK2f4V76Z_dO7xfKe7BQQ
package demo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface Permission {
String name();
}
package demo;
public class Main {
public static void main(String[] args) {
Demo demo = new Demo();
Permission permission = demo.getClass().getAnnotation(Permission.class);
System.out.println(permission.name());
}
}
@Permission(name = "ADMIN")
class Demo {
}
/**
* User Model
**/
public class User {
private String username;
private String password;
private int age;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
/**
* Action
**/
public class Login extends ActionSupport implements ModelDriven<User>{
private User user;
public User getModel() {
return user;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
// Acton
public String login (){
return "outcome";
}
}
<package name="user" extends="struts-default">
<action name="login"
class="com.desitek.cricket.action.Login">
<result name="input">index.jsp</result>
<result name="success">index.jsp</result>
<result>index.jsp</result>
</action>
</package>
<s:actionerror/> <s:actionmessage/>
<s:fielderror></s:fielderror>
<s:form action="login" theme="simple">
User Name
<s:textfield name="user.Username"></s:textfield>
Password: <s:textfield name="user.UserPassword"></s:textfield>
<s:submit value="login"></s:submit>
</s:form>
public class LoginAction {
private User user;
public User getModel() {
return user;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String login (){
return "outcome";
}
}
<managed-bean>
<managed-bean-name>login</managed-bean-name>
<managed-bean-class>com.desitek.cricket.action.LoginAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>login.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>index.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>login.jsp</to-view-id>
</navigation-case>
</navigation-rule>
javax.servlet.ServletException: /login.jsp(35,2) '#{user.user.username}' Target Unreachable, 'user' returned null
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
[B]root cause[/B]
org.apache.jasper.el.JspPropertyNotFoundException: /login.jsp(35,2) '#{user.user.username}' Target Unreachable, 'user' returned null
org.apache.jasper.el.JspValueExpression.getType(JspValueExpression.java:61)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
javax.faces.component.UIInput.validate(UIInput.java:860)
javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
javax.faces.component.UIInput.processValidators(UIInput.java:666)
javax.faces.component.UIForm.processValidators(UIForm.java:229)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1030)
javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
package com.desitek.cricket.action;
/**
* Action
**/
public class User {
private String username;
private String password;
private String email;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
package com.desitek.cricket.action;
public class LoginAction {
private User user;
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String login() {
System.out.println(user.getUsername());
return "success";
}
}
<f:view>
This is my JSF JSP page. <br>
<h:form>
Username
<h:inputText value="#{user.user.username}"></h:inputText>
Password
<h:inputText value="#{user.user.password}"></h:inputText>
<h:commandButton action="#{user.login}" value="submit" ></h:commandButton>
</h:form>
</f:view>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>com.desitek.cricket.action.LoginAction</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>login.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>index.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>login.jsp</to-view-id>
</navigation-case>
</navigation-rule>