comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* newbie - Servlets - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9871d1fe64dbaa63
* Stubs and Skeleton Eclipse - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/28950846f584e84b
* Java and xmlrpc? - 3 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e4304527fb69e181
* Java speed vs. C++. - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e29354c898cb3523
* Best inputstreams/outputstreams for sockets - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/25e4c1fd06119847
* [OT] Using hobby source code in your job ? - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4
* Java and Autonomy - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e0f9cc3c246f2a2
* Javascript - Form - upload file error - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74a4c48757cb2d60
* "static" prefix - to parallel "this" prefix - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5dde10882ac2157
* Sockets - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edecab678cd31cd6
* how do I set the encoding for javac ? - 2 messages, 2 authors
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6ad9532343fc5919
* Need help w. the JSTL c:out tag. - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2bb8e9c8c521f2fd
* JSF version of JSTL forEach? - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/12c3510dbb3c55d4
* RegEx partial matching - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14069fafc93c4493
* Dynamic Data Exchange in java to link to windows application - 1 messages, 1 
author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d2ffb69843ba63b
* Delete a panel inside a panel (2) - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/39f13ffc05d5cc4
* Where to place configuration files when using WAR-Files - 1 messages, 1 author
 
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74dc1db3e419defd

==============================================================================
TOPIC: newbie - Servlets
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9871d1fe64dbaa63
==============================================================================

== 1 of 2 ==
Date: Tues, Dec 7 2004 8:57 am
From: [EMAIL PROTECTED] (Xarky) 

Hi,
  I have just downloaded and installed Tomcat 5.0.30.  I entered on
the link localhost:8080 and followed some links and examples provided
over there.  The worked fine.

Now I would like to create my own servlets.  Just to start off I am
trying a hello world program(I know that this is available).  I am
trying the following code.

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class MyHelloWorld extends HttpServlet
{
        public void init(ServletConfig c)
        {
                (c.getServletContext()).log("HelloWorld servlet initialized");
        } // end method init
        
        public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException
        {
                response.setContentType("text/html");
                PrintWriter out = response.getWriter();
                out.println ("<html>");
                out.println ("<head>");
                out.println ("<title>" + "My title" + "</title>");
                out.println ("</head>");
                out.println ("<body bgcolor=\"white\">");
                out.println ("Hello World !!!!");
                out.println("</body>");
                out.println ("</html>");
        } // end method doGet
        
} // end class MyHelloWorld

I saved this program with .java extension and compiled it succesfully.
 Now what should I do to have access to it on my web browser.



Thanks in Advance



== 2 of 2 ==
Date: Tues, Dec 7 2004 7:40 pm
From: "PerfectDayToChaseTornados"  

"Xarky" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Hi,
|   I have just downloaded and installed Tomcat 5.0.30.  I entered on
| the link localhost:8080 and followed some links and examples provided
| over there.  The worked fine.
|
| Now I would like to create my own servlets.

<snip>
|
| I saved this program with .java extension and compiled it succesfully.
|  Now what should I do to have access to it on my web browser.
|
|
|
| Thanks in Advance

Read the Tomcat application developers guide (Deployment section) here
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/appdev/deployment.html

good luck
-- 
-P
"Programs that are hard to read are hard to modify.
  Programs that have duplicated logic are hard to modify.
  Programs with complex conditional logic are hard to modify"

( Kent Beck)






==============================================================================
TOPIC: Stubs and Skeleton Eclipse
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/28950846f584e84b
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 5:59 pm
From: "Dirk Gerrit Oort"  

put the rmic under External Tools and set the working dir and the arguments. 
when the rmic has done his work press f5(refresh) and you will see the stub 
and skeleton in the package explorer

-- 
D.G. Oort
"ilyas" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
> Hai,
>
> How can i create stubs and skeleton(s) in the Eclipse 3.0 IDE?
>
> I have a implementation class and i'll create stubs and skeletons (for
> RMI connection)
>
> Thanx for all suggestions.
>
> Greatings from Holland,
> ilyas 






==============================================================================
TOPIC: Java and xmlrpc?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e4304527fb69e181
==============================================================================

== 1 of 3 ==
Date: Tues, Dec 7 2004 9:06 am
From: "shakah"  

