Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

html:html causing problems

 
Jamie Jackson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have very little clue what I'm doing with Struts, so I'm incrementally trying to get new things working.

Currently, I'm trying to make some use of the HTML taglib, but <html:html> is causing errors.

Here's the form (from www.bachansoft.com/tutorials/web/strutsquickstart.jsp). The file works as follows, but if I uncomment the <html:html> tags, I get the error (I'll include it after my sig).

<jsp:useBean id="name" scope="request" class="java.lang.String" type="java.lang.String"/>
<jsp:useBean id="greetings" scope="request" class="java.lang.String" type="java.lang.String"/>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%
//String name = (String)request.getAttribute("name");
//String greetings = (String)request.getAttribute("greetings");
%>
<%-- <html:html> --%>

<HEAD>
<TITLE> Hello <%=name%> - <%=greetings%> </TITLE>
</HEAD>

<BODY>
Hello <STRONG><%=name%></STRONG> - <%=greetings%>. You are now flying.
<BR><BR>
<FORM METHOD=GET ACTION="Greetings.do">
Give me your name, and I will make you fly :
<BR><INPUT TYPE="text" NAME="name">     <INPUT TYPE="submit" VALUE="Fly">
<BR><BR>
</FORM>
<html:form action="/Greetings">
<html:text property="name"/>
    <html:submit>Fly</html:submit>
</html:form>
</BODY>

<%-- </html:html> --%>

I have no clue how to debug this... any ideas?

Thanks,
Jamie

ERROR:
java.lang.NoClassDefFoundError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at jrun__greetings2ejspe.class$(jrun__greetings2ejspe.java)
at jrun__greetings2ejspe._jspService(jrun__greetings2ejspe.java:96)
...etc.
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you need html:html?
[ January 11, 2005: Message edited by: Marc Peabody ]
 
Jamie Jackson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't need it currently (AFAIK), since I think html:html does mostly i18n, which I don't need for this project. However, for my own edification, I'd like to know why it doesn't work. Also, I'm curious as to whether its use is considered best practice.

Any feedback would be appreciated, as I know squat.

Thanks,
Jamie
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it's not needed, it's good practice to not use it (unless you are allowing for future functionality).

There is probably something missing from your struts jar file and my guess is it's HtmlTag.java. That is the class responsible for rendering html:html.
 
Jamie Jackson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I'll leave it out.

FYI, that class *is* in the jar, though, so it's still a mystery why it won't work.

Thanks,
Jamie
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually such an exception prints the name of the class it cannot find. It surprises me that it did not do it.

The missing class might be from something HtmlTag uses:
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.Globals;
import org.apache.struts.util.MessageResources;
import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;

I have seen where people were missing MessageResources before.
 
Jamie Jackson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went to reproduce the error, so I could see if there was such a missing dependency noted; however, html:html now magically works. Go figure. :-/

Thanks for the follow-through, Marc.

Jamie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic