Calvin Hughes

Greenhorn
+ Follow
since Jul 24, 2011
Calvin likes ...
MySQL Database Flex
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Calvin Hughes

Hello,
I am in the process of teaching myself Java and JavaEE. While I have been studying various programming books for the last year and a half and feel like I have a pretty good grasp of how to use the language. However as much as I understand how to move files and read and write to a database I seem to be at a loss when trying to figure out how to write programs from scratch. Is this where patterns come in? Is your book easy enough for a beginner like myself to make good use out of it?

On a side note I'm also curious about what kind of situations it would be good to use OSGI with in an application server like Glassfish?

Thanks
Hey Tim.

Thank you Thank you. Your comment lead me in the right direction to figuring out my problem.

It came down to <from-action> with <h:commandLink action=""> is not the same thing as using a <from-outcome> tag with <h:link outcome=""> in the faces-config.xml file.

I changed my method to not return a string that can be interpreted as a reference to a view and had to change my navigation rule back to using <from-outcome> in faces-config.xml

public String logout(){
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext ectx = ctx.getExternalContext();
ectx.invalidateSession();
return "home";
}

<navigation-rule>
<navigation-case>
<from-outcome>home</from-outcome>
<to-view-id>/index.xhtml</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>

Thanks again!
12 years ago
JSF
Thank you Tim. I fixed the problem you mentioned but it doesn't seem to affect the problem I'm seeing. It is more like my page just isn't redirecting when it should be and I don't know why.

I would make it a regular <h:link> like all the rest of my buttons but for some reason JSF calls the outcome method of my link when the page is created so it automatically logs me out just from viewing the admin page.
12 years ago
JSF
Hello,

I'm still new to JSF so I'm looking for any advice I can get. I have a problem updating my JSF components rendered attribute. Here is my code:

index.xhtml


MenuBean.java

faces-config.xml

I can login and logout just fine but the problem is that when I logout and get sent back to my index page, I can still see my logout button that shouldn't be rendered anymore. This goes away after clicking through another link so I thought that using redirect should work but to no avail.

Any tips will be much appreciated.
Thanks!
Calvin
12 years ago
JSF
Thank you very much. I can't tell you how much that was annoying me.
12 years ago
JSF
Hello,

I'm just learning the basics of JSF and I have gotten myself confused just working through some simple navigation.

Here's my code:
JSF Page:

<h:form>
<h:link value="Index 1" outcome="#{menuBean.index}" />
<h:commandLink value="Index 2" action="#{menuBean.index}" />
</h:form>

MenuBean:

package edu.unmc.codawards.beans;

import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;

@Named
@RequestScoped
public class MenuBean implements Serializable{
private String index = "index"

public String getIndex() {
return index;
}
}

Index 1 works just fine but Index 2 gives me a "javax.el.MethodNotFoundException: /WEB-INF/CODAwardsTemplate.xhtml @27,87 action="#{menuBean.index}": Method not found: edu.unmc.codawards.beans.MenuBean@64743887.index()"

If I change my MenuBean getIndex method to just index I can get the action to work with action="#{menuBean.index()}"

While it works, this has me worried since all of the tutorials I am working through seem to treat both the outcome and action attributes the same with no need to include "()"

Surely I'm missing something so incredibly basic but I would appreciate any help I can get

Thanks
Calvin
12 years ago
JSF
Yeah sorry the picture I posted was for brevity to show the general layout of the tables. Each table other than the year shows more detail and has a different naming scheme. To be honest I think I am over thinking things. I'm still studying up on how to use JPA and JPQL. Other than mapping out the relationships between tables in the entities, working with how the tables data all comes together should be in my queries right? wow I feel like that is a really dumb question.

I'll post some code when I actually have an example to show.
Hey guys,

This is my first post so I hope I am going about this the right way. I am working on my first JPA project ever so this may seem like some very basic questions but please bear with me.

My work has me putting together a database for all of the awards we have given out over the last 40 years to our faculty and students. My database structure looks kind of like the picture I have attached to this post. We have about 850 award instances of the 30 or so awards we give out each year. They have been given to about 500 different people and some people have received an award multiple times or multiple awards.

I understand that my Award Instances table has a many to one relationship with each of the other tables but how do I show that in my entities?? Do I treat my Awards Instances table as one big join table??

I've looked at lots of examples but all of them are usually just 2 tables. I'm not sure how to treat something more complex.

Thanks for any help you guys are willing to give!