LDN - CodeStorm 2009

Channel development

I am going to create a channel, it should get channel input data, calculate the input data, then display the result in the same channel, the submit button should just refresh the channel, not the whole page.

Which is the best channel type I should use?

Actually I created one by using jsp model II, every thing looks good, there has only one concern is the submit button, which now inferences the whole page instead of just channel.

Thanks!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

iframe or ajax

I think you are going to be stuck either using an iframe (not recommended for technical reasons), or ajax. You can put all your channel's output into a named div tag. Then change the submit button to call a javascript function to send the data and return the results via ajax. Then replace the innerHTML of the div with the results.

How can the client get the response data from sever?

 

Thanks!
If I am sticking on using JSP model II type, the data passed by session object, but the ajax read response data from xml or text file, if I write data into an xml file, how can the jsp to read this xml file?

The problem with Portals

You have stumbled into one of the biggest problems with Portal development. The HTTP model is to make a request, and load the response - as a whole. Updating individual sections of an HTML page is beyond the scope of HTML 4, so it is left to Javascript to do partial updates to sections of the page. When combined with XMLHTTPRequest, this becomes a powerful way to update sections of the page with meaningful data.

You can leverage AJAX and still use JSP pages. 

javascripts get java value in jsp

Thanks, I am now trying to use ajax, but in the javascripts, I need to get value from the java code which is embeded in jsp, since I got the value from response by using session object before, do you know how can javascript get value from java (<% .....%>)? Thanks!

Java function call

You can transfer a vale from the Java portion of a JSP page to the Javascript section by making the Java function spit out a response using the <%= %> tags. For example, in Javascript you might have a section that looks like this:

<script type="text/javascript">

  var value = '<%= getValue() %>';

  alert(value);

</script>