Win a copy of Rust Web Development this week in the Other Languages forum!

selvi family

Ranch Hand
+ Follow
since Nov 26, 2004
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 selvi family

hi ,

I am also having the same problem.how to resolve this. kindly help me on this
15 years ago
Thank you so much..I got it..
16 years ago
JSP
Hi ..

I am new to JSTL.I am using Tomcat 4.1.24 and Java 1.4

I have copied jstl.jar and standard.jar(includig dependancy jar files) into WEB-INF\lib folder.

I've placed all the *.tld file under WEB-INF\taglib folder

this is the web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 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-app_2_4.xsd"
version="2.4">


<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>;
<taglib-location>/WEB-INF/taglib/fmt.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>;
<taglib-location>/WEB-INF/taglib/c.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>;
<taglib-location>/WEB-INF/taglib/sql.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>http://java.sun.com/jstl/x</taglib-uri>;
<taglib-location>/WEB-INF/taglib/x.tld</taglib-location>
</taglib>



<display-name>Hello World!</display-name>

</web-app>

JSP is my JSP : jstlcore.jsp

<%@ taglib prefix="c" uri="\WEB-INF\taglib\c.tld" %>

<html>
<head>
<title>Simple Example</title>
</head>
<body>

<c:set var="browser" value="${header['User-Agent']}"/>
<c ut value="${browser}"/>

</body>
</html>

When I run this jstlcore.jsp in browser I got the following error.

org.apache.jasper.JasperException: XML parsing error on file \WEB-INF\taglib\c.tld: (line 3, col 8): Document is invalid: no grammar found.
at org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument(ParserUtils.java:189)
at org.apache.jasper.compiler.TagLibraryInfoImpl.parseTLD(TagLibraryInfoImpl.java:243)
at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:183)

I tried changing the URI in jsp to
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

I got the different error
org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jstl/core) cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:105)


please some one help me to solve this..
16 years ago
JSP
no...still its not working
16 years ago
to get the alert message we need not give <html:errors/> . errors tag will be used when the validation is on server side and ActionForm class returns the ActionErrors.
16 years ago
Javascript validation on form is not working in my example application.

The same validations are working on server-side using validation.xml and validator-rules.xml .

I enabled client side validation as <html:javascript formName="valForm"/>
<html:form action="validate" onsubmit="return validateValForm(this);">


I gave correct form name in validation.xml as well as in the name atribute of the action definition. I gave input attribute to same jsp and validate="true".
pls clarify this.why I am not getting any alert.
16 years ago
I jus checked the View source of the page .it reads the value="selvi" but still the radio button is not getting selected. pls get me some solution
16 years ago
How to make the radio button selected by default on page load

I am fetching some records from DB and storing that in bean and populating radio button values using
<jsp:useBean id="sel" class="myTest.struts.bean.ViewForm" />
<html:radio property="select" value="<%= bean.getName()%>" ></html:radio>
I am putting the value of first name in an hidded variable called 'val'

i referes the index of first record.

this is my Form class


import org.apache.struts.action.*;

public class ViewForm {

private String select="selvi";


}
public void setSelect(String s)
{

this.select=s;

}
public String getSelect()
{
return select;
}

}
when I am loading the JSP radio button corresponds to first record "selvi" is not getting selected.





pls help me to solve this..
16 years ago
hi,
I am using <html:form> tag..here action attribute is mandatory.so I want to set somethinlg like this action="<%= %>"

pls help me...
16 years ago
Hi,

I have 2 submit buttons in my JSP.

<html:submit>Save</html:submit>
</html:submit>Delete</html:submit>

clicking on Save action should set to saveAll.do
clicking on Delete ,action should set to deleteAll.do

is it possible ?
if so how come?

pls help me
16 years ago
I have changed ActionErrors to ActionMessages in methodParams...

Got the error messages properly.No error in Tomcat console now...

thanks

regards
selvi
16 years ago
Hi cendy,

Thanks a lot ........................


It is working fine.....great !!!

regards
Selvi
16 years ago
Hi,

I got the following error in my TOmcat server console while doing my validator example..
pls tell me what could be the problem..

SEVERE: org.apache.struts.validator.FieldChecks.validateRequired(java.lang.Objec
t, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Fi
eld, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletReques
t)
org.apache.commons.validator.ValidatorException: org.apache.struts.validator.Fie
ldChecks.validateRequired(java.lang.Object, org.apache.commons.validator.Validat
orAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErr
ors, javax.servlet.http.HttpServletRequest)
at org.apache.commons.validator.ValidatorAction.loadValidationMethod(Val
idatorAction.java:627)
at org.apache.commons.validator.ValidatorAction.executeValidationMethod(
ValidatorAction.java:557)
at org.apache.commons.validator.Field.validateForRule(Field.java:811)
at org.apache.commons.validator.Field.validate(Field.java:890)
at org.apache.commons.validator.Form.validate(Form.java:174)
at org.apache.commons.validator.Validator.validate(Validator.java:367)
at org.apache.struts.validator.ValidatorForm.validate(ValidatorForm.java
:112)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProc
essor.java:921)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:206)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
4)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
rValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)

at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:22
3)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:619)
at java.lang.Thread.run(Thread.java:536)
16 years ago
hi ,

I tried HttpSession with saveMessages()

saveMessages(HttpSession session,messages);

I got 2 errors while compiling the Action Class.
myTest/struts/UseAction.java:30: ')' expected
saveMessages(HttpSession session,messages);
^
myTest/struts/UseAction.java:30: cannot resolve symbol
symbol : variable HttpSession
location: class myTest.struts.UseAction
saveMessages(HttpSession session,messages);


^
I have included

import javax.servlet.http.HttpSession;

still got the above error..Not able to compile Action class ..

pls tell me what could be the problem...
16 years ago
Hi Cendy,

I tried this but its not working...I dont get ActionMessage in my JSP.

code in Action Class:

ActionMessage msg = new ActionMessage("data.use");
messages.add("message1", msg);
saveMessages(request,messages);
return mapping.findForward("use");

In JSP:
<html:messages id="message1" message="true">
<bean:write name="message1"/>
</html:messages>

In struts-config.xml:
<action name="useForm" path="/use" type="myTest.struts.UseAction" scope="request">

<forward name="use" path="/Use.jsp" />
<forward name="nouse" path="/NoUse.jsp" />

</action>

plese help me....
16 years ago