This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes html-el:select embeded in js, what should I do to let it runing or not Unterminated String Constant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html-el:select embeded in js, what should I do to let it runing or not Unterminated String Constant" Watch "html-el:select embeded in js, what should I do to let it runing or not Unterminated String Constant" New topic
Author

html-el:select embeded in js, what should I do to let it runing or not Unterminated String Constant

endswel shui
Ranch Hand

Joined: Jul 03, 2008
Posts: 33


but it parse it


I want it can parse it like below



how should I do
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Using custom tag output as a JavaScript string when the tag's output spans multiple lines is probably not very practical, since JavaScript doesn't support herestrings/multi-line strings without using a line continuation character.

You're probably better off using hidden divs and toggling between them based on your existing test (if you need to allow both on the same page without a refresh) or doing to comparison during page load if you don't.

Technically this probably isn't a Struts question, but a JavaScript question.
endswel shui
Ranch Hand

Joined: Jul 03, 2008
Posts: 33
sorry, have you seen my details more

how should i do in the js
i want to use the js to iterator the component.
using jstl or other tag.

thank for your reply.
If you have time, reply more. thanks

I cant use the div to force it one line,
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I understood the problem.

The tag's output is set by the tag implementation. Unless you re-write the tag, the tag output isn't going to change.

I gave you some alternatives; I am not sure what else you want.
endswel shui
Ranch Hand

Joined: Jul 03, 2008
Posts: 33
and do you know how to implement it
the back I have implement the javabean collections

and using other customer to implement it also OK,
I want to rewrite the tag, but the head of me do not agree.

so....

thanks David.
do you have any other good idea to implement it?
except using the request.getAttribute()
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Rewriting the tag would be a complicated solution to a relatively easy problem.

I already provided two potential solutions, each appropriate for a different set of requirements--without knowing more precisely what you require, those are the only solutions I have.
endswel shui
Ranch Hand

Joined: Jul 03, 2008
Posts: 33
How
David
endswel shui
Ranch Hand

Joined: Jul 03, 2008
Posts: 33
you just gave the java code, the java code I can implement
I want the UI show
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I don't recall giving any Java code.

Like I said--I don't know how you need your application to operate, so there's not much more I can do.
endswel shui
Ranch Hand

Joined: Jul 03, 2008
Posts: 33
I have a collection

and the ui will show two collection,

because it is a cascade collection,

one collection will trigger another collection, but sometime it trigger others, eg. freebox
so

I have to write a collection in the js dynamic, in the html, I use the div to block or none
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
endswel:

Please check your private messages for a message regarding an important administrative matter. You can do so by clicking My Private Messages in the upper right corner of the page.


Merrill
Consultant, Sima Solutions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: html-el:select embeded in js, what should I do to let it runing or not Unterminated String Constant
 
Similar Threads
html:select-problem
Ajax, Struts, and a few pesky event based issues
html select onchange
Selecting and inserting input object using Jquery
How to enable 2nd dropdown.