Message Boards Message Boards

0
|
11839 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Show an output in a new webPage in webMathematica?

webMathematica: How show an output in a new webPage? e.g. In https://library.wolfram.com/webMathematica/Mathematics/Expand.jsp enter image description here How show the result in a new webpage.

The code of the Expand.jsp example can be found in. https://library.wolfram.com/webMathematica/scripts/GetForm.jsp?script=Mathematics/Expand.jsp I will apprediate if you modify it to obtain the output in a new webpage.

4 Replies

Hans, it works. I have included a minor change. I have used MSPFormat instead of MSPFormatForCluster.

My intention is to build a more complex case but this is a good starting point

Thank you a lot of

Guillermo

Guillermo:

Did you try just a blank ExpandResult.jsp file? (blank meaning minimum HTML tag so that he file would serve)

What Errors did you get?

Plus your attached ExpandResult.jsp page contains no HTML. Etc... The first link you provided had no html tag etc..So I did not provide any full code. I assumed you got that part.

I would also remove "<c:if test="${not empty param.num}">" and its closing tag

Keep us posted when solved.

Hans

POSTED BY: Hans Michel

Dear Hans, I have followed your instructions but some thing is wrong. The new expand and expandresult are attached (of course txt extension should be removed).

In anycase I think I got your idea. Thanks Guillermo

Guillermo:

I don't currently have access to a machine with a webMathematica instance. So I am going to go on pure memory.

Your version Expand.jsp

<form action="Expand.jsp" method="POST"><p><strong>
          Expand <input type="TEXT" name="expr" align="LEFT" size="10"
              value="${not empty param.expr ? param.expr : 'x+y' }" />
          to the <input type="TEXT" name="num" align="LEFT" size="3"
              value="${not empty param.num ? param.num : '4' }" />
          power.
          </strong></p><table><tr><td><input type="image" src="../images/Template2/compute.gif" name="submitButton" value="Compute" alt="Compute" title="Compute" /></td></tr></table><c:if test="${not empty param.num}"><p><div class="webm-results">Results</div><msp:evaluate>
              Get["Cluster`"];
          </msp:evaluate><div style="padding: 5px; border: 13px solid #CCC; float: left;"><msp:evaluate>
                 MSPBlock[{$$expr, $$num}, 
                     MSPFormatForCluster[Expand[$$expr^$$num], TraditionalForm]
                 ]
            </msp:evaluate></div></p></c:if></form><div style="clear: both;"></div>

I would rewrite as follows:

Expand.jsp

<form action="ExpandResult.jsp" method="POST">
    <p>
       <strong>Expand 
         <input type="TEXT" name="expr" align="LEFT" size="10" value="${not empty param.expr ? param.expr : 'x+y' }" /> to the 
         <input type="TEXT" name="num" align="LEFT" size="3" value="${not empty param.num ? param.num : '4' }" /> power.
       </strong>
    </p>
    <table>
       <tr>
         <td>
          <input type="image" src="../images/Template2/compute.gif" name="submitButton" value="Compute" alt="Compute" title="Compute" />
         </td>
       </tr>
    </table>
</form>

ExpandResult.jsp

<c:if test="${not empty param.num}">
    <p>
       <div class="webm-results">Results</div>
       <msp:evaluate>
          Get["Cluster`"];
       </msp:evaluate>
       <div style="padding: 5px; border: 13px solid #CCC; float: left;">
         <msp:evaluate>
              MSPBlock[{$$expr, $$num}, 
                  MSPFormatForCluster[Expand[$$expr^$$num], TraditionalForm]
              ]
          </msp:evaluate>
       </div>
    </p>
</c:if>
<div style="clear: both;"></div>

The HTML form element's action attribute is what helps with the redirection. So you just need another file called "ExpandResult.jsp" You can try this first by having the action on Expand.jsp route to a blank "ExpandResult.jsp" page. Then fill in the page with the parameters and msp calculations.

POSTED BY: Hans Michel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract