File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes bean:message key and bean:write not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "bean:message key and bean:write not working" Watch "bean:message key and bean:write not working" New topic
Author

bean:message key and bean:write not working

erika chua
Greenhorn

Joined: Oct 03, 2011
Posts: 2
I have this string in my .java file.

String str = "<a href =\"" + url + "\"><bean:message key=\"label.search\"/></a>";

that turns out like this below, which is (i suppose) correct.

<a href = "searchUser.do?action=search"><bean:message key="label.search"/></a>

and it follows this

request.setAttribute("header", str);

In my .jsp file

<bean:write name="header" scope="request" filter="false"/>

In my properties file

label.search = Search

I dont understand why this does not work. but of course if i change <bean:message key="label.search"/> to a text like ABC, it works perfectly fine.
I also tried label.search in other .jsp files, it works fine too
olivier dutranoit
Ranch Hand

Joined: Aug 20, 2011
Posts: 81

Hi

You cannot write in your servlet


and next, using this string in your jsp, and expecting the syntax to be evaluated.

the
<bean:message key=\"label.search\"/>
can only be evaluated inside a jsp. Not trough your servlet.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: bean:message key and bean:write not working