John M. Gabriele

Ranch Hand
+ Follow
since Feb 18, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by John M. Gabriele

> Did you consider the varStatus attribute?

Hi Stefan. I'd used varStatus in the past to tell whether I was at the last iteration ( <c:if test="${status.last}"> ), but forgot that I could also get a count from it. Thanks. Incidentally, I notice from reading some docs that status.count gives you a 1-based, not 0-based, count.
[ September 01, 2005: Message edited by: John M. Gabriele ]
19 years ago
JSP
Za! How did I miss that... Thanks for the reply Bear.

Also thanks for the alternate suggestion. In my case though, it's a bit more complicated, and I need my <c:forEach> index for something else. If you're interested,.. I've got this big list of items I'm looping through:

for example, an alphabetized list of names:


and the page I'm rendering has a fixed number of columns of text to place those items in -- that is, say, 4 columns for each letter. After we're done with the A's, put in a <div> and move onto the B's. And so on.

The "counter" variable is there to tell me how many items I've written in a given column (i.e. "you've written 4 A's so far") -- when it hits some predetermined number (like, say, 5 items for this column), extra logic comes in to end the current column and start a new one.

Thanks again,
---John
[ August 31, 2005: Message edited by: John M. Gabriele ]
19 years ago
JSP
I want to use an int (or Integer) in my JSP to act much like a counter inside a <c:forEach> loop. I'm trying to do something like this:



But it's not working. I'm getting an exception:

"foo.jsp(49,4) According to TLD or attribute directive in tag file, attribute var does not accept any expressions"

Where line 49 is noted in the above code snippet.

How can I use a simple int in my JSP?
19 years ago
JSP
Ok, dunno if this is the optimal solution, but here's
what's working for me at the moment:

Created a properties file for log4j:

[some_machine:/home/sanchez/tomcat/webapps/axis/WEB-INF/classes]$ cat log4j.properties
log4j.rootLogger=INFO, some_dest
log4j.appender.some_dest=org.apache.log4j.FileAppender
log4j.appender.some_dest.File=/home/sanchez/tomcat/logs/logariffic_stuff.log
log4j.appender.some_dest.layout=org.apache.log4j.SimpleLayout

and my code (my single .jws file, containing one class), has this
instance field:

private Logger log;

and then, sprinkled throughout the methods is:

log = Logger.getRootLogger();
log.info( "So-and-so *just* happened. You *just* missed it!" );
19 years ago
How do I just do simple logging from my Axis web service?

For a simple servlet, in the past I've used:

ServletContext context = getServletContext();
context.log( "[Interesting and useful log message goes here]" );

I see that I've got the log4j-1.2.8.jar in my axis/WEB-INF/lib directory.
I suppose I could just do a getLogger() call in my web service object's
methods... Hmm... when using log4j, where is that getLogger() call
supposed to go? Is my web service object persistent between
invocations of the web service methods? Should I be using a private
Logger instance field?

An Axis (v1.x) wiki page has a small amount to say on the matter:
http://wiki.apache.org/ws/FrontPage/Axis/LogWithServletEngine
but it doesn't contain the basic information I'm looking for.

Thanks.
19 years ago
> The article (and its predecessor - the article is the second in a two
> part series) is really interesting for anyone "late to the game" on Web
> services.

Great link. Thanks. The link to part 1 of the article was broken, so I had
to google for it:
http://www.webservices.org/index.php/ws/content/view/full/2427

Ulf wrote:
> Basically everything that goes into the deployment descriptor can't be
> done, because you don't have one.

Ah. Thanks.
19 years ago
> - Once you dig into axis a little deeper, migrate away from .jws.

Why?

The official docs say to do that, but they really don't go into the reasons why.

> - My impression is that UDDI so far failed to take off, and it's mostly
> applicable to web services where there is no direct contact between the
> people who run it and the people who access it: probably a small percentage
> of all web services currently in existence. You can ignore it for the
> moment.

That's my impression too.
19 years ago
I'm curious about folks' experiences with Apache Axis.

I just created a small simple web service. One class, deployed as a .jws file, and the client just calls instance methods of the class. No session/persistence. No objects. Just remote function calls. Using Axis this way seems pretty simple.

Writing a client looks to be pretty simple too, but I haven't had to do that yet. It looks like you just:

- use the WSDL2Java program, and

- point it at your MyService.jws?wsdl