Sorry, didn't see your post. If you're still interested...

client-side (stand-alone Java app):
org.apache.xmlrpc.XmlRpcClientLite xrc_ = new
org.apache.xmlrpc.XmlRpcClientLite("http://www.acme.com/xmlrpcurl";) ;

java.util.Vector vParams = new java.util.Vector() ;
java.util.Hashtable ht = new java.util.Hashtable() ;
ht.put("environment", sEnvironment) ;
ht.put("authData", sAuthData) ;
vParams.addElement(ht) ;

String sToken = (String) xrc_.execute("myserver.attach", vParams) ;

server-side (Tomcat, actually in a JSP):
// ...XML/RPC handler class
public static class MyHandler {
public String attach(java.util.Hashtable h)
throws java.security.NoSuchAlgorithmException
,org.apache.xmlrpc.XmlRpcException {
try {
// ...the required args
String sEnvironment = (String) h.get("environment") ;
String sAuthData = (String) h.get("authData") ;

// ...etc

return "return value" ;
}
catch(NullPointerException x) {
throw new org.apache.xmlrpc.XmlRpcException(-2, "missing
\"environment\" or \"authData\" parameters?") ;
}
catch(ClassCastException x) {
throw new org.apache.xmlrpc.XmlRpcException(-2, "unexpected
\"environment\" or \"authData\" parameter types?") ;
}
}
}

// ...one-time init
private static org.apache.xmlrpc.XmlRpcServer xrs = null ;
if(null==xrs) {
xrs = new org.apache.xmlrpc.XmlRpcServer() ;
xrs.addHandler("myserver", new MyHandler()) ;
  }




== 2 of 3 ==
Date: Tues, Dec 7 2004 11:40 am
From: "shakah"  

To clarify the "one-time init" code snippet -- the JSP more-or-less
does:

if(null!=request.getContentType() &&
request.getContentType().equals("text/xml")) {
if(null==xrs) {
xrs = new org.apache.xmlrpc.XmlRpcServer() ;
xrs.addHandler("myserver", new MyHandler()) ;
}

byte [] abResult = xrs.execute(request.getInputStream()) ;

response.setContentType("text/xml") ;
response.setContentLength(abResult.length) ;
out.clear() ;
out.write(new String(abResult)) ;
    out.flush() ;
  }




== 3 of 3 ==
Date: Tues, Dec 7 2004 12:02 pm
From: "shakah"  

To clarify the "one-time init" code snippet -- the JSP more-or-less
does:

if(null!=request.getContentType() &&
request.getContentType().equals("text/xml")) {
if(null==xrs) {
xrs = new org.apache.xmlrpc.XmlRpcServer() ;
xrs.addHandler("myserver", new MyHandler()) ;
}

byte [] abResult = xrs.execute(request.getInputStream()) ;

response.setContentType("text/xml") ;
response.setContentLength(abResult.length) ;
out.clear() ;
out.write(new String(abResult)) ;
    out.flush() ;
  }





==============================================================================
TOPIC: Java speed vs. C++.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e29354c898cb3523
==============================================================================

== 1 of 2 ==
Date: Tues, Dec 7 2004 11:12 am
From: "Dan Elliott"  


"Mike Cox" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi.  I recently ran a benchmark against two simple programs, one written
in
> Java and the other in C++.  The both accomplish the same thing, outputting
> "Hello World" on my screen.  The C++ program took .5 seconds to complete
on
> my 400 Mhz PC while the Java program took 6.5 seconds.
>
> I am running the SUSE 8.2 Linux distribution.
>
> Why is Java that much slower than the C++ program?  I read on Slashdot
that
> Java was almost as fast as C++.  Here are my programs:
>
> test.cpp
>
> #include <iostream>
> using namespace std;
> int main()
> {
>         cout<<"Hello World";
> }
>
>
> test.java
>
> public class test
> {
>         public static void main(String[] args)
>         {
>                 System.out.println("Hello world");
>         }
> }
>
> The reason I ask is because I'm thinking of using Apache and Jakarta to do
> some development. If Java cannot be speeded up, I will be forced to find
> another alternative.
>
>
>
>
Mike,

