|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Java Hyperlink Help
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||
|
Hebrew Hammer
![]() |
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);
}
__________________
| 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
|
||||||||||||
|
|
|
|
#2 (permalink) | ||||||||||||
|
Hebrew Hammer
![]() |
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
|
||||||||||||
|
|
|
|
#3 (permalink) | |||||||||||
|
New to Overclock.net
|
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?
__________________
|
|||||||||||
|
|
|
|
|
#4 (permalink) | ||||||||
|
Chiefly Ignorant
|
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?
__________________
|
||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|