This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!

Dale Seng

Ranch Hand
+ Follow
since Mar 22, 2004
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dale Seng

Bear Bibeault wrote:If you have put the JSTL jar (or jars depending on which version and where you got them) in WEB-INF/lib, they will be automatically found.

That was it. I knew I was being an idiot. I've been away from this too long!

Here are the corrected steps:

2. Download jstl-api-1.2.jar and jstl-impl-1.2.jar from http://jstl.java.net/download.html and put in project and put into WEB-INF/lib.
3. Java Build Path > Add Jars > jstl-api-1.2.jar, jstl-impl-1.2.jar

In "2." I just dropped the jars into the top of the project, and in "3." I made it so the build could "see" the jars. And in "3b." (which I didn't elaborate upon), I also had the jars deployed with the project (build path order and export tab). But they landed in the wrong spot.

Thanks for your help and patience. And I get it about the complexity

--Dale--
7 years ago
JSP

Bear Bibeault wrote:The JSTL is not being evaluated. Do you have the JSTL enabled for your project?

Thank you kind sir, for the analysis. As far as I know, yes, jstl is enabled. Before adding the jstl jar file, there was a syntax error, and after adding, it went away. So that's one bit of enabling. The top of the web.xml file looks right, as compared to ServletsWebXml, for Tomcat 6, which is another bit of enabling. I'm not sure how much more is required.

Bear Bibeault wrote:And why are you using JSP documents (the XML format of JSP) instead of JSP pages?

No reason except it looked the most complicated (so must be better ). I shan't do that any more.

So I tried this again, with a few differences. Regular JSP pages. Used the jstl jars for Tomcat 6 from JstlTagLibDefinitions instead of referencing the ones out of the Tomcat 6 directory.

1. Helios new dynamic web project version 2.5, "SWP2" (same)
2. Java Build Path > Add External Jars > (tomcat6 install)\lib\servlet-api.jar
3. Java Build Path > Add External Jars > (tomcat6 install)\webapps\examples\WEB-INF\lib\jstl.jar

2. Download jstl-api-1.2.jar and jstl-impl-1.2.jar from http://jstl.java.net/download.html and put in project.
3. Java Build Path > Add Jars > jstl-api-1.2.jar, jstl-impl-1.2.jar
4. new servlet com.drs.TestElServlet.java (same)
5. new jsp file (xhtml, xml, syntax) WebContent/ThingDisplay.jsp
5. new jsp file (html) WebContent/ThingDisplay.jsp
6. add [xmlns:c="http://java.sun.com/jsp/jstl/core"] to the [<jsp:root...>]
6. add "<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>" after the java language page directive.
7. between body tags, add c:forEach (same)
8. Double click a Tomcat 6 server, modules tab, add web module, select project (same)
9. Start the server (same)
10. Visit http://localhost/SWP2/TestElServlet with your browser (in my case localhost:9980, etc) (same)

11. I see this error:


Maybe it's some kind of configuration issue with the server, or something. I thought it was "just supposed to work", though. I'm going to download a fresh install of Tomcat 6, and see if that helps.

--Dale--

Edit: Fresh Tomcat 6 install did the same thing.
7 years ago
JSP
This is what I did, and it doesn't work (as in, look at the images at the end to see exactly what it looks like). It's a 10 minute job if you happen to have the same Eclipse version I'm using and Tomcat 6 already installed. I'm probably just being an idiot again, but dang if I can see it.

1. Helios new dynamic web project version 2.5, "SmallWebProject"
2. Java Build Path > Add External Jars > (tomcat6 install)\lib\servlet-api.jar
3. Java Build Path > Add External Jars > (tomcat6 install)\webapps\examples\WEB-INF\lib\jstl.jar
4. new servlet com.drs.TestElServlet.java


5. new jsp file (xhtml, xml, syntax) WebContent/ThingDisplay.jsp

6. add [xmlns:c="http://java.sun.com/jsp/jstl/core"] to the [<jsp:root...>]

7. between body tags, add


(presuming you have a Tomcat 6 server defined...sorry if you don't, not covering here)

8. Double click a Tomcat 6 server, modules tab, add web module, select project

9. Start the server

10. Visit http://localhost/SmallWebProject/TestElServlet with your browser (in my case localhost:9980, etc)

And I see this (unexpected...remember, we put "Thing 1", "Thing 2", "Thing 3"):


And in view source, I see this (hmmm, it "sees" the String[] object);


11. What say you?

--Dale--
7 years ago
JSP
Thanks Eric!

Eric Pascarello wrote:Mobile is not an easy thing

Yup. And the reason why I'm looking for severe guidance.

Eric Pascarello wrote:DO NOT try to make an existing page mobile with different stylesheets.

Wasn't planning on it, unless someone wrote a book on how great it works, and it really did work. But you're not the first one that said it's not a good idea.

My searching on Amazon didn't give me anything very promising. I already have a jQuery book, but it would be cool to get a "how to mobilize your desktop web app" book.

--Dale--
Looking for a book* recommendations to guide me in enabling a B2B web site for mobile browsers.

This probably is not much of a Java question, but I like this site; there are good folks here. So the "HTML and JavaScript" forum on JavaRanch is where I'll start. Hopefully this is the best place for this.

Just to set the stage.... there's this big site. Big, as in a lot of old jsp/servlet code with HTML and css that various folks have wrotten over a long span of time. That's my way of saying it's not a real tidy little setup. The users of the site are few, since it's for business to business. Nobody stumbles upon the site; it's invite only.

Then the business begins asking about making some of the site work on a bunch of different mobile devices. They don't want to spend too much (rules-out native apps so we're looking at making the site work on mobile browsers). So basically we've got to simplify the pages that will be mobile enabled, and limit the ability to get to other pages that will not be mobile enabled.

I figure I'm not the first one on this forum to have this kind of requirement. So, the question, has anyone found a book that guided them through the use of the usual tricks in style sheets, xhtml, etc to get this kind of effort done? I'm looking for something that can show various techniques and their advantages and disadvantages. I could just start putting a lot of "display: none" and see where that gets me, but I'm sure there are traps/gotchas that someone else has learned while "mobilizing" a web app like this. I'm less interested in a general xhtml book for mobile, and more interested in one that's got the perspective of not starting from scratch, but having an existing dynamic web site to get running.

--Dale--

(accidentally misspelled "written", above, and decided to leave the misspelling because it added to the substance of the sentence )

* Or classroom training!

I'm not sure the code that's posted answers the OP's question. The code shows that "user" and "password" are built into the LDAP context to "bind" to the LDAP data. That's step 1. Step 2 would be to USE that context to determine if any random user/password pair in that context are valid.

--Dale--
7 years ago
I'm in the south-east US and was looking for classroom training on "something".

Having been a Java developer for very many years, and my company not real interested in my learning another language, I'd probably not get away with going for one of Dick's Scala classes (although I think a functional language would be cool).

So I'm figuring I could learn more about being the version control master for our new SubVersion install (currently on CVS and would need to migrate). We've had some contractors that have been running the show there. My history with version control here, and various other gigs, has always been to just do what "they" (the version control masters) say. I know it's not rocket science, but if there was a classroom course geared toward industry (i.e. a few days...not a college course), that would be awesome. Even better if they taught it using the Eclipse plug-in, which is the way it would be used here.

Another option, again classroom training, would be to become an Eclipse Java/JavaEE ninja. I know what I need to know, but there's probably a lot on the table. I would want a course that assumed you knew the basics, and took you to the next level.

Yet another option would be JavaScript. I have just been dealing with it "when I have to", and I thought I didn't know anything about it. But I was largely bored going through the HeadFirst JavaScript book...maybe a few nuggets in there, but a JavaScript course would need to assume you knew a lot more than that book assumed you knew.

So...anyone take any classroom courses they would recommend?

--Dale--

Rob Prime wrote:A binary file transfer is basically the same as text transfer but without using Writer and Reader, but sticking to InputStream and OutputStream (possibly wrapped in other streams).


Thanks Rob, for the ideas.

As you see in my code, I'm just expecting GET requests and looking at the plain text of the request. If set-up for handling a POST, you suggest I use an input stream and pull the form data, where the other party will have stuffed the binary? Sounds like there's enough here to embark on a trial, but I would expect to be reinventing the wheel (and finding the same bumps in the road others have found). Would you (or anyone) have any suggestions on where to find some sample code?

--Dale--
I've got a program that's using POJO's to do a little web server that takes commands. It works great, and it's tiny. But I'm not sure how to extend it to accept an inbound file transfer. Can anyone give me some coding advice for binary file transfer (sans the advice to install a web server...sorry, just not going to do that, this needs to REMAIN tiny). Below is the code I'm using. It's not going to compile out of the box for you...here to give you an idea about what I'm starting with.



Howdy folks!

I've been using Eclipse Ganymede (Version: 3.4.2) Search > File Search a lot...works great...except...

Say you want two files (two tabs) in the edit window. You search for the first one, get a few hits, click 'Show Next Match' a few times, each file showing using the same window in the edit pane (reusing the edit window). In this case, reusing the same edit window is good.

Now you have found the first file you're looking for, it's open in the editor, and you go to Search > File Search again and put in the search criteria for the second file.

As soon as you click 'Show Next Match', the file you opened earlier is _gone_ with no apparent way to get it open again without searching for it again!

I know I can make a 'fake edit' to the file, and that edit window will not be reused when I click 'Show Next Match', but I don't like to make fake edits because then I have to wonder if I really changed something there.

So how is this supposed to be done?

--Dale--

Peter Johnson wrote:...ensure that the JSP editor is the default for that file extension.



Thanks for the reply. I've got it showing in the right editor, and it validates the stuff it "knows about", but just doesn't "know about" the stuff in the parent jsp. It seems like if the IDE could be told about the parent, it could validate "correctly".

--Dale--

Bear Bibeault wrote:I have moved this post there for you.



Thanks Bear.

So, to the folks here in IDE land, what about it? Any ideas?

--Dale--
Are there any IDEs that may be configured to enable validation and syntax checking of jspf files?

I understand the differences between an include directive and the jsp include (*), but I am pretty much stuck with jspf's.

So the question is about if any IDE has been made smart enough to handle validation (and the handy navigation) of fragments that are pulled in using the include directive.

You would have to tell the IDE which parent you were thinking about because of this situation:

NiceOne.jsp


NotNiceOne.jsp


IncludeMe.jspf


The default I've seen is to either not validate "IncludeMe.jspf", or the "line" variable cannot be resolved, irrespective of the existence of NiceOne,jsp or NotNiceOne.jsp

Are there any easy work-arounds?

--Dale--
You are so correct about doing homework first...It is the most efficient path.

Somehow I can't just go through this book (only EJB 2.1) with a EJB3 capable toolset on hand, without wanting to see if I can get it working the new way. Although this book has a lot of wisdom about how to develop web applications, having it written with old WTP and old EJB versions is a serious disadvantage. I think it actually makes it worse when they "tease" with only a few sentences that indicate you can get newer versions of your toolset and make the example project work there, and it will be so much cooler. I guess I'll just have to get a true EJB3 book ;)

