Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Iam placing xml tags in jsp file..throwing an error..did i do in the correct way..

Posted on 2005-05-09
6
Medium Priority
?
239 Views
Last Modified: 2010-04-01

<%@ page language="java" import="com..xmlapps.web.*  "%>

<%
    response.setHeader("Expires", "-1");
    response.setContentType("text/xml");

    String url = WebUtil.getURLAddress( request );
    String baseURL = url + "/phone/new_app/";
    String exitURL = url+ "/phone/new_app/";
      
    String theback =(String)session.getAttribute("sessionback");
    String wineselected= request.getParameter("wineselected");      
      
%>
<CiscoIPPhoneMenu>
<Title>Wine Menu</Title>

<%
if(wineselected.equals(Sparkling Whites)) {
%>
<MenuItem>
<Name>Cristolino Cava Brut, Spain </Name>
<URL><%= baseURL %>wineselected.jsp?wine=Liberty</URL>
</MenuItem>

<MenuItem>
<Name>Roederer Estate, California</Name>
<URL><%= baseURL %>wineselected.jsp?wine=Murphey</URL>
</MenuItem>

<%  } else if(wineselected.equals(Whites)) { %>

<MenuItem>
<Name>Catena Chardonnay, Argentina </Name>
<URL><%= baseURL %>wineselected.jsp?wine=Liberty</URL>
</MenuItem>

<MenuItem>
<Name>Sonoma Cutrer Chardonnay, California</Name>
<URL><%= baseURL %>wineselected.jsp?wine=Murphey</URL>
</MenuItem>

<
<MenuItem>
<Name>Fess Parker White Riesling, California</Name>
<URL><%= baseURL %>wineselected.jsp?wine=Murphey</URL>
</MenuItem>



<MenuItem>
<Name>Peweseyvale Riesling, Australia</Name>
<URL><%= baseURL %>wineselected.jsp?wine=Murphey</URL>
</MenuItem>

<% } %>


<SoftKeyItem>
<Name>Exit</Name>
<URL><%= exitURL %>mainmenu.jsp</URL>
<Position>4</Position>
</SoftKeyItem>
</CiscoIPPhoneMenu>




0
Comment
Question by:cutie_smily
  • 3
  • 3
6 Comments
 

Author Comment

by:cutie_smily
ID: 13961559
Iam getting following errors: with the above code

new_app/wine_jsp.java:66: ')' expected
    [javac] if(wineselected.equals(Sparkling Whites)) {

/new_app/wine_jsp.java:160: ')' expected
    [javac]       out.write("\r\n\r\n");

    [javac]                            ^
    [javac] 2 errors
0
 
LVL 29

Accepted Solution

by:
bloodredsun earned 750 total points
ID: 13962130
Are you missing the "" in two places:
....
<%
if( wineselected.equals("Sparkling Whites") ) {
%>
....
<%  } else if( wineselected.equals("Whites") ) { %>
.....

You should also do null checks on theback and wineselected  so that you don't get NullPOinterExceptions. This is commonly done with ternary operators so it's on one line.

String theback =session.getAttribute("sessionback") != null ?(String)session.getAttribute("sessionback") : "";
String wineselected= request.getParameter("wineselected")!=null ? request.getParameter("wineselected") : "";  

0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13962191
There also appears to be a spare angle bracket, 3rd node from the bottom

..........
<
<MenuItem>
<Name>Fess Parker White Riesling, California</Name>
<URL><%= baseURL %>wineselected.jsp?wine=Murphey</URL>
</MenuItem>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cutie_smily
ID: 13962430
yeah! i did not notice codes for strings. thank u and the second one is pasting error. Let me check the result and get back to you to assgn your points
0
 

Author Comment

by:cutie_smily
ID: 13962546
thanks again it worked fine
0
 
LVL 29

Expert Comment

by:bloodredsun
ID: 13962686
Thanks, but why the B grade. Did I miss somehting?
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question