aspose file tools*
The moose likes Struts and the fly likes Help required on HelloWorld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Help required on HelloWorld" Watch "Help required on HelloWorld" New topic
Author

Help required on HelloWorld

Mohana Priya
Ranch Hand

Joined: Jan 16, 2005
Posts: 45
Hi All ,
I am trying out my first Struts Application

This is my ApplicationResources.properties file :

-------------------------------------------------------------------
; Application Resources for the "Hello" sample application
; Application Resources that are specific to the hello.jsp file


hello.jsp.title=Hello - A first Struts program
hello.jsp.page.heading=Hello World! A first Struts application
hello.jsp.prompt.person=Please enter a name to say hello to :


; Validation and error messages for HelloForm.java and HelloAction.java

examples.hello.dont.talk.to.atilla=I told you not to talk to Atilla!!!
examples.hello.no.person.error=Please enter a <i>PERSON</i> to say hello to!

--------------------------------------------------------------------------

I am able to get the Validation and error messages .

But problem in displaying ( bold ones ) using bean:message tag in the page.


I have struts-bean.tld in WEB-INF folder and <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> in my jsp file .


I have given an entry in struts-config.xml as

<message-resources parameter="ApplicationResources"/>

And placed the ApplicationResources.properties \WEB-INF\classes .


Am I missing out something ??

Thanks in Advance,
Mohana Priya


SCJP 1.4<br />SCWCD 1.4
santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

I think u better declare taglib in web.xml also


santhosh<br />SCJP,SCWCD
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Show us how you are trying to access the messages in your JSP.


Merrill
Consultant, Sima Solutions
Mohana Priya
Ranch Hand

Joined: Jan 16, 2005
Posts: 45
Hi,

Accessing the messages in jsp .
<bean:message key="hello.jsp.page.heading"/>

Dont know what exactly solved the problem.It is working fine now.

Thanks for the replies,
Mohana Priya

SCJP 1.4 (95%)
SCWCD 1.4 (86%)
vijay saraf
Ranch Hand

Joined: Jan 08, 2005
Posts: 141
Perhaps you have coded like

1) In web.xml :
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>
</jsp-config>

2) In config.xml : for application resources
<message-resources parameter="com.myapp.struts.ApplicationResource"/>
3)In hello.Jsp :

3.a ) for include :
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
3.b) for display :
<bean:message key="aap.welcome.heading"/>

if you have not done this way.......
it will be better if starts with netbeans or eclipse IDEs.


Thanks
Vijay Saraf.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help required on HelloWorld