james loveay

Greenhorn
+ Follow
since Apr 24, 2012
james likes ...
MS IE Netbeans IDE Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by james loveay

Hi all,

just an update, Have solved the problem.

Again another simple one that I just couldn't figure out and stumbled on it just by luck but I know what I did so that's great for later.

Just wanted to input the code changes so that anybody with the same problem can follow and not go around the houses like I have been.



The controller class was changed



This solved the problem and allowed my to display the results quite happily.
11 years ago
Hi all,

I've been working on this for a while but can't seem to find the right way to go with it.

I want to be able to log in to a system, then on clicking on a hyperlink go to another page which will display a list of objects.

I'm using Spring MVC 3.1 with @Controller classes and the navigation goes from one .jsp to another .jsp page.

I've tried a few things and have considered SWF but think that is a little over what I need to do for this, also there seems to be no examples that I have been able to find, unless I'm getting a search term wrong.

So this is the code that I have



MainMenuController File



I have tried the @RequestMapping("/loanbooks") also @RequestMapping(value = "/loanbooks", method = RequestMethod.GET)

Both have failed, either returning a 404 or returning a mapping issue, if I can get the mapping correct between the jsp and the controller and there is still a problem then I think that I require a mapping in the xml file but I'm just not sure where I'm going wrong.

Can somebody take the time to have a look at this and explain what I'm missing.

Many thanks in advance.

I think though that I'll try to use SWF and see how I go with that, hopefully I can make another post soon to let you know how I got on with it.
11 years ago

james loveay wrote:

Bill Gorder wrote:I have never found the need to mix the 2. I just use Spring for all of my DI. I know it can be done, but I personally don't see the advantage in it. I would use one or the other personally.



Hi Bill,

Many thanks for your reply,

It was a great help. The sources confimed what I thought was the rightr way to go but always better having a wiser head show the path than to stumble around in the dark.

Anywho! totally agree with you that Spring is very good at handling everything I need for the project but then tah would be too easy!

Seriously the EJB were developed for another project I worked to learn the Struts framework and I wanted to re-use them instead of going the long route and re-building everything using spring, which would have been much easier.

Again many thanks.



Following on from my last post, just wanted to make an update!

I followed the links suggested and found a lot of examples on the net showing exactly the same thing, but they didn't work i.e. using a lookup configuration entry in the applicationConfiguration.xml file. Not sure why they didn't work but just in case anybody else comes across this problem I think that it may have something to do with the Glassfish server running with the Net Beans IDE, I have come across some peculiarities like this before, again though not 100% sure about that, although all of the examples I found used Tomcat or Weblogic.

Anyway I found another example which injected the EJB using annotations with a name mapping directly to the EJB

So I used

Using this I was able to directly inject a proxy into the controller without touching the configuration file.

Many, many thanks to Bill though because without his guidance I'd still be wandering about in the dark. Probable eaten by wolves by now
11 years ago

Bill Gorder wrote:I have never found the need to mix the 2. I just use Spring for all of my DI. I know it can be done, but I personally don't see the advantage in it. I would use one or the other personally.



Hi Bill,

Many thanks for your reply,

It was a great help. The sources confimed what I thought was the rightr way to go but always better having a wiser head show the path than to stumble around in the dark.

Anywho! totally agree with you that Spring is very good at handling everything I need for the project but then tah would be too easy!

Seriously the EJB were developed for another project I worked to learn the Struts framework and I wanted to re-use them instead of going the long route and re-building everything using spring, which would have been much easier.

Again many thanks.
11 years ago
Sorry
Posted before I could say a thank you to anybody able to point me in the right direction>
11 years ago
Hi guys,

I'm really hoping that somebody can explain this one to me I know that it's really simple but I'm missing the barn door somewhere, pardon the ranch reference! Anyway to explain. I'm using a simple system to learn spring which involves an online book library. The user logs in and the system uses custom validation, just grabbing user data from the DB to validate. The persistence layer is in EJB3.1 with the user entity, over that we have a @Stateful bean and a userFacade object implementing a UserFacade interface.

I have a service object which is a spring bean to handle the façade object.

The data is passing from the page to the service object's validate method quite happily but then I get a NullPointerException in the method call. This is because the façade object is not instantiated.

Can anybody point out where I am have lost the plot.
I have loads of books but they only go to spring 3.0 and I could use some advice here.

Do I need to use a lookup() with data in the applicationConfiguration file if so ok I know where to go for that info. If not what do I need to do.

The classes I have used are below for reference;-

UserContoller class



The userService class;-



The userFacade class;-

public UserFacade() {
super(User.class);
}

11 years ago
Hi Tim,

I understand what you mean, I have gone through the tutorials and have found them to be very well written and they have helped a lot. The trouble that I now have is that using the netbeans IDE, I went through the project using the wizard which has not really helped because it created facades for each of my tables as well as controllers session beans and entity beans. Which if I'm honest has done nothing to endear me to JSF as it has just caused massive confusion as to where I now need to place my method is it in the controller bean or the facade bean, adding to that what scope do I need to use.

Also what IDE would I be better off using because it is quite clear that using netbeans is not the best for the job after all.

Thanks
12 years ago
JSF
ok I can see sort of where this is going but I still need to get the parameter, so in my list of companies table there is a column which allows the user to view, edit, delete or to navigate to another page called List_1 that will dynamically create the table for the departments linked to the company chosen by the user. So I some how have to get the companyid, pass that to the bean which will then be used as a parameter to feed into the SQL query.
I have the query but have no idea how to grab the companyid which is an into when the user selects the department link, I can navigate to the required page but then that page has to return the table from the bean.

I have something like this in the page; <h:commandLink action="/department/Link_1" value="department"/>
<f: param= (what goes here, help) />

In the bean I have a query set up, to create the dynamic query and return the list<Departments> but I need to pass the id across to the bean, this where I am finding the fault.

If anybody can take the time to explain this I'd be really grateful, again many thanks. I'm sorry for going the wrong way around but I really wanted to ask for as little help as possible and try to work out what I needed to do, but I keep running into a brick wall.

James
12 years ago
JSF
Thank you sooooooo much I'll have a go with the first suggestion, if it doesn't work at least I'll have learned something else. I'll also have a look at the tutorials suggested.

Many thanks, hopefully I'll be able to get back to you soon and let you know how it goes.

James
12 years ago
JSF
Hi all,

I'm really hoping that somebody can help me with this one, I'm also hoping that this is not a re-post if so I'm sorry in advance.
The problem that I have is that I have developed a CRUD application with the netbeans ide using the JSF 2.0 framework what I have is a number of tables two called company and department, when the user clicks the link to view the list of companies I have set it up so that there is a link in the table for the user to view the departments linked to that company.

Can anybody advise me the best way to go about this because I want to be able to pass the company parameter which is the companyid to the system to pull out the view for the list of departments linked to that company via the foreign key companyid in the department table.

I am new to JSF so I need to have somebody who has the patience to explain this or even provide a link that will show what I need to go, I have an idea that it involves making use of an actionevent but after much Googling I can't see the wood for the trees.

Many thanks for any help with this.
12 years ago
JSF