In the mean time, I did get one more iteration of the project working. But, like the earlier version, I don't think the EJB3 stuff is right (an @Resource seems not to do anything). But most of what I was up against this time was using mysql instead of Derby, and the current Geronimo instead of (whatever they used in the book). I'm going to take this topic down a winding path now by laying out how to get this iteration working on Geronimo. The project has a little Hibernate stuff in there that I've just started with (not to be considered at all correct). The project works, albeit not using hibernate.

Here's the project:
Place to download Eclipse WTP Ch 8 Iteration 3 For Ganymede, Geronimo, MySql

I used Geronimo 2.1 as my container, and I used mysql as a database for this project. It seems that you MUST start Geronimo, log into the admin console (username:system, password:manager),and create a database pool (I called mine "jdbc/MyDataSource"). It seems that just putting the mysql connector jar (with the com.mysql.jdbc.Driver class) in the xml deployment descriptors is not enough. A database pool is required. I actually placed the mysql connector jar file in the appropriate directory under "repository" before creating the pool. Then, after you have configured the databse pool, you can click "Usage" from the list of pools, and it will tell you exactly what needs to be in web.xml and geronimo-web.xml.

Also, The maven-style paths under "repository" can be troublesome. Your jar file needs to have a version number on it (ie mysql-connector-java-5.1.7.jar). If you defined your "groupId" as "mysql", then under "<GERONIMO_HOME>/repository/", you would have a "mysql" directory (if you are unfortunate enough to name your "groupId" "com.my.stuff", you would need to nest "com/my/stuff"). Inside of "mysql", you need to create a directory matching the "artifactId", and inside of that, you need to make a directory matching the version (in this case "5.1.7"). Finally, you put your jar file in there. So we have:
"<GERONIMO_HOME>\repository\mysql\mysql-connector-java\5.1.7\mysql-connector-java-5.1.7.jar"
I'm sure glad this is simplified to such a great extent!
Now, you would think that the following dependency would work:

.... but you would be WRONG!

You need to include things something like this in the geronimo-web.xml:
...



and in web-xml:

(as I mentioned above, the Geronimo Console will give you these details after you define the pool).

Here are some of the things I saw in my trials, for the googlers of the world:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Missing dependency exception
Unable to resolve resource reference res-ref-name
Missing dependency: mysql/mysql-connector-java
java:comp/env/jdbc resource-ref

--Dale--
[ November 23, 2008: Message edited by: Dale Seng ]