Steve Ashton

Greenhorn
+ Follow
since Sep 04, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Steve Ashton

I found the solution to this so I thought I would post it incase anyone ever comes across the same problem.

RequestUtils.absoluteURL(req,"/assets/images/plus.gif")
20 years ago
Hi,

I am using Struts for my application and I used to have a hyperlink in my JSP page. The link was like this <a href="<html:rewrite page="/assets/css/public.css" />">The Link</a>

However, I moved all this code into a custom taglib and when I write the code in the taglib, when it prints it out to the JSP page, it doesn't rewrite the url, it actually writes <html:rewrite page="/assets/css/public.css" /> which obviously is not what I want.

I tried a number of things such as

pageContext.getServletContext().getRealPath("/assets/images/plus.gif")

but this just gets the path on the C:/ drive which is not right. Can anyone let me know how I can return the server path to the right directory.

Many thanks
20 years ago
Hi, I am reading in a .csv file from my JSP page and I want to pass the String path from my Action class to the logic layer class. When I try and pass it at the moment, it throws an FileNotFound error as it is only passing the file name. i.e
Passing
text.csv
not
C:\text.csv
Is there anyway of detirming the full file path using the FormFile class?
Thanks in advance
20 years ago
Hi,
I'm trying to implement the Commons validator framework on my project but I am having a few problems. I am using the DynaValidatorForm to validate my forms. At the moment I am just trying to make it work on a logon form. Here are the files I'm using.
The error that I am getting at the moment is this.
2003-11-27 15:42:48,837 [ERROR] org.apache.commons.validator.Validator: reflection: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest)
java.lang.NoSuchMethodException: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest)
java.lang.reflect.Method java.lang.Class.getMethod0(java.lang.String, java.lang.Class[], int)
native code
java.lang.reflect.Method java.lang.Class.getMethod(java.lang.String, java.lang.Class[])
Class.java:888
boolean org.apache.commons.validator.Validator.validateFieldForRule(org.apache.commons.validator.Field, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.ValidatorResults, java.util.Map, int)
Validator.java:401
void org.apache.commons.validator.Validator.validateField(org.apache.commons.validator.Field, org.apache.commons.validator.ValidatorResults)
Validator.java:544
org.apache.commons.validator.ValidatorResults org.apache.commons.validator.Validator.validate()
Validator.java:582
org.apache.struts.action.ActionErrors org.apache.struts.validator.DynaValidatorForm.validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
DynaValidatorForm.java:151
boolean org.apache.struts.action.RequestProcessor.processValidate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.apache.struts.action.ActionForm, org.apache.struts.action.ActionMapping)
RequestProcessor.java:942
void org.apache.struts.action.RequestProcessor.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
RequestProcessor.java:255
void org.apache.struts.action.ActionServlet.process(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
ActionServlet.java:1482
void org.apache.struts.action.ActionServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
ActionServlet.java:525
void javax.servlet.http.HttpServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
HttpServlet.java:760
void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
HttpServlet.java:853
void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
ServletRequestDispatcher.java:721
void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
ServletRequestDispatcher.java:306
boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
HttpRequestHandler.java:767
void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
HttpRequestHandler.java:259
void com.evermind.server.http.HttpRequestHandler.run()
HttpRequestHandler.java:106
void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
PooledExecutor.java:803
void java.lang.Thread.run()
Thread.java:484
-------------------------------------------------------
struts-config.xml
<form-bean name="TestLogonActionForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="username" type="java.lang.String"/>
<form-property name="password" type="java.lang.String"/>
</form-bean>
<action path="/testLogonForm" type="gov.ons.classifications.controller.action.TestLogonAction" name="TestLogonActionForm" validate="true" scope="request" input="/TestLogonForm.jsp">
<forward name="success" path="/TestLogonForm.jsp" />
</action>

--------------------------------------------------
validation.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
<!--
Validation Rules for the Struts Example Web Application
$Id: validation.xml,v 1.8 2003/05/25 22:51:20 dgraham Exp $
-->
<form-validation>

<!-- ========== Default Language Form Definitions ===================== -->
<formset>
<!-- logonForm validation-->
<form name="TestLogonActionForm">
<field property="username" depends="required">
<arg0 key="title.details"/>
</field>
<field property="password" depends="required">
<arg0 key="title.details"/>
</field>
</form>
</formset>
</form-validation>

----------------------------------------------
My ActionForm
package gov.ons.classifications.controller.action;
import controller.action.BaseAction;
import gov.ons.classifications.controller.form.LoginActionForm;
import org.apache.struts.validator.DynaValidatorForm;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.*;
public class TestLogonAction extends Action
{
/**
* Logger object for the instance of this class
*/
private static Log logger = LogFactory.getLog(LoginAction.class);
public TestLogonAction()
{
super();
}
/**
* actionForward implementation
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException
{
logger.debug("Entering execute method of LoginAction");
DynaValidatorForm f = (DynaValidatorForm) form;
String person = (String) f.get("username");
logger.debug("Entering execute method of LoginAction ====>"+f);

return mapping.findForward("success");
}
}

Any help with this would be greatly appreciated!
Thanks!
20 years ago
I have a content management application that have previously been using with resin. In most of the pages there I have a <jsp:forward page similiar to this.
<jsp:forward page="/appl/confirmacion.jsp">
<jsp aram name="entorno" value="Atributos"/>
<jsp aram name="tema" value="Nuevo tipo de atributo"/>
<jsp aram name="mensaje" value="<%=mensaje%>"/>
<jsp aram name="destino" value="/appl/admin/avanzada/listaTiposAtributo.jsp"/>
</jsp:forward>
I have now transfered the application to an iPlanet server and the values are not being picked up by the recieving page. I am simply getting 'null' from my request.getParameter(); calls.
Anyone seen this problem before?
Many thanks
Steve
21 years ago