This is a truly pathetic test.  I am not sure you could learn ANYTHING of
value from it.

- dan elliott





== 2 of 2 ==
Date: Tues, Dec 7 2004 5:48 pm
From: Joona I Palaste  

Dan Elliott <[EMAIL PROTECTED]> scribbled the following
on comp.lang.java.programmer:
> "Mike Cox" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Hi.  I recently ran a benchmark against two simple programs, one written
> in
>> Java and the other in C++.  The both accomplish the same thing, outputting
>> "Hello World" on my screen.  The C++ program took .5 seconds to complete
> on
>> my 400 Mhz PC while the Java program took 6.5 seconds.
>>
>> I am running the SUSE 8.2 Linux distribution.
>>
>> Why is Java that much slower than the C++ program?  I read on Slashdot
> that
>> Java was almost as fast as C++.  Here are my programs:
>>
>> test.cpp
>>
>> #include <iostream>
>> using namespace std;
>> int main()
>> {
>>         cout<<"Hello World";
>> }
>>
>>
>> test.java
>>
>> public class test
>> {
>>         public static void main(String[] args)
>>         {
>>                 System.out.println("Hello world");
>>         }
>> }
>>
>> The reason I ask is because I'm thinking of using Apache and Jakarta to do
>> some development. If Java cannot be speeded up, I will be forced to find
>> another alternative.
>>
> Mike,

> This is a truly pathetic test.  I am not sure you could learn ANYTHING of
> value from it.

I agree. The overhead of starting the Java process and creating a VM is
way too large in this test. Try to print "Hello world" one million times
in a loop for a fairer test.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"Make money fast! Don't feed it!"
   - Anon




==============================================================================
TOPIC: Best inputstreams/outputstreams for sockets
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/25e4c1fd06119847
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 5:35 pm
From: "Bruce Lee"  

Does anyone know what are the best inputstream/outputstreams for writing a
stream of ASCII text to sockets? I mean, you can stick different streams
together in different combinations.






==============================================================================
TOPIC: [OT] Using hobby source code in your job ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a60dfe865a7807c4
==============================================================================

== 1 of 2 ==
Date: Tues, Dec 7 2004 11:25 am
From: "Stephen Sprunk"  

"Mark McIntyre" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Mon, 06 Dec 2004 01:10:09 GMT, in comp.lang.c , "Andrew Koenig"
> <[EMAIL PROTECTED]> wrote:
>>If your employer changed their mind about this policy, there wouldn't be
>>much you could do about it short of leaving.
>
> Under UK and EU law, they can't do that without asking you to sign a new
> contract, and you have no obligation to do so. Furthermore they can't
> dismiss you for refusing.

Refusing to sign a new contract can get you canned here, and that's 
perfectly legal in most cases.  However, most companies are willing to 
negotiate a bit since the cost of replacing you (recruiting, hiring, 
training, etc.) is significant.

In the US, unless you're part of a union you're usually under what's called 
"at will" employment, which means either party can terminate the agreement 
at any time, with or without cause, except for a few cases (e.g. 
discrimination, harrassment) specified by law.  Some states do require a 
minimum of two weeks' notice, and it's common practice even in states that 
do not.

S

-- 
Stephen Sprunk         "God does not play dice."  --Albert Einstein
CCIE #3723         "God is an inveterate gambler, and He throws the
K5SSS        dice at every possible opportunity." --Stephen Hawking 




== 2 of 2 ==
Date: Tues, Dec 7 2004 10:04 am
From: Jim P  

Richard Bos wrote:

> RCollins <[EMAIL PROTECTED]> wrote:
> 
> 
>>Andrew Koenig wrote:
>>
>>>If your employer changed their mind about this policy, there wouldn't be 
>>>much you could do about it short of leaving.
>>>So it's not really your time--it's time that they are letting you have at 
>>>their discretion.
>>
>>Not likely... most U.S. busniness are *not* the evil overlords that most
>>science-fiction writers would have you believe.
>>
>>A modern engineering company (such as Raytheon) tries very hard to keep
>>it's engineering staff happy and "well fed" with intersting projects.
>>If I create something "on my own time" that the company wants, they will
>>truly make me a very generous offer for that product.
> 
> 
> And what happens if you refuse? That, I think, is the real test.
> 
> Richard

