The output of a JSP is simple text regardless of its content. Have the JSP selectively include VRML code to suit your needs. The simplest example I can think of is when you want the VRML to contain one of two objects but not both. Use an if statement in the JSP and have two branches which output the appropriate object's code. Ive tried to represent this logic below.
You may need database access or something to provide data on which to make a conditional statement. Alternatively you could have a servlet do this, which could then take data from a form and selectively include objects as necessary.
if(favouriteShape==cube && favouriteColor==red)
{
//add red cube to world
}
But now my problem is that if I am using a .jsp file, I can not launch the VRML player (Cosmo) with such an extension. To execute the jsp (the dynamic action), the user must call a .jsp file. How can I return a .WRL file (considering there can be multiple user at the same moment, I can not store a .WRL file on the harddisk!)
I've never worked with VRML but I would assume you need to set the content-type HTTP header correctly to identify the content of the HTTP response to the browser as VRML. This is no different than producing an image inside a JSP page and returning it's byte stream to the browser.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.