- This topic has 2 replies, 2 voices, and was last updated 18 years, 9 months ago by apcausey.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
apcauseyMemberHi,
I’m getting the following error in one of my JSP files:
'cannot access <class-name>: bad class file: <path-to-class-file> NOTE: no JSP line number was available so line 1 was used for the marker.
The class file that it’s referring to contains a method that I’m using in one of my custom JSTL functions in the JSP. The code works fine, and I’m getting the expected results when the JSP loads.
Thanks.
Don NelsonMemberWould be useful if you posted more information – such as your jsp file, and perhaps your controller class.
Don
apcauseyMemberHere’s the relevant part of my JSP file:
<%@ taglib prefix="vcufn" uri="http://opa.vcu.edu/jstl/functions"%> . . . <td style="text-align: center"> <html:link href="strutsaction/showform.do?fid=${formId}${vcufn:createBackParam(pageContext, true)}">Details</html:link> </td>
Here’s the taglib definition in the web.xml:
<jsp-config> <taglib> <taglib-uri>http://opa.vcu.edu/jstl/functions</taglib-uri> <taglib-location>/WEB-INF/vcu-functions.tld</taglib-location> </taglib> </jsp-config>
Here’s the function method(s):
/** * * @param requestParams * @return */ public static String createBackParam(PageContext pageContext, boolean append) throws Exception { try { return createBackParam((HttpServletRequest) pageContext .getRequest(), append); } catch (Exception e) { log.error("Exception: ", e); throw e; } } /** * * @param requestParams * @return */ public static String createBackParam(HttpServletRequest request, boolean append) throws Exception { try { // get the query string of the current URL String queryString = request.getQueryString(); // create the value for the back parameter String paramValue = URLEncoder.encode(((String) request .getSession().getAttribute( SessionAttributeKeys.STRUTS_ACTION_PATH)) .substring(1) + (queryString != null ? "?" + queryString : ""), "UTF-8"); // Return the query string for going back to the previous page. If // append is true, then there is already a query string for the url. return (append ? "&" : "?") + "back=" + paramValue; } catch (Exception e) { log.error("Exception: ", e); throw e; } }
This is the TLD file contents:
<?xml version="1.0" encoding="UTF-8" ?> <taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0"> <tlib-version>1.1</tlib-version> <short-name>vcufn</short-name> <uri>http://opa.vcu.edu/jstl/functions</uri> <function> <name>createBackParam</name> <function-class>edu.vcu.opa.jsp.functions.JspFunctions</function-class> <function-signature>java.lang.String createBackParam(javax.servlet.jsp.PageContext, boolean)</function-signature> </function> </taglib>
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)