- then use the resulting classes/interfaces from your own short hand-written MyClient.java class.
(I outlined that procedure here: http://wiki.apache.org/ws/FrontPage/Axis/WritingYourClient -- in fact, if there's any clarification you can add to that, please let me know; either here or by updating that wiki page)

Anyhow, I'm curious to hear other people's experiences with Axis. My guess is that as soon as you get off the beaten path, the trail gets rocky.

Folks on the ML talk about WSDL sometimes, but I don't understand why -- I thought the whole purpose of Axis was so that you didn't have to touch XML or WSDL anymore -- you could just do RPC and have Axis take care of the details.

No idea about UDDI. The client knows who it'll be talking to, and the web service only expects that one client to be contacting it. At least, that's the way it is for my simple web service.

Any commentary is appreciated.
[ August 05, 2005: Message edited by: John M. Gabriele ]
19 years ago
Thanks for moving it over to this forum Bear.

Re. page-break-after, I don't know much CSS, but I'm looking here:
http://www.w3schools.com/css/css_ref_print.asp
http://www.w3schools.com/css/pr_print_pageba.asp
for now. Our html graphics guy might be able to make that work.

I'd considered trying to use some sort of html2pdf conversion... or maybe
generating the pdf directly myself (not sure how to get the jsp page to
do this -- I could see how a perl cgi script or a servlet might work...).

Another option might be this: have our jsp page estimate (using number of
chars in the body) how much it can fit in one printed page. The resulting html
page is a form and has a button at the bottom -- click the button to re-
process the request to the jsp page and get the next page...

Man I hope that page-break-after works.
I've got a little jsp page that creates something like a customer receipt. It displays a header, then a bunch of order info. Sometimes that order info is long enough to take up an extra page when you actually print it out onto our nice letterhead.

Trouble is, my jsp page doesn't know anything about printed pages nor page breaks. If the web page that it spits out is longer than will fit on one printed page, and then you print that page, the 2nd page just prints (as expected) right on top of the nice header area on the letterhead.

Is there any way to bridge the gap from jsp --> html --> printing correctly (ex. "on pages after the first, start printing 2 inches down from the top of the page")?

I read this thread:
https://coderanch.com/forums/
but Bear didn't give any more details on how he might use CSS for such a task.

Maybe I'm looking for some kind of "page break" html tag?

Thanks.
Thanks for the informative replies fellas.

Nick wrote:
> No, JWS isn't applet. It's actually application which handles specific
> MIME type (jnlp).

Ah. So, it sounds like a browser plug-in/app that talks to your Java implementation (giving it special instructions) when you click a certain type of link.

Sounds like it's got some "phone home" stuff built-in too (for updating the app if it needs updating).

If you've got a link to the JWS-tied app on your desktop, it sounds like that link must actually run this local JWS program, which then by proxy runs the actual app.

I guess for 90% or so of computer users out there, JWS might be nice to save them from having to choose a place on their hard disk to save a .jar file, and then run it. Those same folks might also like the fact that an app can update itself when you run it (presumably asking you in a popup dialog if you want to update it).

For me though, I'll just stick with "gij -jar Foo.jar" (or "java -jar Foo.jar depending on which implementation I'm using). I haven't ever bothered trying to figure out how to put icons on this IceWM desktop of mine, so I never really double-click anything anyway.

Thanks again.
---J
19 years ago
Colin, to help other folks who might be following this discussion, it's best to keep your reply in the original thread. When I first started reading your thread, it starts right in with "That solution is even worse", but I didn't know what "that solution" was.

That said, here we are now, and you're trying to plot points with Java Swing/AWT. I'm about to be trying the same thing. What Ryan suggests is all I can find for the moment, so that's what I'm going to try soon too.

If it works out for you, please post some sample code for us.
19 years ago
I'm just getting back into Java from a hiatus doing other sorts of computer work, and I'm aware of two ways to run Java programs. 1. Download and run a .jar file, and 2. as an applet (not used much anymore).

.jar files are double-clickable in Mac OS X, and I'm guessing you can also just download and double-click them in that other weird alternate "MS Windows" OS as well. In GNU/Linux you still usually have to run them "java -jar foo.jar" unless you set up your desktop environment to do something special with .jar files.

What is this "Web Start"? And why is it necessary? I just took a look at what I suppose is the beginning of the docs for it ( http://java.sun.com/j2se/1.5.0/docs/guide/javaws/index.html ) but I still don't know what they're talking about. But the only relevant-looking stuff it says there is:

Java Web Start is an application-deployment technology that gives you the power to launch full-featured applications with a single click from your Web browser. You can now download and launch applications, such as a complete spreadsheet program or an Internet chat client, without going through complicated installation procedures.



So, is it an applet that checks if you have a jar file present on your system (scanning your hard disk's appropriate directories maybe?), and downloads it if it isn't present?

They talk about "complicated installation procedures". Just download and double-click a .jar file. What's so complicated?
19 years ago
Thanks for the quick replies.

Right. I'm using the newer JSP 2.0 implementation where I can just whip up a .tag file rather than having to make a java class. That is, I've got that:

<%@taglib prefix="foo" tagdir="/WEB-INF/tags" %>

directive at the top of my .jsp file already for another .tag file that's being used.

Rusty, regarding your example .tag file, shouldn't

<%@ attribute name="myTest" required="true" rtexprvalue="true" %>
be
<%@ attribute name="theTest" required="true" rtexprvalue="true" %>

and shouldn't your example tag file be named myTagFiles.tag instead
of include.tag?

The way it is on my system, in your JSP page, you just mention the prefix and
then the WEB-INF/tags directory in the directive at the top of the JSP file. After
that, any tag you use, like <foo:za>, gets implemented in a WEB-INF/tags/za.tag file.

Also, what does rtexprvalue mean?
19 years ago
JSP