File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Scriplet in Select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Scriplet in Select" Watch "Scriplet in Select" New topic

Scriplet in Select

santosh jaha

Joined: Aug 17, 2004
Posts: 3
When i write a scriplet in the JS method call of onChange of html:Select tag, the scrolet does not get converted to value...
Any idea why this is happeneng.....
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

Post the code so we can see what you're actually doing. Thanks

Junilu - [How to Ask Questions] [How to Answer Questions]
santosh jaha

Joined: Aug 17, 2004
Posts: 3
Well I have written the struts tag as
<html:select property="strCategory" onChange="set('NewQuestionForm','<%=CommonConstantsIF.ACTION_GET_PAGES%>')">

when i run the application, and see the source of generated web-page i see
<select name="strCategory" onchange="set('NewQuestionForm', '<%=CommonConstantsIF.ACTION_GET_PAGES%>')">

Here the Scriplet doen't get converted to resulting string....
Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
Yes I do have the same problem , it happens only when the scriptlet is inside the javascript method.

"Failure is not when you fall down; its only when you fail to get up again."
santosh jaha

Joined: Aug 17, 2004
Posts: 3
Got one solution.....
Create a string for method call... like this

<%String strAction="javascript:set('NewQuestionForm','" + CommonConstantsIF.ACTION_GET_PAGES + "')"; %>

and then put this string in place of method call of onChnage

<html:select property="strCategory" onChange="<%=strAction%>">

It works..........
I agree. Here's the link:
subject: Scriplet in Select
It's not a secret anymore!