To me, I would have been open and upfront about what I was doing in my 
time. I would have made comment about it around the company - - other 
workers and even with the boss around.  and if he is a good boss he 
would be noticing this and paying attention and asking questions about 
it. - - - as I said before this type of person makes a good engineer and 
programmer. the 8 to 5 this is only a job - - do not. I would want to 
keep the one that really digs this stuff.

I would not do this as a hidden and secert project for that just raises 
questions of why did you hide this.

In fact many boss, would encourage this type of work and I know of some 
that have heard of someone needing a consultant and they point an 
employee to that company - for a side job. - - -  and they know that 
some of their programmers and engineers are doing small side jobs for 
different companies.

I would not be running around shouting or bragging about any side work 
but I would not make it a secret or hide it.   That just raises a lot of 
questions.

I have even seen companies allow - the employee to use company equipment 
for this type of work. as it makes the employee happy.  As long as it is 
after hours work and does not effect company work.

Jim P.




==============================================================================
TOPIC: Java and Autonomy
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e0f9cc3c246f2a2
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 6:46 pm
From: karl wettin  

Alberto wrote:
> I've been doing research on Autonomy. I was wondering if anyone has any
> ideas on where to look for more tutorials/tips/examples since it seems
> that there's not much out there to play with. I read that there can be
> done some java development done for Autonomy but I'm not sure where to
> start, or even why would I like to do any development at all. Any
> ideas?
> 

Autonomy has an excellent Java-API to speak with SUIR et.c. via XML. The 
official website is full of documumentation.


-- 

   karl




==============================================================================
TOPIC: Javascript - Form - upload file error
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74a4c48757cb2d60
==============================================================================

