Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help required on HelloWorld

 
Mohana Priya
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
santhoshkumar samala
Ranch Hand
Posts: 156
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think u better declare taglib in web.xml also
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us how you are trying to access the messages in your JSP.
 
Mohana Priya
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic