It's not a secret anymore!*
The moose likes Struts and the fly likes Problem with s:if Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with s:if "Syntax error on token(s), misplaced construct(s)"" Watch "Problem with s:if "Syntax error on token(s), misplaced construct(s)"" New topic
Author

Problem with s:if "Syntax error on token(s), misplaced construct(s)"

V. Keating
Greenhorn

Joined: May 14, 2012
Posts: 5
I am fairly new at this.
I had to go in to some existing code and make a change.
I believe that this block here is making the change that I need.
However, I don't think that it is executing.
It looks to me like these struts are not working. I am not familiar with the syntax.
I cannot see the problem from what I am looking up on line.
I have checked for missing brackets, semicolons, commas, <>, I need a fresh pair of eyes.
Thank you in advance.

Eclipse error is "Syntax error on token(s), misplaced construct(s)"

Pseudocode for other blocks------------------------------------------------------
Function saveAddress
if (Validate address Form)
dojo.xhrPost({
try {
if (data && data.PR && data.PR.PRID > 0) {
var newAddress="";
var newAddressToolTip="";

// keep local address vars up to date block of
_x.y=dojo.byId("PR.xyz").value.toUpperCase();
_x.y=dojo.byId("PR.xoxo").options[dojo.byId("PR.xoxo").selectedIndex].value;

// build new address block for side panel
//declare variables
//if variable is empty newAddressToolTip += _variable

--------------------------------------------------------------------------------------------------------------------
//Here is where I run into the issues.
<s:if test="Work.order.Num != null">
tooltip+="<br /><b>Parcel: </b><s:PR value="Work.order.Num"/>";
</s:if>
<s:elseif test="Work.PR.lots != null && Work.PR.lots.size > 0">
tooltip+="<br /><b>lots associated with PR:</b><br />";
<s:iterator value="Work.PR.lots" id="parcel">
tooltip+="<s:PR value="Num"/>, ";
</s:iterator>
</s:elseif>

tooltip+="<hr /><b>Submitted Address:</b><br /><app:webFormat value="${requestScope.Work.order.submittedPR.formattedAddress}"/>";
tooltip+="<br /><b>County: </b><s:PR value="Work.order.submittedPR.county.simpleName"/>";

<s:if test="Work.order.submittedPR.subdivision != null">
tooltip+="<br /><b>Subdivision </b><s:PR value="Work.order.submittedPR.subdivision"/>";
</s:if>
<s:if test="Work.order.submittedPR.lot != null">
tooltip+="<br /><b>Lot: </b><s:PR value="Work.order.submittedPR.lot"/>";
</s:if>
<s:if test="Work.order.Num != null">
tooltip+="<br /><b>Parcel: </b><s:PR value="Work.order.Num"/>";
</s:if>
<s:elseif test="Work.order.submittedPR.lots != null && Work.order.submittedPR.lots.size > 0">
tooltip+="<br /><b>lots associated with PR:</b><br />";
<s:iterator value="Work.order.submittedPR.lots" id="parcel">
tooltip+="<s:PR value="Num"/>, ";
</s:iterator>
</s:elseif>
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

These tests:

should probably be.. (need to verify syntax)


WP
V. Keating
Greenhorn

Joined: May 14, 2012
Posts: 5
Thank you!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with s:if "Syntax error on token(s), misplaced construct(s)"
 
Similar Threads
Struts2 variable inside javascript
Need Help With Dynamic text box in JSP
Struts 2 iterator
Browser Error while using Struts tags