Win a copy of Head First Android this week in the Android forum!

Tom Hilliard

Ranch Hand
+ Follow
since Feb 03, 2012
Tom likes ...
Netbeans IDE Postgres Database Tomcat Server
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
8
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tom Hilliard

Hi all,

Firstly, I'm not sure this is the correct part of the forum for this question so feel free to move if not.

Now I have a web app made up of servlets, JSPs and a postgres DB that I want online. Can someone point me to some providers that they can "vouch" for?

Regards

TH
9 years ago
And I did question my method when I was copying code... Can I do this once is what I asked myself. Could you point me to a reference I can have a read on? Im guessing I can create the form once and call it as and when?

Cheers

TH
9 years ago
JSP
missing from editaccommodation.jsp! FACEPALM! God knows how that ended up like that. I had sat and gone through the source of both but obviously overlooked the standard declarations (or whatever the <meta> bit is).

Cheers Bear, works as expected now.

Regards

TH
9 years ago
JSP
Hi all,

I have addaccommodation.html which is a simple form to take the details of an accommopdation.



Which produces this SEE ATTACHMENT Add Accommodation... Notice the map feature to set the lat and long.

Now, once an accommodation has been added I want to be able to edit it. So I copy and paste the code from addaccommodation.html to editaccommodation.jsp. Then I add the EL to use the parameter to prefill the form to give me this SEE ATTACHMENT Edit Accommodation

The code for editaccommodation.jsp


Now my problem is that the map is not appearing on editaccommodation.jsp and I'm struggling to understand why as its copied and pasted from a working page (map shows on addaccommodation.html)

Any help with this to get the map showing on editaccommodation.jsp would be greatly appreciated

Regards

TH
9 years ago
JSP

Paul Clapham wrote:Actually I wouldn't have returned any kind of List for that requirement. You need something with a name, a city, a county, and a postcode? Then create a Java bean class which has those properties, and just use the properties in your EL. Using a List (or an array) is what beginners do before they learn that Java is an object-oriented language.



I need a list of those things mentioned, an owner can have may accommodations. Is that possible using beans? I've heard of them but don't know exactly what they do!

TH
9 years ago
JSP

Bear Bibeault wrote:

As to the original issue, we need more info. What exactly is owneraccomms, and how is it being established as a scoped variable?

(Also, I advise to rethink your naming. "owneraccomms" not so good.)



Sorry Bear, I obviously didn't make myself clear in saying I've solved my issue. I thought that a List was like an array (1 column). What I didnt realise is that I could call and element index. So I am now doing this


Which prints this output


Instead of

which I was getting before.

Interms of the Attribute name owneraccomms, what is wrong with that and can you suggest something better if you know it is a List of accommodations an owner owns, each accommodation in the List has a name, city, county and postcode. The List is set in the request using setAttribute()

Regards

TH
9 years ago
JSP

Bear Bibeault wrote:You should not need to return the specific List implementation. In fact, doing so is a rather poor practice. DId that actual end up making a difference?



It makes no difference whether returning a List or ArrayList, I get the same result for either.

So what your saying is I don't need to return specifically an ArrayList, just a List?

EDIT: I have changed my methods to return a List and I still get exactly the same result, is this better practice? And why is it?

Regards

TH
9 years ago
JSP
I think I may have figured it out.

I have changed my methods to return ArrayList instead of List.

Then changed my El to



Which results in Accommodation Name being printed by itself :)

TH
9 years ago
JSP
Hi all,

So I have a method that returns a List to a servlet. The servlet sets the List in the request for use on a JSP.

Now my problem is this, I use EL to print the values of the List using



Now this prints [Accommodation Name, Accommodation Town, Accommodation County, Accommodation Postcode]

Is there a way to access the elements within that row individually(using EL)? So I can print "Accommodation Name(As a href to another page), Accommodation Town, Accommodation County, Accommodation Postcode" without the square brackets

If not, I assume that because its a List I can't access the individual elements of each row? Does this mean I need to use ArrayList instead?

Regards

TH

9 years ago
JSP

Prasad Krishnegowda wrote:Google sending email in java, you will get lot of links, try them, then if you have any questions or doubts, post them, people here will be happy to help you.
Please SearchFirst and ShowSomeEffort.



Like me you are relatively new here, so a little pointer you have to show some effort towards solving your problem. Because people are here to help, not write your code

Hint: http://www.google.co.uk/#hl=en&sclient=psy-ab&q=javamail&pbx=1&oq=javamail&aq=f&aqi=g-e2g2&aql=&gs_sm=3&gs_upl=6033l7108l0l8269l8l5l0l3l3l0l131l414l4.1l8l0&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=6f92152f78004c6d&biw=1920&bih=918

Regards TH
9 years ago
Ah cool, didn't realise .name was available. I have looked for at buying a domain as I'm hoping my final project will have some commercial porspect so it will definitely be something to look out for, but for the purposes of the project any meaingful name will do.

Just looked and com.3rdyearproject.web is not valid, can't start a package name with a number or symbol character

com.dissertation.web & com.dissertation.model have been chosen

TH
9 years ago

Bear Bibeault wrote:The convention of using reversed domain names is in order to avoid collisions with someone else's packages. Generally, you use a domain that you own, because that guarantees uniqueness. No one else can own that same domain.

For example, I own bibeault.org, so my personal projects use a package structure that follows: org.bibeault.project-name... where project-name is the name of the project to which the package belongs. E.g. org.bibeault.frontman, org.bibeault.resume, org.bibeault.bddb, org.bibeault.discovery, and so on.

When I'm working on a client's project, the packages are named using one of the client's domains.

If you don't own a domain, you should. You can't be considered a serious web developer if you don't own at least one domain.



Cheers for the info, I'm currently a student, without a plan to go into web development... But it may happen.

So for the sake of my project it can be com.tomh.web? or something more meaningful com.3rdyearproject.web?

Regards

TH
9 years ago
Quick question regarding naming conventions.

eg, In the scenario explained above I name my packages com.example.model & com.example.web

What I'd like to clarify is do I replace the "example" bit with something meaningful? Like my project's name or something similar?

So the package would be called com.somethingmeaingful.model & com.somethingmeaningful.model?

Regards

TH
9 years ago
Thanks for the help guys, got there in the end...

Now to get on translating my old model app to the new model

I'm expecting to stumble upon some issues here and there so expect to hear from me again ;P

Once again, absolutely brilliant work guys, JavaRanch... What a great resource!

Regards

TH
9 years ago
Have it working as expected now, was using the wrong uri in the taglib declaration... whoops!

Thanks for the help guys.

Now I'm going to post all the code that makes up the app... Could you please tell me that it conforms to the most uptodate model?

form.html


BeerSelect.Java


BeerExpert.java


and finally, result.jsp


So is this it? The wonderful new Model 2? or have I still got work to do?

Very Much Appreciation

TH
9 years ago