Mark Kelsall

Greenhorn
+ Follow
since Apr 23, 2011
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
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mark Kelsall

Again you're right Stefan! I revisited it & stepped through it with a bit more patience instead of wanting it to work out of the box (like you always do when you get so frustrated that you post it on a forum).

Anyway thanks for your help, much appreciated :)

Mark
11 years ago
JSP
Hi Paul,

Thanks for your reply. Yeah I understand that it actually isn't at the root of the application folder tree & i only typed it like that just because I was being lazy :P I've got it all set up architecturally OK & working, I was just lacking this missing piece, which Stefan has been able to help with!

Stefan, that's brilliant, I never knew about that! Yeah I know that a framework is the way forward, but i'm still learning so I want to understand all the intricate bits "under the hood", i'm a geek like that, but aren't we all!

Edit: I have tried the code now but it unfortunately doesn't work out of the box. If for example my controller servlet is defined as follows



in my web.xml. How would I be able to submit to that from a jsp page in the root WebContent folder & also one in register which is a sub-folder of WebContent???

Thanks
11 years ago
JSP
hi guys,

i appreciate that this is probably going to be a very straight forward answer or point in the right direction but i'm struggling to find the right words to search in google.

I want a form & i want to submit to my controller serviet (straight forward enough) but the complication is that my form is in a folder & obviously the servlet is at the application root. Let me give you an example:

folder structure:
root:
web-inf/
meta-inf/
css/
register/
register.jsp

i have a form on the register.jsp & i want to submit it to my servlet which obviously lives at the root. What do I need to put in the action of the form to get it to submit to the root?

Thanks in advance

Mark
11 years ago
JSP
Hi Tim,

thanks for your reply (seems to be always you! lol).

Just to understand what you explained, the action method that fires, this would be the action method in the request-scoped bean?

That definitely seems like the best way to do it! To resolve the problem as quickly as possible I have unfortunately resorted to getting & setting session variables in the action methods, there's only 2 to set (I was pushed for time for a solution, what you gona do?!).

I will definitely be using that implementation in the future though! Thanks Tim!

Mark
11 years ago
JSF
Hi guys,

I have a scenario where I have a managed bean that is request scoped so I can read a variable from the URL & then query the database. I then map the required fields onto the page, works perfectly. I then however want to pass some of those details onto the next page, how can I do this? I have googled around & found a few different pages on here but I wasn't able to apply the thinking to my scenario & obviously didn't want to wake the sleeping zombies!

How can I pass a variable from a request scoped bean, on to a session scoped one?

Thanks

Mark
11 years ago
JSF
Thanks for your feedback, I appreciate it!

I understand that a datatable would be best data wise, but not so visually, especially when it comes to displaying on a mobile.

I think that I unfortunately will have to go down the datatable route & bow to common practice.

Thanks Tim!
11 years ago
JSF
Hi Tim,

Thanks for your quick response.

Let me try to explain my situation & current thinking of implementation:

JSF web project that has a managed bean with EJB dependency injection to call a service that will access a database. - This bit works fine.
The service returns a list of an object & that in turn needs to be displayed on the UI for the user to select (hence the need for ul, li elements). This is the bit where I realised I had a problem & went to facelets for an answer, straight JSF doesn't seem to implement the html ul, li tags (as far as I can see).



This is currently how I am calling the managed bean that is registered in my faces-config.xml

Would you be able to suggest an easier implementation method to represent these elements?
I have not got to the level of creating my own tags, is this what you are suggesting?

The reason I'm so adamant about using ul, li elements is because of the look & feel that is provided with jQuery Mobile.

Thanks

Mark
11 years ago
JSF
Hi guys,

I have been playing around with using JSF for a while & get some of the basics. However, I'm in a position where I want to display a list, as in (ul, li). i did a bit of googling & found that facelets was the best was to implement this.

So there I was, creating .xhtml pages & watching them work fine in my browser on my laptop & then I tested it in Safari on a generic iPhone & it doesn't work! So when I say it doesn't work, I mean that the jQuery Mobile UI doesn't render & it just displays the basic html. It turns out that this is a problem with jQuery Mobile not being able to parse the file properly (or something to that effect). I have googled around for some answers to this & found various different articles stating, try this, try that, & they don't seem to work.

