Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in running struts application

 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to run a application, the opening jsp for which is the HelloWorld.jsp



I tried running the jsp using the URL http://localhost:8080/struts2Tutorial/pages/HelloWorld.jsp, as my jsp is present in the location struts2Tutorial/pages/HelloWorld.jsp of tomcat's webapps directory. But I got this exception -

org.apache.jasper.JasperException: File "/struts-tags" not found

As far as I know the tlds that we use in the jsp need to be declared in the web.xml. Please guide me on how to do this for Struts2.0
 
lohith micheal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this your jsp page.
you have not mentioned the tlds in your jsp page.
like
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
 
Ramu Valivarthi
Ranch Hand
Posts: 37
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep your tlds inside the WEB-INF/

<%@ taglib prefix="s" uri="/WEB-INF/struts-tags" %>
<html><head>
<title>Struts 2 Hello World Application!</title></head><body><h2><s:test property value="message" /></h2><p>Current date and time is: <b><s:text roperty value="currentTime" /></b></body></html>

In web.xml

<taglib>
<taglib-uri>/WEB-INF/struts-tags</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added this to the jsp -


<%@ taglib prefix="s" uri="/WEB-INF/struts-tags" %>

and this to web-xml



but still i got this org.apache.jasper.JasperException: File "/WEB-INF/struts-tags" not found

I also plase all the tlds to the WEB-INF/struts-tags directory.

Also.. the tag s roperty, is something specific to struts 2.0 Can anyone give me the link to get the tlds for struts 2.0
 
lohith micheal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,
if you have struts blank.war with you.
you can use the same tlds.
there is no problem with those tlds.
 
lohith micheal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think there might be a problem in .class files.
just check the src destination folder.
i was also facing the same problem there was a problem in .class files.
hope this information might help you.
i was working on eclipse.
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks michael

i got the tld file from the blank application..

but..i am facing the same problem as above.

also I am getting a console output -

Internal ERROR : WEB-INF/web.xml file not found

even if the file is precent at the correct location
 
lohith micheal
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
as for as i know even i was facing the same problem ,
there was a problem in my src i.e destination of .class files was in the wrong path.
so i was getting that type of error. i have not worked on tomcat.
you do one thing check where your .class files are there.are they inside the web-inf or outside the web-inf.
if it is outside then put the .class files inside the web-inf.
then compile it and run it.s
 
Niranjan Deshpande
Ranch Hand
Posts: 1277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

I pasted the classes as you told, But the problems persist
 
lohith mk
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what sort of error your getting now?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic