Login Sever Behavior Problem
I have created a login function on my web page that is
suppose to return users to the index after successfully a login.
The login function was created using one of Dreamweaver's built in
server behaviors. I originally ran the website on a test sever on
my local machine and everything work fine. But when I transfered it
to the online testing site the same error always happened. On the
online sever it is used as a subdomain and when the pages calls its
self it calls the directory it located on as well. For example on
the index page where the main login is located, when the submit
button is hit it calls it self as directory/index.php instead of
just index or www.subsite.main.site.com. I have tried everything I
can to figure out how to get it to stop pointing in the wrong
location. Please help.
Gamespy007 wrote:
> I have created a login function on my web page that is
suppose to return users
> to the index after successfully a login. The login
function was created using
> one of Dreamweaver's built in server behaviors. I
originally ran the website
> on a test sever on my local machine and everything work
fine. But when I
> transfered it to the online testing site the same error
always happened. On
> the online sever it is used as a subdomain and when the
pages calls its self it
> calls the directory it located on as well. For example
on the index page where
> the main login is located, when the submit button is hit
it calls it self as
> directory/index.php instead of just index or
www.subsite.main.site.com. I have
> tried everything I can to figure out how to get it to
stop pointing in the
> wrong location. Please help.
Can you go into code view and find the redirect part and edit
out the
directory?
Steve
Similar Messages
-
Hello,
I'm trying to have a couple of pages with restricted access
on our website.
Using DWMX2004 and Coldfusion on Windows XP.
I used the login server behavior to achieve this.
It seems to work fine when the user name (email address in
this case) and password are not in the database, redirecting to the
failed login page, but when the user and password are correct I get
an error message ("Variable MM_LOGINACTION is undefined") and the
redirection doesn't happen.
I'm far from an expert, and I'm struggling to understand the
code, especially the reason why a CGI variable is used...
Could anyone please help me ?
Thanks in advance.
Ann
Here is the code of my login page (which is not in the root
directory, but in a folder ../en/):
<cfif IsDefined("FORM.txtEmail")>
<cfset
MM_redirectLoginSuccess="brochures_download.cfm">
<cfset MM_redirectLoginFailed="brochures_new.cfm">
<cfquery name="MM_rsUser" datasource="Calliope">
SELECT UserEmail,UserPass FROM tblUsers WHERE
UserEmail='#FORM.txtEmail#' AND UserPass='#FORM.txtPass#'
</cfquery>
<cfif MM_rsUser.RecordCount NEQ 0>
<cftry>
<cflock scope="Session" timeout="30" type="Exclusive">
<cfset Session.MM_Username=FORM.txtEmail>
<cfset Session.MM_UserAuthorization="">
</cflock>
<cfif IsDefined("URL.accessdenied") AND false>
<cfset MM_redirectLoginSuccess=URL.accessdenied>
</cfif>
<cflocation url="#MM_redirectLoginSuccess#"
addtoken="no">
<cfcatch type="Lock">
<!--- code for handling timeout of cflock --->
</cfcatch>
</cftry>
<cfelse>
<cflocation url="#MM_redirectLoginFailed#"
addtoken="no">
</cfif>
<cfelse>
<cfset MM_LoginAction=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_LoginAction=MM_LoginAction & "?" &
XMLFormat(CGI.QUERY_STRING)>
</cfif>
</cfif>
<html>
<head>
</head>
<body>
<form
ACTION="<cfoutput>#MM_loginAction#</cfoutput>"
METHOD="POST" name="FORM">
<table width="100%" cellpadding="2" cellspacing="2">
<tr>
<td>Your email </td>
<td><input name="txtEmail" type="text"
id="txtEmail" size="65"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="txtPass" type="text" id="txtPass"
size="8"></td>
</tr>
<tr>
<td> </td>
<td><input name="Login" type="submit" id="Login"
value="Login"></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>You need to ensure that sessions have been enabled in your
application.cfm
file.
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"kangy" <[email protected]> wrote in message
news:[email protected]...
> Hello,
>
> I'm trying to have a couple of pages with restricted
access on our
> website.
> Using DWMX2004 and Coldfusion on Windows XP.
>
> I used the login server behavior to achieve this.
> It seems to work fine when the user name (email address
in this case) and
> password are not in the database, redirecting to the
failed login page,
> but
> when the user and password are correct I get an error
message ("Variable
> MM_LOGINACTION is undefined") and the redirection
doesn't happen.
>
> I'm far from an expert, and I'm struggling to understand
the code,
> especially
> the reason why a CGI variable is used...
> Could anyone please help me ?
> Thanks in advance.
> Ann
>
> Here is the code of my login page (which is not in the
root directory, but
> in
> a folder ../en/):
>
> <cfif IsDefined("FORM.txtEmail")>
> <cfset
MM_redirectLoginSuccess="brochures_download.cfm">
> <cfset MM_redirectLoginFailed="brochures_new.cfm">
> <cfquery name="MM_rsUser" datasource="Calliope">
> SELECT UserEmail,UserPass FROM tblUsers WHERE
> UserEmail='#FORM.txtEmail#'
> AND UserPass='#FORM.txtPass#'
> </cfquery>
> <cfif MM_rsUser.RecordCount NEQ 0>
> <cftry>
> <cflock scope="Session" timeout="30"
type="Exclusive">
> <cfset Session.MM_Username=FORM.txtEmail>
> <cfset Session.MM_UserAuthorization="">
> </cflock>
> <cfif IsDefined("URL.accessdenied") AND false>
> <cfset MM_redirectLoginSuccess=URL.accessdenied>
> </cfif>
> <cflocation url="#MM_redirectLoginSuccess#"
addtoken="no">
> <cfcatch type="Lock">
> <!--- code for handling timeout of cflock --->
> </cfcatch>
> </cftry>
> <cfelse>
> <cflocation url="#MM_redirectLoginFailed#"
addtoken="no">
> </cfif>
> <cfelse>
> <cfset MM_LoginAction=CGI.SCRIPT_NAME>
> <cfif CGI.QUERY_STRING NEQ "">
> <cfset MM_LoginAction=MM_LoginAction & "?" &
> XMLFormat(CGI.QUERY_STRING)>
> </cfif>
> </cfif>
> <html>
> <head>
> ...
> </head>
>
> <body>
> ....
> <form
ACTION="<cfoutput>#MM_loginAction#</cfoutput>"
METHOD="POST"
> name="FORM">
> <table width="100%" cellpadding="2"
cellspacing="2">
> <tr>
> <td>Your email </td>
> <td><input name="txtEmail" type="text"
id="txtEmail"
> size="65"></td>
> </tr>
> <tr>
> <td>Password</td>
> <td><input name="txtPass" type="text"
id="txtPass"
> size="8"></td>
> </tr>
> <tr>
> <td> </td>
> <td><input name="Login" type="submit"
id="Login"
> value="Login"></td>
> <td> </td>
> </tr>
> </table>
>
> </form>
> ...
> </body>
> </html>
>
>
> -
I’ve drawn shapes many times with the “write on” behavior. All of a sudden, it’s not working. Here’s the problem. “Write On” completes drawing and then reverses a little bit on the last frame. I included frame shots. If anyone can help, I would appreciate it.
Side note: I know I can do the same thing with key frames. However, I’d rather solve the “write on” behavior problem.Ah, nevermind! I think I may have solved the issue myself. It seems if you click on the Group tab to the left of the main timeline as opposed to the clip within the timeline, it allows you to change the group and scale it while also keeping different elements together. Could be helpful for anyone with a similar question.
-
License sever communication problem e_bad_loan_id
I reinstalled Abobe Digital editions 2.0 and when i try to return the bokks I ge theis error
License sever communication problem E_BAD_LOAN_ID
Ive tried uninstalling and reinstalling and same thing
any help would be great thanks
KevinEvery single problem I have experienced with library books and BAD LOAN messages is the fault of ADE 2.0. The moment I uninstalled the program and reinstalled an earlier version, my library loans started working again.
It is remarkable how deeply flawed the update is and equally how ADE tech support attempts to resolve their own issues by attempting to charge $68 to find the problem in their own software. Frankly I was really disgusted to see that the problem was their issue and how little they have done to correct it after months of questions and complaints from their own users.
Link:
http://kb2.adobe.com/cps/403/kb403051/attachments/setup.exe
Thank you Roger Osborn for the link! -
Login runtime value from login server behavior?
How do I set up a recordset that will point to the login users' record in PHP once they login from the login server behavior?
In ASP I used the value for the variable actname: MM_Username.
I just want to link to the username's record. I thought the "mm_Username" value was something that was created in the login server behavior that came with Dreamweaver and it would work for php as well as asp.
In PHP I am using the following runtime value language :
$_GET['MM_Username']
Is it different in PHP? It won't point to the record of the login user in the user's account.
How do I set up a recordset so that it will point to the record of the login user if none of this makes sense in php.
Thanks in advance,
Bob JeanFound the Answer. The runtime value in the recordset is as follows:
$_SESSION['MM_Username'] -
AD Radius 802.1x Login Window Connection Problems
Mac Mini/10.10.1
I'm using two profile manager profiles for testing:
1. AD Certificate
Installs certificate for AD Certificate Authority.
Requests Machine Certificate from CA
2. Network Settings
Network Payload:
Interface WIFI
SSID our 802.1x SSID
Auto Join - Checked
Security Type - WPA / WPA2 Enterprise
Use as Login Window Config - Checked
EAP Types: PEAP
Use Directory Auth - Checked
Issue:
Certificate services work fine, login window works fine. User is able to login and authenticate to wireless. However users are experiencing problems with computer sleep, roaming on network etc. I can simulate their problems by turning off air port and back on while logged in. What I'm seeing happen is that when airport is turned back on, it begins to connect to the 802.1x wireless network but does not authenticate does not receive an IP address. eventually resulting in self assigned address. If I press the connect button it will then authenticate and work as expected.
Why is it necessary to press the connect button, why does it not automatically connect? Am I doing something incorrect or is this normal behavior?
Going into network preferences, choosing wifi adapter and clicking connect is too much to expect from my users. And it would be annoying even for me if this happened every time I went offline.
Thank you for suggestions.
JoeHi Geoffrey,
I would like to know if
EAP-TLS wireless authentication has been used since it uses user and computer certificates to authenticate wireless access clients.
Please try to use NPS wizard to configure 802.1x wireless connection,
and
you will find that it
creates new connection request policy and network policy. Network policy NAS Port type will be "Wireless -Other OR Wireless -IEEE 802.11".If
you
need filter by user and computer account, the log should show both authenticate user and machine account name.
EAP-TLS-based Authenticated Wireless Access Design
http://technet.microsoft.com/en-us/library/dd348478(WS.10).aspx
Regards, Rick Tan -
Please help! Bizarre login/user account problem
In 24 years of using Macs, this is the most frustrating thing I've ever faced and I am in desperate need of help.
For the entire story of my circumstances, see below. The short version of my problem: My auto-login user account is corrupt but I can't figure out how to bypass/interrupt it so I can log in to a different user account. Is there a way to use Single User Mode to do this - to get to the regular login screen where I can enter a different user name and password???
I follwed the steps outlined by Michael in this thread, but it did not work
http://discussions.apple.com/thread.jspa?threadID=1124380
Any expedient help is greatly appreciated, I'm in dire straights...my Mac has been down for a week with this problem and my work is suffering.
Thanks in advance,
-Nelson
Here's the long version of how I arrived at these circumstances:
I have a single (admin level) user account on my new Mac Pro, with auto-login enabled. The home folder is on a separate internal drive (bay 2) from the OS/applications (bay 1). Out of nowhere, I got the error "You are unable to log in to the user account. Login failed because an error occurred." I was not able to login to my machine. When I tried to boot from my bootable clone backup, got the same error. Tried to boot from the Leopard install DVD, got the 5-language kernel panic screen. Off to the Apple Store.
It didn't occur to me at this time to mention my Home folder being on a 2nd drive, that was my mistake #1. They ended up replacing the logic board and RAM riser cards, neither of which was remotely related to the problem. In the process, they were able to create a new admin-level 'test' user account, and got the machine up and running again. At this point they noticed that there was no other user/Home folder present on the startup drive and at this point I told them that it was located on drive 2. That drive was not appearing in the finder, so apparently it had croaked - and knowing this pretty much explained the original problem, to me at least.
I get home, log in as Test, delete my old user account, create a new user account and put the Home folder for this new account on drive 3. My stupid mistake #2: I used the same name for the new account as my old account, and mistake #3, turned auto-login to this account back on.
But at this point, everything was still working, and I commenced to try to recover my lost Home folder from my Time Machine backup and figure out how to restore all of my system settings, which were wiped out with the creation of the new Test user account. I'll skip over some of the other problems I ran into with Time Machine at this point and get to the real issue: after a couple of successful restarts and logins to my newly created user account (the one with the same name as my old account but with it's Home folder in a different location), the ORIGINAL "You are unable to log in to the user account. Login failed because an error occurred." error has returned.
Now I'm back where I started, and can't figure out how to log in to the Test account that resides on my startup drive, because auto-login is enabled for the 'broken' user account - even though the Home folder for this account is located on a working drive.
I've done tons of searching and can't figure out how to use Single User Mode to login to Test. When I try the login command, it says 'login incorrect', even though I am using the correct user and password. Help!!well, something is really messed up with those accounts so I would create a new admin account, log into that and go from there.
To do that [enable the root user|http://support.apple.com/kb/TS1278], safe boot, log in as root and create a new admin account, also while you are at it disable the auto login.
You can also work from the root account but I would recommend against it. It's not really safe. -
Crystal report prompting for login to Dataset [Problem]
Hello,
I'm developing a C# windows application with an Access db
I'm getting the data from the database and load it to a dataset then pass the dataset to the report
every thing is working fine on my local machine but..
When I run it on any other machine it prompts me to enter the login information while there are no login informations to enter because I'm connecting to a data set
here is my simple code to load the report
VisitReasibReoirt VisitReasonRPT = new VisitReasibReoirt();
VisitReasonRPT.DataSourceConnections[0].IntegratedSecurity = true;
VisitReasonRPT.SetDataSource(ds);
crystalReportViewer1.ReportSource = VisitReasonRPT;
crystalReportViewer1.RefreshReport();
Also there is an other problem in the design
I cannot change the language of the datetime fields like what I did with text fields.. How can I solve this ?
please tell me what to do...this is very important I searched a lot but I found nothing usefull
Edited by: Mando! on Aug 26, 2010 2:04 AMHello,
Information needed..
Version of Crystal Reports?
Version of Visual Studio?
Type of data connectivity used? (i.e. OLEDB, ODBC)
Did you diploy the application? How? (MSM's or MSI's)
If the new machine is also a developement environment, does the report work from designer?
Version of windows on prev and new machine?
Make sure that..
If the application is deployed, the proper runtimes are installed.
The database provider is installed.
The target database is located where it should be.
The target database is unchanged.
One question per thread please.
see [Rules of engagement|http://wiki.sdn.sap.com/wiki/display/HOME/Rules%20of%20Engagement].
Thanks,
Bhushan. -
Login as sysdba problem...
Hi,
I've created my own database to make tests on Oracle and directly after that I've changed the passwords for all the users (sys and system users included).
When I try to login without the sysdba role, Oracle applies the password verification fine.
The problem is when I try to login as sysdba:
$> sqlplus 'sys as sysdba'
I can enter whatever password I want and I'm connected !!!
And it's the same if first I type:
$> sqlplus /NOLOG
SQL*Plus: Release 9.2.0.1.0 - Production on Wed May 7 13:21:44 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys as sysdba
Could someone help me to find where It comes from and how I do solve this security hole...
Thanks in advance
PaulWhat's the OS? Are you signed on to the OS as a user in > the DBA group?I'm using a Debian 3.0 (Woody) operating system with a Linux 2.4.18 kernel
I've got only one user which is a member of the DBA group and what I experienced, It's true, was only when I was logged as this user...
Does it means that when a user is a member of the DBA group on the operating system, even if the remote_os_authent parameter is set to false, he can login with sys as sysdba as he wants trough sqlplus ?
+++++++++++++++++++++++++++++++
Original message:
Hi,
I've created my own database to make tests on Oracle and directly after that I've changed the passwords for all the users (sys and system users included).
When I try to login without the sysdba role, Oracle applies the password verification fine.
The problem is when I try to login as sysdba:
$> sqlplus 'sys as sysdba'
I can enter whatever password I want and I'm connected !!!
And it's the same if first I type:
$> sqlplus /NOLOG
SQL*Plus: Release 9.2.0.1.0 - Production on Wed May 7 13:21:44 2003
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> connect sys as sysdba
Could someone help me to find where It comes from and how I do solve this security hole...
Thanks in advance
Paul
+++++++++++++++++++++++++++++++ -
Automatic login to wireless problem
We have several computers at home, all connected to the internet through a wireless router hooked up to our main PC. Then there is my laptop, my old iMac, and my son's PC. Everything was working fine ... when I'd start my PowerBook G4, it would automatically detect our wireless network and connect my laptop to the network.
However, we had our son hook up his Playstation3 to the router via an ethernet cable. This way would could take away the ethernet cable to limit his playing time and encourage him to do his homework. The Playstation3 also "hijacks" the IP address, basically blocking anyone else in the house from using the internet.
Well, my son found the WEP password for the wireless, and decided to put it on his Playstation3 so he could play online whenever we weren't looking. Well, when we found out he had pinched the WEP password, we reset the it on the wireless Linksys router, and I went into my Keychain and changed the WEP key for the wireless network on my PowerBook. Problem solved, right?
Well, now when I start up my G4 Powerbook, it detects our home wireless network but no longer automatically signs in to the network. Additionally, when I try to select our wireless network from the AirPort pull-down menu from the Finder window menu bar, it says that an error occurred and it can not connect. Hitting the "Try Again" button is futile. I have to go into Internet Connect, select "Other" from the available wireless networks, then pick our home wireless network from the list. I then have to type in that annoying 26 digit WEP 128-bit Hexidecimal security key! Only then do I get the connection to our wireless. Additionally, I have to do this EVERY SINGLE TIME I boot my Powerbook -- it doesn't seem to want to remember the password, even though it is stored in the keychain.
This problem is very frustrating! Why won't my Powerbook automatically login to our network?Good news!
Yep, that was the WEP I was talking about, 104/128bit/26Hex.
Now it takes just 3 seconds to extract a 104-bit WEP key from intercepted data using a 1.7GHz Pentium M processor...
http://www.techworld.com/security/news/index.cfm?newsid=8456
WPA or better yet WPA2... if your Airport card & Router both support it...
http://compudent.blogspot.com/2006/09/wireless-wep-vs-wpa-vs-wpa2.html
http://answers.yahoo.com/question/index?qid=20070924153500AArrQBP
http://www.home-wlan.com/WEP-vs-WPA.html
http://support.apple.com/kb/TA21448?viewlocale=en_US
Finally...
http://support.apple.com/kb/TA21448?viewlocale=en_US -
Automatic Login to Network problems!
I have a 3 Mac network. They are connected to a gigabit switch that is attached to a gigabit Airport Extreme.
My problem is that I want to have my computers automatically log in to my shared NAS drive when they startup in the mornings (they are on a schedule to startup). What I did was go to the user in System Pref and add a link to the startup items that is the shared drive. One machine automatically logs in like expected. The other 2 machines say that they can not find the server! I turned off the firewalls on the machines and that doesn't seem to help. What can I do to get the machines to login to my NAS automatically on startup?
Kevin HawkinsKevin, I found this way, but i was looking for another one...
http://www.macosxhints.com/article.php?story=20050215082247458 -
Sequel Search Server Behaviors Problem
This code was made with php-msql server behaviors - recordset
pull down's....
I have a form to search for firstname or lastname or both but
I'm not getting the right results
SELECT * FROM phonebook WHERE firstname LIKE %s and lastname
LIKE %s
problem 1 - if I have NOTHING in the form then *all* records
get returned
I guess the problem is with blank form fields?
Q: How can I fix this?
full query below...still curious about this - thanks in advance
-
Safari Auto-login/ Auto-fill problem
Hi!
I recently updated my safari after which I have been unable to auto login to my yahoo,gmail etc accounts. I have checked my safari preferences and all 3 auto-fill webform tabs are clicked. Also, when I go into yahoo, it does not prompt me to ask if i want to save my password. For my other accounts e.g gmail, they prompt me and my password + user-ids are still saved, just that i have to press the sign in button.
Also, it stays signed it as long as i am on safari. However, if I were to quit safari and use safari again, it goes back to square one and no longer keeps me signed it.
What can I do to enable safari to auto-login for all my accounts?
Thanks!I have asked a similar question several times before, and I have the answers varied from the typical I do not have that problem to its a security feature incorporated in Safari.
I tend to think it is a new feature added ito safari n the last several months (via an update).
The bottom line is I am NO longer able to stay logged into various websites if I quit safari, even though the websites have the feature available that should allow a user to stay logged in for 2 weeks.
The only way I can now stay logged in for an extended period of time is to NEVER quit Safari.
That is not an option for me.
rjj -
Urgent: JAAS Login Module Deployment Problem
Hi,
I have developed a JAAS Login module for the portal (EP6 SP9 sneak preview) and i am getting the following error:
GroupAssignmentLoginModuleLibrary does not exist in LoadContextWrapper.modifyName.
com.sap.engine.services.security.exceptions.BaseSecurityException: Can not load a login Module
The next line is a ClassNotFoundException for the Login Module and the class found in negative cache.
Please let me know if you know the solution to this problem.
It is an urgent issue and a solution will be suitably rewarded.
Regards,
VibhuHi Diego,
Scenario 1: SAP EP to SAP Backend Integration
In this scenario the most commonly used strategy
is SAP logon tickets. As far as I know this is the
best and simple way to implement SSO.
Scenario 2: SAP EP to Non SAP systems.
In this scenario various mechanisms can be used.
It depends on the application you are integrating
with. SAP does deliver SSO soultions with Lotus
Notes and Outlook etc. If supported probably it is
simple to use the SAP solution [Reliability and
Support].
Scenario 3: Enterprise Uses third party authetication
Software.
For the authntication if the company chooses to use
some third party product like SiteMinder etc, then
you can simply use this solution for SAP EP authe-
tication, and also all your other enterprise
applications based on the product support. But SAP
EP to other SAP systems be best integrated with SAP
logon tickets.
Scenario 4: SSO using homegrown authetication or some
third party JAAS module.
If you have significant applications that are home
grown that uses some custom authentication mecha-
nism (Example: Authentication based on ID and
Password stored in company database ) you can write
a JAAS module extention to authenticate using that
database. In other words JAAS is flexible and
for using external authentication mechanisms.
There are several mechanisms available that all depends
on your internal applications/security mechanism/integration etc.
Here is the link to one of the good articles on SDN about the SAP supported SSO mechanisms.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/58094632-0301-0010-a391-fc0de26f010e
Hope this information is useful.
-Venkat Malempati -
Custom mouselook behavior problems
I am trying to write a custom behavior for mouselook (I know there is one but I want the challenge and the custom levels). I can't seem to get it to move...
Interaction1 class (JFrame):
import javax.swing.JFrame;
import java.awt.event.*;
import javax.swing.Timer;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.vecmath.*;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import java.awt.Polygon;
import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.Triangulator;
import com.sun.j3d.utils.geometry.Stripifier;
import com.sun.j3d.utils.universe.ViewingPlatform;
import com.sun.j3d.utils.universe.Viewer;
public class Interaction1 extends JFrame implements ActionListener, KeyListener
public static final long serialVersionUID=1;
private Timer t;
private Canvas3D canvas;
public Interaction1()
super("Interaction1");
setSize(700,530);
setVisible(true);
Container c = getContentPane();
c.setLayout(new FlowLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
canvas = new Canvas3D(config);
canvas.setSize(640,480);
canvas.setVisible(true);
c.add(canvas);
ViewingPlatform vp = new ViewingPlatform();
vp.setNominalViewingTransform();
vp.getViewPlatformTransform().setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
vp.setViewPlatformBehavior( new MouseLookBehavior(vp.getViewPlatformTransform(),this,5f) );
vp.getViewPlatformBehavior().setSchedulingBounds(new BoundingSphere());
SimpleUniverse univ = new SimpleUniverse(vp, new Viewer(canvas));
BranchGroup scene = createSceneGraph();
scene.compile();
univ.addBranchGraph(scene);
addKeyListener(this);
t=new Timer(10,this);
private BranchGroup createSceneGraph()
BranchGroup i = new BranchGroup();
Background bg = new Background();
bg.setColor(.75f,1f,1f);
bg.setApplicationBounds(new BoundingSphere(new Point3d(),500.0));
Shape3D side1 = new Shape3D();
QuadArray abgeom = new QuadArray(4,QuadArray.COORDINATES|QuadArray.TEXTURE_COORDINATE_2);
//order TL,BL,BR,TR
abgeom.setCoordinate(0,new Point3f(-3f,4f,0f));//Front
abgeom.setCoordinate(1,new Point3f(-3f,0f,0f));
abgeom.setCoordinate(2,new Point3f(3f,0f,0f));
abgeom.setCoordinate(3,new Point3f(3f,4f,0f));
abgeom.setTextureCoordinate(0,0,new TexCoord2f(0f,0f));//Front
abgeom.setTextureCoordinate(0,1,new TexCoord2f(0f,1f));
abgeom.setTextureCoordinate(0,2,new TexCoord2f(1f,1f));
abgeom.setTextureCoordinate(0,3,new TexCoord2f(1f,0f));
side1.setGeometry(abgeom);
Appearance abapp = new Appearance();
Texture2D abtex = new Texture2D(Texture.BASE_LEVEL,Texture.RGB,64,64);
abtex.setImage(0,new ImageComponent2D(ImageComponent.FORMAT_RGB,toBufferedImage((new ImageIcon("buildingside.jpg")).getImage())));
abapp.setTexture(abtex);
side1.setAppearance(abapp);
i.addChild(bg);
i.addChild(side1);
return i;
public void keyPressed(KeyEvent e)
if(e.getKeyCode()==KeyEvent.VK_ESCAPE)
System.exit(0);
public void keyReleased(KeyEvent e)
public void keyTyped(KeyEvent e)
private BufferedImage toBufferedImage(Image a)
BufferedImage b = new BufferedImage(64,64,BufferedImage.TYPE_INT_RGB);
Graphics g = b.getGraphics();
g.drawImage(a,0,0,null);
return b;
public void actionPerformed(ActionEvent e)
repaint();
public void paint(Graphics g)
canvas.repaint();
public static void main(String args[])
JFrame a = new Interaction1();
}MouseLookBehavior class (ViewPlatformBehavior):
import java.util.Enumeration;
import javax.media.j3d.*;
import java.awt.event.MouseEvent;
import java.awt.Robot;
import java.awt.Window;
import java.awt.Point;
import java.awt.Dimension;
import com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior;
public class MouseLookBehavior extends ViewPlatformBehavior
private TransformGroup target;
private Transform3D yaw;
private double yawTheta=0.0;
private Robot robot;
private Window window;
private float sensitivity;
public MouseLookBehavior(TransformGroup ooc, Window a, float senstvty)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=senstvty;
yaw = new Transform3D();
public MouseLookBehavior(TransformGroup ooc, Window a)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=2f;
yaw = new Transform3D();
public void initialize()
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
public void processStimulus(Enumeration e)
MouseEvent a = (MouseEvent)(((WakeupOnAWTEvent)e.nextElement()).getAWTEvent()[0]);
Point winloc = window.getLocation(null);
Dimension windim = window.getSize(null);
winloc.translate((int)windim.getWidth()/2,(int)windim.getHeight()/2);
int difx=a.getX()-(int)(windim.getWidth()/2),dify=a.getY()-(int)(windim.getWidth()/2);
difx*=sensitivity;
dify*=sensitivity;
yawTheta+=difx;
yaw.rotY(yawTheta);
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
robot.mouseMove((int)windim.getWidth()/2,(int)windim.getHeight()/2);
PLEASE NOTE: I have been trying to get an exit command in there but it hasn't worked, so if you decide to run this, you will have to ctrl-alt-dlt it and alt-e it to end the task which brings up an AWT question... why wont it exit?
ALSO NOTE: I am aware of some extra useless variables in the processStimulus method. This is for future versions once I get this one to work. Ignore it.Perfect! Thanks. I've got a new problem now. whenever I try to use the mouselook, the object disappears. And so I tryed turning to find it and it still isn't there...
Main class
import javax.swing.JFrame;
import java.awt.event.*;
import javax.swing.Timer;
import java.awt.GraphicsConfiguration;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import java.awt.Container;
import java.awt.FlowLayout;
import javax.vecmath.*;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import java.awt.Polygon;
import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.Triangulator;
import com.sun.j3d.utils.geometry.Stripifier;
import com.sun.j3d.utils.universe.ViewingPlatform;
import com.sun.j3d.utils.universe.Viewer;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
public class Interaction1 extends JFrame implements KeyListener
public static final long serialVersionUID=1;
private Canvas3D canvas;
public Interaction1()
super("Interaction1");
setSize(700,530);
setVisible(true);
Container c = getContentPane();
c.setLayout(new FlowLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
canvas = new Canvas3D(config);
canvas.setSize(640,480);
canvas.setVisible(true);
c.add(canvas);
ViewingPlatform vp = new ViewingPlatform();
vp.setNominalViewingTransform();
vp.getViewPlatformTransform().setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
vp.setViewPlatformBehavior( new MouseLookBehavior(vp.getViewPlatformTransform(),this,10f));
vp.getViewPlatformBehavior().setSchedulingBounds(new BoundingSphere());
SimpleUniverse univ = new SimpleUniverse(vp, new Viewer(canvas));
BranchGroup scene = createSceneGraph();
scene.compile();
univ.addBranchGraph(scene);
addKeyListener(this);
private BranchGroup createSceneGraph()
BranchGroup i = new BranchGroup();
Background bg = new Background();
bg.setColor(.75f,1f,1f);
bg.setApplicationBounds(new BoundingSphere(new Point3d(),500.0));
Shape3D side1 = new Shape3D();
QuadArray abgeom = new QuadArray(4,QuadArray.COORDINATES|QuadArray.TEXTURE_COORDINATE_2);
//order TL,BL,BR,TR
abgeom.setCoordinate(0,new Point3f(-3f,4f,0f));//Front
abgeom.setCoordinate(1,new Point3f(-3f,0f,0f));
abgeom.setCoordinate(2,new Point3f(3f,0f,0f));
abgeom.setCoordinate(3,new Point3f(3f,4f,0f));
abgeom.setTextureCoordinate(0,0,new TexCoord2f(0f,0f));//Front
abgeom.setTextureCoordinate(0,1,new TexCoord2f(0f,1f));
abgeom.setTextureCoordinate(0,2,new TexCoord2f(1f,1f));
abgeom.setTextureCoordinate(0,3,new TexCoord2f(1f,0f));
side1.setGeometry(abgeom);
Appearance abapp = new Appearance();
Texture2D abtex = new Texture2D(Texture.BASE_LEVEL,Texture.RGB,64,64);
abtex.setImage(0,new ImageComponent2D(ImageComponent.FORMAT_RGB,toBufferedImage((new ImageIcon("buildingside.jpg")).getImage())));
abapp.setTexture(abtex);
side1.setAppearance(abapp);
i.addChild(bg);
i.addChild(side1);
return i;
public void keyPressed(KeyEvent e)
if(e.getKeyCode()==KeyEvent.VK_ESCAPE)
System.exit(0);
public void keyReleased(KeyEvent e)
public void keyTyped(KeyEvent e)
private BufferedImage toBufferedImage(Image a)
BufferedImage b = new BufferedImage(64,64,BufferedImage.TYPE_INT_RGB);
Graphics g = b.getGraphics();
g.drawImage(a,0,0,null);
return b;
public static void main(String args[])
JFrame a = new Interaction1();
}MouseLookBehavior:
import java.util.Enumeration;
import javax.media.j3d.*;
import java.awt.event.MouseEvent;
import java.awt.Robot;
import java.awt.Window;
import java.awt.Point;
import java.awt.Dimension;
import com.sun.j3d.utils.behaviors.vp.ViewPlatformBehavior;
public class MouseLookBehavior extends ViewPlatformBehavior
private TransformGroup target;
private Transform3D yaw;
private double yawTheta=0.0;
private Robot robot;
private Window window;
private float sensitivity;
public MouseLookBehavior(TransformGroup ooc, Window a, float senstvty)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=senstvty;
yaw = new Transform3D();
public MouseLookBehavior(TransformGroup ooc, Window a)
target=ooc;
window = a;
try{robot = new Robot();}catch(Exception e){}
sensitivity=2f;
yaw = new Transform3D();
public void initialize()
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
public void processStimulus(Enumeration e)
MouseEvent a = (MouseEvent)(((WakeupOnAWTEvent)e.nextElement()).getAWTEvent()[0]);
Point winloc = window.getLocation(null);
Dimension windim = window.getSize(null);
winloc.translate((int)windim.getWidth()/2,(int)windim.getHeight()/2);
int difx=a.getX()-(int)(windim.getWidth()/2),dify=a.getY()-(int)(windim.getWidth()/2);
difx*=sensitivity;
dify*=sensitivity;
yawTheta+=difx;
yaw.rotY(yawTheta/180*Math.PI);
target.setTransform(yaw);
robot.mouseMove((int)windim.getWidth()/2,(int)windim.getHeight()/2);
wakeupOn(new WakeupOnAWTEvent(MouseEvent.MOUSE_MOVED));
}
Maybe you are looking for
-
COST GL account when goods issue - enhancement or user exist
Hello SAP exports, There is a requirement from F&A department for different COGS GL account based on Customer Account Assignment Group value when goods issues (GI) (goods movement). Customer Account Assignment Group field name is KNVV-KTGRD. The s
-
Hi, I need to execute the query to find the particular string in the xml data. The query i used is given below. select create_dt from wms_out where xml_data like '%lpad(270,3,0)||lpad(5,2,0)||lpad(63,4,0)%' and trunc(create_dt ) = trunc (sysdate-3) a
-
Help with Europe Use - Galaxy Note II
I'm looking for specifics on how to unlock my Galaxy Note II to allow it to use prepaid SIMs for data and voice service in Europe. I'm looking to do this maybe in Austria and the Czech Republic. Can I get some help from a knowledgeable Verizon rep,
-
I am running OS X 10.5.8 and am getting ready to upgrade to Snow Leopard.
This is my first OS upgrade on my macbook and am not familiar with OS upgrades with Apple products. Does running this upgrade rewrite the entire hard drive? Will my files and apps in iTunes be lost?
-
Is it possible to install oracle 11g client 32 bit and oracle 11g client 64
Hi, I have Windows 2008 R2 64 Bit Operating Server Installed. Other software that are Installed : 1) Visual Studio 2010 Ultimate 32 Bit. 2) Microsoft SharePoint server 2010 64 Bit. For my development purpose I want to install both oracle 11g client 3