So here I am & asking the question:

Can facelets be used/rendered on another file type? For example .jsp or .html or jsf or anything instead of .xhtml?

Any advice would be great, feels like I'm

Thanks in advance

Mark
11 years ago
JSF
Hi guys,

I've got what i would have thought to be a question with an obvious answer.

How can you display list data on a JSF page without using the <h:datatable> tag?

I tried using div but it doesn't like that (may be i did something wrong)

What i'm essentially trying to obtain is a nicer way of displaying list data than in a table (it's so old school)

If anybody can shed some light on the matter this would be great!

Thanks

Mark
11 years ago
JSF
Thanks Tim,

Sorry for all these newbie questions but i just can't seem to find one way to structure my web app.

I guess i understand it a bit better now.

Another quick question, i've noticed the managed beans have different annotations when i've tried different examples & they don't seem to work for me cos my IDE (eclipse) doesn't know about these annotations...do i need to create these @interfaces?

Thanks

Mark
11 years ago
JSF
Thanks guys, i wondered why it was proving so hard to find lol.

So if i have a POJO that i use to process the request (once it has been submitted to my servlet (not faces servlet) controller & been redirected based on my action) to do CRUD etc if i'm processing a form but don't have any sort of controller for users clicking links in the site, how can i do this?

I guess there's 2 questions in there:

1. How can my POJO class that does processing, instantiate the managed bean & set the user variable & then the JSP/JSF use that same instance?

2. Should i be using a controller for every click, even hyperlinks? I guess if i do & i submit to a controller which can instantiate the managed bean then that seems sensible.

Cheers guys

Mark
11 years ago
JSF
Hi guys,

I've been looking around for this for quite some time now but i'm not sure this is exactly the right method.

I want to pass a value to my managed bean without user interaction, i've seen how it is done with user interaction, but without is the tricky one. My scenario is, the user has logged in, they now want to see a list of details on the database based on their logged on user. The parameter that i want to pass is in session. How can i get access to this to set it without user interaction?

Thanks

Mark
11 years ago
JSF
Quick update, I figured out how i pass the request/session variables through to the bean, well i think i have. However the @PostConstruct method doesn't seem to fire when the bean is initialised. Like i said, i'm on tomcat 6, any particular set up that i need to do?

Thanks

Mark
11 years ago
JSF
Thanks Tim,

I just so happen to be running tomcat 6 so it supports @PostConstruct so that helps.

For a newbie it seems the @PostConstruct is the way to go to get things moving & get a good enough understanding. My only problem is if the bean needs to access session or request parameters how do i pass these?

Would it need a HttpServletRequest variable in the bean or is there another way?

I'm a little dubious towards using JSF because i cannot set the file extension to .jsp. I have got to grips with using basic JSTL so far but i guess it's just the newbie sticker that i still wear.

Thanks

Mark
11 years ago
JSF
Thanks for getting back to me Tim (sorry it took so long),

I'm still at a loss as to whether JSF is the right strategy to implement simply showing data from the database.

At the risk of sounding like a newbie that is just looking for quick answers:

A standard method of displaying data is what i desire, whether it be JSF, JSTL or something else. Is there no standard web "shop" pattern that is always used when displaying data?

The @PostConstruct is EJB3.0 right? I understand that but where & how that would be implemented still escapes me.

The previous View's action processor would surely need to put all the data into the session context which seems a bit vulgar if you have lots of objects with parameters etc.

The "cache-style" get method approach sounds OK but slightly hackish (if that even makes sense). Even though the get / set methods would have logic in them, they would only be beans & these could be using DAO services. I have tried this in JSTL, it works to some extent but i can't seem to be able to pass variables to parameters, that's besides the point anyway (and i can always post that to the brilliant minds of code ranch :P

I'm still looking to just know i'm going down the right "standards" track.

Thanks

Mark
11 years ago
JSF