Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 05-05-08   #1 (permalink)
Hebrew Hammer
 
TheLegend's Avatar
 
intel nvidia

Join Date: Jan 2006
Location: Milwaukee, WI
Posts: 5,719

FAQs Submitted: 1
Trader Rating: 21
Default Java Hyperlink Help

I've got one class of my web based application not working properly. The premise behind the application is to calculate admission based upon GPA and GMAT. Then based upon the status of admitted or not admitted we are supposed to have an advice page customized by cookies to provide links based on the acceptance.

Code:
public void prerender() {
    HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest();
    Cookie[] myCookies = request.getCookies();
    String [] report;
    String all = new String();
        if(myCookies.length >0)
        {
            report = new String[myCookies.length-1];
            for (int i = 1; i<myCookies.length-1; i++)
            {
             String fName = myCookies[i].getName();
             String val = myCookies[i].getValue();
             report[i] = new String ("Hello," + fName + ". Your admission status is " + val + "." +  
                      " Please review the following links for help on your admission decision.");
             all = all + report[i] + "\n";
             
             if(val.equals("Admitted"))
             {
                 //hyperlink1.visible = true;
                 labelResult.setText("Please visit " + hyperlink1 + " for more information.");
             }
             else if(val.equals("Not Admitted"))
             {
                 //hyperlink2 = setVisible;
                 labelResult.setText("Please visit " + hyperlink2 + " for more information.");
             }
                 
            }                                                                                                                                           
        }
         else
          {
            report = new String[1];
            report[0] = new String("No Status.");                   
            all = report[0];         
          }
    
          labelAdvice.setText(all); 
        
    }
I need to figure out a way to make the hyperlinks visible/hidden based on the status, but 'hyperlink1.visible = true;' gives an error. Any suggestions?
__________________
|
PC Audio Setup:
JRiver Media Center ASIO(FLAC) > E-MU 0404 USB > LD MKIII > Grado SR225 / HD555

Fold for 37726
Folding Team "Just Be Cause" Honorary Member

System: Legendary
CPU
E6750
Motherboard
ASUS P5B Deluxe
Memory
2 x 2GB G.Skill PQ
Graphics Card
XFX 8800GT [721|1802|2050]
Hard Drive
Seagate 250GB x 2
Sound Card
X-Fi XtremeMusic
Power Supply
PC P&C Quad 750W Silencer
Case
Thermaltake Tsunami Dream
CPU cooling
Tuniq Tower 120 | Lapped
OS
Vista x64
Monitor
Samsung 225BW
TheLegend is offline Overclocked Account   Reply With Quote
Old 05-05-08   #2 (permalink)
Hebrew Hammer
 
TheLegend's Avatar
 
intel nvidia

Join Date: Jan 2006
Location: Milwaukee, WI
Posts: 5,719

FAQs Submitted: 1
Trader Rating: 21
Default

I ended up doing this. It's probably not the most efficient, but it works.

Code:
public void prerender() {
    HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest();
    Cookie[] myCookies = request.getCookies();
    String [] report;
    String all = new String();
        if(myCookies.length >0)
        {
            report = new String[myCookies.length-1];
            for (int i = 1; i<myCookies.length-1; i++)
            {
             String fName = myCookies[i].getName();
             String val = myCookies[i].getValue();
             report[i] = new String ("Hello," + fName + ". Your admission status is " + val + "." +  
                      " Please review the following links for help on your new admission decision.");
             all = all + report[i] + "n";
             
             String e = myCookies[i].getValue();      
             labelResult.setText(e);
             String statusNew = new String();
             statusNew = (String)labelResult.getText();
             if (statusNew.equals("Admitted"))
             {
                 admitted.setVisible(true);
                 admitted1.setVisible(true);
                 not_Admitted.setVisible(false);
                 not_Admitted1.setVisible(false);
                 
             }        
             else
             {
                 not_Admitted.setVisible(true);
                 not_Admitted1.setVisible(true);
                 admitted.setVisible(false);
                 admitted1.setVisible(false);
             }
                                       
            }                                                                                                                                                                                                                                                                              
        }
         else
          {
            report = new String[1];
            report[0] = new String("No Status") ;                   
            all = report[0];         
          }
    

          labelAdvice.setText(all); 
        
    }
__________________
|
PC Audio Setup:
JRiver Media Center ASIO(FLAC) > E-MU 0404 USB > LD MKIII > Grado SR225 / HD555

Fold for 37726
Folding Team "Just Be Cause" Honorary Member

System: Legendary
CPU
E6750
Motherboard
ASUS P5B Deluxe
Memory
2 x 2GB G.Skill PQ
Graphics Card
XFX 8800GT [721|1802|2050]
Hard Drive
Seagate 250GB x 2
Sound Card
X-Fi XtremeMusic
Power Supply
PC P&C Quad 750W Silencer
Case
Thermaltake Tsunami Dream
CPU cooling
Tuniq Tower 120 | Lapped
OS
Vista x64
Monitor
Samsung 225BW
TheLegend is offline Overclocked Account   Reply With Quote
Old 05-05-08   #3 (permalink)
New to Overclock.net
 
intel nvidia

Join Date: May 2008
Posts: 90

Rep: 6 amd0freak Unknown
Unique Rep: 5
Trader Rating: 0
Default

hmm.... the visible attribute is accessible by both javascript and CSS; although I have never done Java on the web. Why do you use Java rather than PHP? is this a java server page or an applet?
__________________
System: Workstation
CPU
E6400 @ 3.2GHz (400x8)
Motherboard
Gigabyte GA-P965-DS3
Memory
2GB OCZ Gold
Graphics Card
GeForce 7600GT
Hard Drive
80GB Excelstor
Sound Card
Audigy 5.1
Power Supply
PC P&C 610W Silencer
Case
Rosewill Black
OS
Slackware
Monitor
20" Westinghouse LCD
amd0freak is offline   Reply With Quote
Old 05-05-08   #4 (permalink)
Chiefly Ignorant
 
Scriptorum's Avatar
 
intel nvidia

Join Date: Jan 2008
Location: Atlanta, GA
Posts: 54
Blog Entries: 12

Rep: 13 Scriptorum Unknown
Unique Rep: 10
Trader Rating: 0
Default

Last time I used servlets I would just write HTML direct to the output stream. So in my case, I would just omit or include the output based on the status. What classes/API are you using for your HTML tags? What type is hyperlink1?
__________________
Quote:
Originally Posted by The Bartender Paradox View Post
crazy?...nah. when you cool with a fire extinguisher then your crazy.

System: Flaming Moe's MacBook Pro
CPU
Core 2 Duo
Motherboard
MacBook Pro
Memory
4GB DDR2-667
Graphics Card
512Mb NVIDIA GeForce 8600M GT
Hard Drive
200Gb 7200RPM
OS
OSX 10.5.2 / XP Pro / Boot Camp + Parallels
Monitor
17" Matte 1920x1200
Scriptorum is offline Overclocked Account   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 05:16 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.13627 seconds with 9 queries