You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Adriana G <ad...@gmail.com> on 2012/07/27 04:11:20 UTC
String list
First: Im working with ajax and struts 1.
I want to refresh a select option without refreshing the whole .jsp.
The options of that select is an string list and i want to put in a select
option, but it doesn't work :S.
if a i put the result (list) in a div, it shows me the list, but in the
select opcion doesn't.
what's wrong?
<html:select styleClass="select" styleId="ciudad"
property="ciudad.idCiudad" name="mineriaForm"
onclick="doAjaxPost('Ciudades')" >
<html-el:option value="Seleccione la ciudad"></html-el:option>
<logic:iterate id="ciu" name="mineriaForm" property="lista">
<html-el:option value="${ciu.idCiudad}">
<c:out value="${ciu.nombre}"></c:out>
</html-el:option>
</logic:iterate>
</html:select>
_____
<script type="text/javascript">
function doAjaxPost(tipo) {
// get the form values
var name = $('#name').val();
$.ajax({
type: "POST",
url: "/fethusweb/mineria.do",
data: "name=" + name +"&var="+tipo,
success:
function(response){
$('#prueba2').html(response);
},
error: function(e){
alert('Error: ' + e);
}
});
}
</script>
Thanks.
--
Adriii :)..
Re: String list
Posted by "Sreekanth S. Nair" <sr...@egovernments.org>.
Hi' Adriana
Check out this link and do it
http://www.dzone.com/tutorials/java/struts/struts-example/struts-html-select-tag-example-1.html
--
Thanks & Regards
Nick
On Fri, Jul 27, 2012 at 7:41 AM, Adriana G <ad...@gmail.com> wrote:
> First: Im working with ajax and struts 1.
>
> I want to refresh a select option without refreshing the whole .jsp.
>
> The options of that select is an string list and i want to put in a select
> option, but it doesn't work :S.
> if a i put the result (list) in a div, it shows me the list, but in the
> select opcion doesn't.
> what's wrong?
>
> <html:select styleClass="select" styleId="ciudad"
> property="ciudad.idCiudad" name="mineriaForm"
> onclick="doAjaxPost('Ciudades')" >
> <html-el:option value="Seleccione la ciudad"></html-el:option>
> <logic:iterate id="ciu" name="mineriaForm" property="lista">
> <html-el:option value="${ciu.idCiudad}">
> <c:out value="${ciu.nombre}"></c:out>
> </html-el:option>
> </logic:iterate>
> </html:select>
>
>
> _____
>
>
>
> <script type="text/javascript">
>
> function doAjaxPost(tipo) {
> // get the form values
> var name = $('#name').val();
> $.ajax({
> type: "POST",
> url: "/fethusweb/mineria.do",
> data: "name=" + name +"&var="+tipo,
> success:
> function(response){
> $('#prueba2').html(response);
> },
> error: function(e){
> alert('Error: ' + e);
> }
> });
> }
>
> </script>
>
>
>
> Thanks.
>
>
> --
> Adriii :)..
>
RE: XML Validation not working
Posted by "Singh, Rajdeep" <ra...@hp.com>.
I removed interceptor line from struts.xml but still getting same issue. It does not call "input" result and moving to next JSP.
Question: Do we write any validation.xml file apart from actionclassname-validation.xml ?
Thanks,
Rajdeep Singh
-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com]
Sent: Friday, July 27, 2012 6:46 PM
To: Struts Users Mailing List
Subject: RE: XML Validation not working
Why are you defining an explicit interceptor ref for the action? The
validation interceptor is already in the default stack, and by explicitly
defining an action-specific interceptor you're actually *removing* the
default stack, meaning no parameters will be set on the action, no workflow
takes place, etc.
Dave
(pardon brevity, typos, and top-quoting; on cell)
On Jul 27, 2012 9:11 AM, "Singh, Rajdeep" <ra...@hp.com> wrote:
> Thanks for help, I changed it but still getting below error :
>
> Jul 27, 2012 6:36:10 PM
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
> SEVERE: Caught exception while loading file
> struts2/application/action/Register-validation.xml
> Connection timed out: connect - [unknown location]
> at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
>
> My struts.xml file looks like :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
> <package name="struts2" extends="struts-default">
> <action name="register"
> class="struts2.application.action.Register" >
> <interceptor-ref name="validation"/>
> <result name="success">/Register.jsp</result>
> <result name="input">/LoginForm.jsp</result>
> </action>
> <action name="validate"
> class="struts2.application.action.RegisterValidate">
> <result name="success">/success.jsp</result>
> </action>
> </package>
> </struts>
>
> Thanks,
>
> Rajdeep Singh
>
> -----Original Message-----
> From: Łukasz Lenart [mailto:lukasz.lenart@googlemail.com]
> Sent: Friday, July 27, 2012 5:55 PM
> To: Struts Users Mailing List
> Subject: Re: XML Validation not working
>
> Change dtd to:
>
> http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd
>
>
> Regards
> --
> Łukasz
> mobile +48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/
>
> 2012/7/27 Singh, Rajdeep <ra...@hp.com>:
> > Hi All,
> >
> > I have written classname-validation.xml as per tutorial given at Apache
> site but it's not working for result name "input".
> >
> > Questions :
> >
> > 1. Do I need to write something in struts.xml for default validator to
> work ?
> >
> > Below is my validation xml file :
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE validators PUBLIC
> > "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
> > "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
> > <validators>
> > <field name="userName">
> > <field-validator type="requiredstring">
> > <param name="trim">true</param>
> > <message>User Name is required</message>
> > </field-validator>
> > </field>
> > </validators>
> >
> > Thanks,
> >
> > Rajdeep Singh
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
RE: XML Validation not working
Posted by Dave Newton <da...@gmail.com>.
Why are you defining an explicit interceptor ref for the action? The
validation interceptor is already in the default stack, and by explicitly
defining an action-specific interceptor you're actually *removing* the
default stack, meaning no parameters will be set on the action, no workflow
takes place, etc.
Dave
(pardon brevity, typos, and top-quoting; on cell)
On Jul 27, 2012 9:11 AM, "Singh, Rajdeep" <ra...@hp.com> wrote:
> Thanks for help, I changed it but still getting below error :
>
> Jul 27, 2012 6:36:10 PM
> com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
> SEVERE: Caught exception while loading file
> struts2/application/action/Register-validation.xml
> Connection timed out: connect - [unknown location]
> at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
>
> My struts.xml file looks like :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE struts PUBLIC
> "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
> <package name="struts2" extends="struts-default">
> <action name="register"
> class="struts2.application.action.Register" >
> <interceptor-ref name="validation"/>
> <result name="success">/Register.jsp</result>
> <result name="input">/LoginForm.jsp</result>
> </action>
> <action name="validate"
> class="struts2.application.action.RegisterValidate">
> <result name="success">/success.jsp</result>
> </action>
> </package>
> </struts>
>
> Thanks,
>
> Rajdeep Singh
>
> -----Original Message-----
> From: Łukasz Lenart [mailto:lukasz.lenart@googlemail.com]
> Sent: Friday, July 27, 2012 5:55 PM
> To: Struts Users Mailing List
> Subject: Re: XML Validation not working
>
> Change dtd to:
>
> http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd
>
>
> Regards
> --
> Łukasz
> mobile +48 606 323 122 http://www.lenart.org.pl/
> Warszawa JUG conference - Confitura http://confitura.pl/
>
> 2012/7/27 Singh, Rajdeep <ra...@hp.com>:
> > Hi All,
> >
> > I have written classname-validation.xml as per tutorial given at Apache
> site but it's not working for result name "input".
> >
> > Questions :
> >
> > 1. Do I need to write something in struts.xml for default validator to
> work ?
> >
> > Below is my validation xml file :
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE validators PUBLIC
> > "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
> > "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
> > <validators>
> > <field name="userName">
> > <field-validator type="requiredstring">
> > <param name="trim">true</param>
> > <message>User Name is required</message>
> > </field-validator>
> > </field>
> > </validators>
> >
> > Thanks,
> >
> > Rajdeep Singh
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
RE: XML Validation not working
Posted by "Singh, Rajdeep" <ra...@hp.com>.
Thanks for help, I changed it but still getting below error :
Jul 27, 2012 6:36:10 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
SEVERE: Caught exception while loading file struts2/application/action/Register-validation.xml
Connection timed out: connect - [unknown location]
at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:115)
My struts.xml file looks like :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="struts2" extends="struts-default">
<action name="register" class="struts2.application.action.Register" >
<interceptor-ref name="validation"/>
<result name="success">/Register.jsp</result>
<result name="input">/LoginForm.jsp</result>
</action>
<action name="validate" class="struts2.application.action.RegisterValidate">
<result name="success">/success.jsp</result>
</action>
</package>
</struts>
Thanks,
Rajdeep Singh
-----Original Message-----
From: Łukasz Lenart [mailto:lukasz.lenart@googlemail.com]
Sent: Friday, July 27, 2012 5:55 PM
To: Struts Users Mailing List
Subject: Re: XML Validation not working
Change dtd to:
http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd
Regards
--
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
2012/7/27 Singh, Rajdeep <ra...@hp.com>:
> Hi All,
>
> I have written classname-validation.xml as per tutorial given at Apache site but it's not working for result name "input".
>
> Questions :
>
> 1. Do I need to write something in struts.xml for default validator to work ?
>
> Below is my validation xml file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE validators PUBLIC
> "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
> <validators>
> <field name="userName">
> <field-validator type="requiredstring">
> <param name="trim">true</param>
> <message>User Name is required</message>
> </field-validator>
> </field>
> </validators>
>
> Thanks,
>
> Rajdeep Singh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: XML Validation not working
Posted by Łukasz Lenart <lu...@googlemail.com>.
Change dtd to:
http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd
Regards
--
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/
2012/7/27 Singh, Rajdeep <ra...@hp.com>:
> Hi All,
>
> I have written classname-validation.xml as per tutorial given at Apache site but it's not working for result name "input".
>
> Questions :
>
> 1. Do I need to write something in struts.xml for default validator to work ?
>
> Below is my validation xml file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE validators PUBLIC
> "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
> <validators>
> <field name="userName">
> <field-validator type="requiredstring">
> <param name="trim">true</param>
> <message>User Name is required</message>
> </field-validator>
> </field>
> </validators>
>
> Thanks,
>
> Rajdeep Singh
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
XML Validation not working
Posted by "Singh, Rajdeep" <ra...@hp.com>.
Hi All,
I have written classname-validation.xml as per tutorial given at Apache site but it's not working for result name "input".
Questions :
1. Do I need to write something in struts.xml for default validator to work ?
Below is my validation xml file :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">
<validators>
<field name="userName">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message>User Name is required</message>
</field-validator>
</field>
</validators>
Thanks,
Rajdeep Singh
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org