== 1 of 2 ==
Date: Tues, Dec 7 2004 9:49 am
From: [EMAIL PROTECTED] (Cormac O'Donnell) 

I am using a combination of jsp javaScript and html to build a form. 
the form cannot have a default button, so what i have done is created
an input type as "file" and made it hidden.  i have then called it
using a bit of java script ( uploadObj.click();  )linked to my image,
used to represent the button.


Problem occurs when you go to submt the form.  IN IE, running on xp
home, with service pack 2 installed, it empties the textfield.  THe
file must be put through as type file, so filling a textfield with the
text is not allowed.

I have included a reduced version of the problem in the code below ( i
have made the file upload visible for test purposes)




<html><head> Form Test </head><body>

<SCRIPT LANGUAGE = "JavaScript">
function BrowseForFile() {
 var browseObj = document.getElementById("thumbNail");
 browseObj.click();
}
</SCRIPT> </body>

<form Action = "here.html" name="myform" method="post"
enctype="multipart/form-data">

<a onClick="BrowseForFile();">Browse</a>            
<input type="file" name="thumbNail" >
<input type="submit" name="sub" value="send now" >              
</form>
</html>



Notice how using the default browse button and pressing "send now"
posts the form off to the location requested.

Now try pressing the browse text to the left, upon selecting the file 
and pressing the "send now" button it simply empties the text field,
WHY???


Thank you in advance


Cormac O'Donnell



== 2 of 2 ==
Date: Tues, Dec 7 2004 6:51 pm
From: "Dag Sunde"  

"Cormac O'Donnell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I am using a combination of jsp javaScript and html to build a form.
> the form cannot have a default button, so what i have done is created
> an input type as "file" and made it hidden.  i have then called it
> using a bit of java script ( uploadObj.click();  )linked to my image,
> used to represent the button.
>
>
> Problem occurs when you go to submt the form.  IN IE, running on xp
> home, with service pack 2 installed, it empties the textfield.  THe
> file must be put through as type file, so filling a textfield with the
> text is not allowed.
>
> I have included a reduced version of the problem in the code below ( i
> have made the file upload visible for test purposes)
>
> <html><head> Form Test </head><body>
>
> <SCRIPT LANGUAGE = "JavaScript">
> function BrowseForFile() {
>  var browseObj = document.getElementById("thumbNail");
>  browseObj.click();
> }
> </SCRIPT> </body>
>
> <form Action = "here.html" name="myform" method="post"
> enctype="multipart/form-data">
>
> <a onClick="BrowseForFile();">Browse</a>
> <input type="file" name="thumbNail" >
> <input type="submit" name="sub" value="send now" >
> </form>
> </html>
>

Don't know if this solves your problem, but...

>  var browseObj = document.getElementById("thumbNail");
...
> <input type="file" name="thumbNail" >

using .getElementById() you must have an element with that
particular id-attribute. "id" and "name" are not interchangeable
when it comes to getElementById(). I would change it to:

<input type="file" id="thumbNail" name="thumbNail">

PS!
    The question is probably better answered in:
    comp.lang.javascript

-- 
Dag.






==============================================================================
TOPIC: "static" prefix - to parallel "this" prefix
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f5dde10882ac2157
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 5:56 pm
From: Tim Tyler  

Darryl L. Pierce <[EMAIL PROTECTED]> wrote or quoted:
> Tim Tyler wrote:

> >>Try using the latest Eclipse version. It can highlight local, instance, 
> >>static and even final variables in a different color. This is probably a 
> >>better idea than uglifying your code, or introducing new language syntax.
> > 
> > I'm using the latest stable version of Eclipse - 3.0.1.
> > 
> > The feature is not present there.
> 
> It's an advanced editing feature.
> 
> Window->Preferences->Java->Editor->Syntax->Enable advanced highlighting

Goodness.  Thanks.  It works!

I take back everything I said about the feature not being there.

The feature significantly reduces my need for an additional visual 
indicaton of whether variables and methods are instance, static or local.

It also improves Eclipse's syntax colouring no end.

Though - apparently inexplicably - it /still/ can't tell the difference 
between a numeric constant, a type name and a package name.

Also - it seems to make Eclipse even more sluggish :-|
-- 
__________
 |im |yler  http://timtyler.org/  [EMAIL PROTECTED]  Remove lock to reply.




==============================================================================
TOPIC: Sockets
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/edecab678cd31cd6
==============================================================================

== 1 of 2 ==
Date: Tues, Dec 7 2004 6:35 pm
From: "FunkyKarma"  

Touche.

I think we are actually on the same page.





== 2 of 2 ==
Date: Tues, Dec 7 2004 12:10 pm
From: Steve Horsley  

Chris Uppal wrote:
> FunkyKarma wrote:
> 
>>> But what will be the *content* of the communication?
>>>C programmers tend to want to just send structs, which is not portable.
>>
>>The content doesn't matter.  Sending a struct is not a problem.
> 
> 
> In itself this is true -- how the sender put the bytes on the wire is not of
> interest to the receiver and does not in any way affect the validity of the
> bytestream.  However it is /misleading/ in that the sender might be under the
> impression that he or she was writing well-defined bytes in a well-defined
> order, rather than just a semi-random mishmash that "happens" to work -- which
> is actually the case.
> 
>     -- chris

If we're getting pedantic, I could disagree with that. If a developer sends a
struct memory image and then carefully documents what happens on the wire, byte
by byte, then the fact that the origin is a memory image is irrelevant. If the 
memory image contains garbage passing then the final protocol definition will
contain "undefined/unused" bytes. But the final definition MUST be a definition
of what bytes go across the wire, and in what order.

For this reason, any language capable of constructing and analysing a byte 
sequence
is capable of conversing over IP sockets. 

Steve




==============================================================================
TOPIC: how do I set the encoding for javac ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6ad9532343fc5919
==============================================================================

== 1 of 2 ==
Date: Tues, Dec 7 2004 10:58 am
From: [EMAIL PROTECTED] (Frank Gerlach) 

I have some trouble with javac: The string constants I use contain
characters, with codes larger than the ASCII maximum.
Example:

public class language{
  public static void main(String[] argv){
     System.out.println("möglich");
  }
}

generates this output:

m÷glich

How do I configure javac to use a different charset, eg. "ISO8859-1" ?



== 2 of 2 ==
Date: Tues, Dec 7 2004 7:23 pm
From: Collin VanDyck  

Frank Gerlach wrote:
> I have some trouble with javac: The string constants I use contain
> characters, with codes larger than the ASCII maximum.
> Example:
> 
> public class language{
>   public static void main(String[] argv){
>      System.out.println("möglich");
>   }
> }
> 
> generates this output:
> 
> m÷glich
> 
> How do I configure javac to use a different charset, eg. "ISO8859-1" ?

I don't think it's a problem with javac, but rather a problem with the 
console to which you are outputting at runtime.  I know that the windows 
CMD prompt does not display UNICODE correctly for me, and one way you 
can get around this is to instead log to a file using a FileWriter and 
then open up the file in a text editor or log viewer that supports the 
charset you are using to output.

The FileWriter assumes a default character encoding which you can 
override when running the program by saying:

% java -Dfile.encoding="ISO8859-1" language

If you cannot change the way in which the class is invoked, you can 
create an OutputStreamWriter on a FileWriter and specify the character set.

HTH







==============================================================================
TOPIC: Need help w. the JSTL c:out tag.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/2bb8e9c8c521f2fd
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 12:03 pm
From: The Abrasive Sponge  

Steve Burrus wrote:
> I  need help w. the JSTL c:out tag!! I am just simply trying to get the 
> current date printed out in a JSP page, but it won't show/display! All 
> that it shows in the web browser is the <h2></h2> heading and then under 
> that this :  ${date}, instead of the date that I would like to see. Here 
> is the code for this file :
> 
>  <%-- use the 'taglib' directive to make the JSTL 1.1 core tags 
> available --%>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
> <%-- use the 'jsp:useBean' standard action to make the Date object 
> available in page scope --%>
> 
> <html>
> <head><title>First JSP</title></head>
> <body>
> <h2>Here is today's date</h2>
> <c:out value="${date}" />
> </body>
> </html>
> 
> Thanx in advance to anyone who can help me with this problem.

Use the formatDate in JSTL....here are some examples of how to use it. 
Take a look at the documentation for more info.


<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"; prefix="fmt" %>

<jsp:useBean id="date" class="java.util.Date" />
<fmt:formatDate value="${date}" pattern="EEEE, MMMM d, yyyy"/>
<fmt:formatDate value="${date}" type="date" dateStyle="short"/>
<fmt:formatDate value="${date}" type="both" dateStyle="short" 
timeStyle="long"/>

Docs can be found at:
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/formatDate.html




==============================================================================
TOPIC: JSF version of JSTL forEach?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/12c3510dbb3c55d4
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 12:05 pm
From: The Abrasive Sponge  

Andrea Desole wrote:

> I know that forEach is not allowed with JSF. At the moment I'm trying to 
>  develop a renderer with its own iteration, as suggested in paragraph 
> 9.2.8 of the JSF 1.1 specs (I wouldn't really like to use dataTable), so 
> that I can have the same functionalities of the JSTL forEach. Since it's 
> taking some time, I thought that it might be better to get it somewhere.
> Unfortunately at the moment not only I can't find a renderer like that, 
> but I can't find even a repository of JSF components or renderers. Does 
> anyone know one?
> Thanks
> 
> Andrea

Don't have an answer, but have a question:
You don't like dataTable? how come?




==============================================================================
TOPIC: RegEx partial matching
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14069fafc93c4493
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 11:15 am
From: "bilbo"  

Stanimir Stamenkov wrote:
> Is it possible to detect a partial match at the end of the supplied
> data?, i.e.:
>
>      String data = "A regular expression, specified as a string,
> must first be compiled into an instance of this class. The resulting
> pattern can then be used";
>
>      String search = "can then be used to create";
>
>      Pattern pattern = Pattern.compile(search);
>
>      Matcher matcher = pattern.matcher(data);
>
>      matcher.find();
>      ...
>
> It is obvious the above won't match but then the initial data is
> only a chunk from an input stream (for example), so I want to detect
> if the pattern has been partially matched and at which position the
> partial match begins so I could prepend it to the next data chunk
> and continue matching.

Just found out that Java 1.5 actually includes a solution to this
problem as well.  Use the java.util.Scanner class, which includes
methods to search various kinds of streams.

InputStream stream = ...;
Scanner scanner = new Scanner(stream);
Pattern pattern = Pattern.compile(search);
String match;
while ((match = scanner.findWithinHorizon(pattern, 0)) != null)
System.out.println(match);





==============================================================================
TOPIC: Dynamic Data Exchange in java to link to windows application
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8d2ffb69843ba63b
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 11:31 am
From: "AMI"  

Hi,
I'm trying to use DDE (Dynamic Data Exchange) to establish a link with
some Windows program using JAVA code. I use Classes provided by NEVA:
http://www.nevaobject.com/_docs/_javadde/JavaDde.pdf . I'm using j2SE
and eclipse IDE.
Basically, the example that was provided in the documentation with the
library was accessing an excel sheet , I checked it and  it works fine.
But when I try to connect to the application that I want to link to,
it gives a windows error and terminates and my code gives an error
"Execution failure: DdeConnect doesn't return (see MS Q136218)"
Well, I checked for this error and the soln that I found was to add a
message loop to the thread that created the window, I donnu what does
this mean or how I can do it. So would someone help me with this?
Thanks,
Iman.

This is the bug description as I found::

SYMPTOMS
A 32-bit application calls DdeConnect when all previous DDEML
initialization has been performed. DdeConnect never returns.

CAUSE
Any thread that creates a top-level window and doesn't have a message
loop will cause DdeConnect to block. This is because DdeConnect calls
SendMessage(HWND_BROADCAST...). In this call, SendMessage will put the
message in the target thread's message queue and block the calling
thread. If the target thread doesn't have a message loop, it will never
process this message and therefore never return.

One complication is that some things create windows without the
knowledge of the calling thread. It is known that some SQL, RPC, and
DDEML function calls will do this. Any top-level window that is created
by a thread that has no message loop will cause this to happen.

RESOLUTION
The only current solution is to add a message loop to the thread that
created the window.





==============================================================================
TOPIC: Delete a panel inside a panel (2)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/39f13ffc05d5cc4
==============================================================================

== 1 of 1 ==
Date: Wed, Dec 8 2004 8:49 am
From: "HS1"  

Hello

After got a help, I can delete a sub-panel inside a main-panel (a container
with VerticalFlowLayout) for a delete button ( the button inside a
sub-panel) by using:

JPanel mainPanel = (JPanel)this.getParent();
mainPanel.remove(this);  // "this" is the sub-panel
mainPanel.repaint();

However, when I use this code, the sub panel is deleted but the main panel
did not change. For example I have three sub-panels (top, centre, bottom).
When I delete the centre sub-panel, this sub-panel is deleted but the top
and bottom still in the same place. What I want is that the bottom sub-panel
will move up. Do I have to remove all sub-panels then add them again or
there is a better way to do that???

Could you please help
Thank you
SH1






==============================================================================
TOPIC: Where to place configuration files when using WAR-Files
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/74dc1db3e419defd
==============================================================================

== 1 of 1 ==
Date: Tues, Dec 7 2004 8:04 pm
From: Juha Laiho  

"Stephan Koser" <[EMAIL PROTECTED]> said:
>we'd like to provide our web application as a WAR-File. Up to now we have
>our configuration files inside the WEB-INF directory.
>But we don't want to force our clients to unpack, edit and pack the war file
>if they want to configure the application. Instead we want to provide a
>configuration dialog at the first call of our application.
>But the question is: Where to place the configuration?
>
>We don't want to put it in the WAR file. So, are there any standards in J2EE
>where to place configuration files, that may change during runtime?

You might check whether you can provide the configuration through JNDI
subsystem. Perhaps even let go of the actual configuration file altogether,
and move the individual variables into entries in the JNDI naming hierarchy.

Or then just pass the conf.file name as a JNDI resource.

Works for "big" app.servers, and works for Tomcat from at least 4.1 versions.
-- 
Wolf  a.k.a.  Juha Laiho     Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
         PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)



==============================================================================

You received this message because you are subscribed to the Google
Groups "comp.lang.java.programmer" group.

To post to this group, send email to [EMAIL PROTECTED] or
visit http://groups-beta.google.com/group/comp.lang.java.programmer

To unsubscribe from this group, send email to
[EMAIL PROTECTED]

To change the way you get mail from this group, visit:
http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

To report abuse, send email explaining the problem to [EMAIL PROTECTED]

==============================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to