You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by vasudevrao gupta <va...@wipro.com> on 2004/01/25 09:17:22 UTC

Problem with <%= ... %> inside struts tags

Hi All,

I have the following code in my JSP file, and I am using the STRUTS
framework.
	code:
	<html:select  property ="exception" onClick="java
script:showOtherExceptions('<%= ELSEnquiryConstantsIF.EXCEPTION %>');"
/>
	where showOtherExceptions is a javascript function I have
already written.
	The problem is that this doesn't work as expected. The part that
should be filled with "ELSEnquiryConstantsIF.EXCEPTION" stays as
"ELSEnquiryConstantsIF.EXCEPTION" in the final HTML output..
	When I view source on the outputted HTML page, the html:submit
tag converts to the following:
	code:
	 <input type="select"  name ="exceptione" onClick="java
script:showOtherExceptions('<%= ELSEnquiryConstantsIF.EXCEPTION %>');"
/>

Please help 

Regards
VasudevRaoGupta


Confidentiality Notice 

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

validator with modules

Posted by Mohan Radhakrishnan <mr...@cellexchange.com>.
Hi
   I am using modules . Can I have the following in my respective struts
config files ? It seems that something is overwritten and I don't see errors
properly.


  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
value="/WEB-INF/rule-validator-rules.xml,

/WEB-INF/rule_validation.xml"/>

  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
value="/WEB-INF/ip-validator-rules.xml,
                                              /WEB-INF/ip_validation.xml"/>
  </plug-in>


Thanks
Mohan


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Problem with <%= ... %> inside struts tags

Posted by Max Cooper <ma...@maxcooper.com>.
The tag attribute value must be one big <%= %> or static text. You can't mix
static text and a <%= %>. This is a limitation of JSP, and not something
strange with Struts JSP tags in particular. Fortunately, it is pretty easy
to create a <%= %> expression that will have the value you want.

Instead of:

<html:select  property ="exception" onClick="java
 script:showOtherExceptions('<%= ELSEnquiryConstantsIF.EXCEPTION %>');"
/>

You can write it like this (all in one big <%= %> expression):

<html:select  property ="exception"
 onClick='<%=
    "javascript:showOtherExceptions('"
    + ELSEnquiryConstantsIF.EXCEPTION
    + "');"
 %>'
/>

Or something like this:

<% String myOnClick = (
     "javascript:showOtherExceptions('"
     + ELSEnquiryConstantsIF.EXCEPTION
     + "');"
   );
%>
<html:select  property ="exception" onClick="<%=myOnClick%>" />

-Max

----- Original Message ----- 
From: "vasudevrao gupta" <va...@wipro.com>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Sunday, January 25, 2004 12:17 AM
Subject: Problem with <%= ... %> inside struts tags


>
> Hi All,
>
> I have the following code in my JSP file, and I am using the STRUTS
> framework.
> code:
> <html:select  property ="exception" onClick="java
> script:showOtherExceptions('<%= ELSEnquiryConstantsIF.EXCEPTION %>');"
> />
> where showOtherExceptions is a javascript function I have
> already written.
> The problem is that this doesn't work as expected. The part that
> should be filled with "ELSEnquiryConstantsIF.EXCEPTION" stays as
> "ELSEnquiryConstantsIF.EXCEPTION" in the final HTML output..
> When I view source on the outputted HTML page, the html:submit
> tag converts to the following:
> code:
> <input type="select"  name ="exceptione" onClick="java
> script:showOtherExceptions('<%= ELSEnquiryConstantsIF.EXCEPTION %>');"
> />
>
> Please help
>
> Regards
> VasudevRaoGupta
>
>
> Confidentiality Notice
>
> The information contained in this electronic message and any attachments
to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or
privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or
Mailadmin@wipro.com immediately
> and destroy all copies of this message and any attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org