Pierre Peron

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

Recent posts by Pierre Peron

Of course when I have enougth spear time I'll learn JSTL.
But for the moment with the fifa world cup...

Thanks a lot for your help!!!
17 years ago
JSP
Thanks a lot Ben!
It doesn't makes many time that I use JSP. And so I don't really know how to use JSTL.
Could you please tell me what is the better solution according to you? What do you mean when you say that I have to pass a reference to the printWriter to the function?

Regards
17 years ago
JSP
I've implemented a little function in my jsp. This function is used to do some operations and then I'd like to print the results. The function is in <%! global declarations %> so I cannot use the following code <%= value %> to write a value in my page.
I tried to use the following code: out.write(value); but it creates an error when compiling.

Here is a simple part of my code:

<%! public void explore(List<Object> my_list) {
Iterator<Object> iter = my_list.iterator();
while(iter.hasNext()){
...
out.write(value);
...
}
%>

<html>
<head>
<title>test</title>
</head>
<body>
...
<%= explore(list1) %>
...
<%= explore(list2) %>
...
</body>
</html>

Can somebody see what's my error?
17 years ago
JSP
And how could I do with JSTL?
17 years ago
JSP
I have problem while trying to Encode an URL:
<a href="test.jsp?arg=<%= value %>">Link name</a>

The variable "value" that is transmited can contain some specific characters or foreign characters. So I tried to encode the URL:
<a href="test.jsp?arg=<%= URLEncoder.encode(value, "UTF-8") %>">Link name</a>

It works with specific characters (like %@& ...) but not with foreign characters.

What should I add?
[ June 21, 2006: Message edited by: Pierre Peron ]
17 years ago
JSP
Ok! So by this way a part of my problem is solved. The specific characters that were not recognized like %=@ are checked now. But I still can't make it work whith the unicode UTF-8 (Japanese characters for example).

That is what should enable me to recognize the unicode in the jsp pages:

for html:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body text="#000000" link="#000000" vlink="#000000" alink="#000000">

for java:
<%@ page language="java" pageEncoding="utf8" contentType="text/html; charset=UTF-8" %>
and before getting the requesting value of the "code" parameter:
request.setCharacterEncoding("UTF-8");

I try by decoding the request too but the result is the same:
the code string is: ジポネキ
the encoded code is : %E3%82%B8%E3%83%9D%E3%83%8D%E3%82%AD
and the value requested is : ������������


Am I doing something wrong? Or does something miss me?
17 years ago
JSP
I just solved the problem! My server was Tomcat5.5 using Eclipse JDT compiler by default. I had to set the jdk 1.5

Thanks to everybody for your help
17 years ago
JSP
To find the jdk version, I've made:
java -version
I think that I've installed only one jdk. Is there another mean to know that more precisely?
[ April 20, 2006: Message edited by: sebastien cazaux ]
17 years ago
JSP
You mean like this?

<% while(iter.hasNext()) { %>
<%= iter.next() %>
<% } %>

it doesn't works too?
17 years ago
JSP
yes I think it is. The java version is 1.5.0_06
17 years ago
JSP
I'd like to print a list in my jsp. For example this is the code:

<%@ page language="java" import="java.util.*,java.lang.*" %>
<% List<String> l1 = new List();
l1.add("Hi!");
l1.add(" How");
l1.add(" are");
l1.add(" you?");
ListIterator<String> iter = l1.iterator(); %>
<html>
<title>Test</title>
<body>
<%
while(iter.hasNext()) { %>
<%= iter %>
<% iter.next();
} %>
</body>
</html>

And when I try to run it... the following error appears :

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 3 in the jsp file: /index.jsp
Generated servlet error:
Syntax error on token "<", invalid AssignmentOperator

An error occurred at line: 3 in the jsp file: /index.jsp
Generated servlet error:
Syntax error on token "=", != expected

An error occurred at line: 3 in the jsp file: /index.jsp
Generated servlet error:
Syntax error on token "<", invalid AssignmentOperator

An error occurred at line: 3 in the jsp file: /index.jsp
Generated servlet error:
Syntax error on token "=", != expected

Can someone help me please? Did I make a mistake or what should I do?
17 years ago
JSP