tmonteit
asked on
JSP Forward Problem
I think I'm using the proper syntax on a <jsp:forward>. But its giving me an error.
How do I fix this?
<% if(myVariable.equals("X"))
<jsp:forward page="<c:out value="${form.forward}" /> " />
<%} %>
ERROR
500 Servlet Exception
javax.servlet.jsp.JspExcep
ServletException in '/jsp/classroom/classLayou
in '/jsp/classroom/content.js
`>' at ``$'' (for tag `<jsp:forward>' at line 106). The XML tag syntax
is: <tag attr1='value1'>
at org.apache.struts.taglib.t
at org.apache.struts.taglib.t
at _jsp._jsp._layout._layout_
at com.caucho.jsp.JavaPage.se
at com.caucho.jsp.Page.pagese
at com.caucho.server.dispatch
at com.caucho.server.webapp.D
at com.caucho.server.dispatch
Does <jsp:forward page="${form.forward}"/> work for you?
try
<c:if test="${param.myVariable == "X" }">
<c:redirect url="<c:out value="${form.forward}" />" />
</c:if>
<c:if test="${param.myVariable == "X" }">
<c:redirect url="<c:out value="${form.forward}" />" />
</c:if>
ASKER
Jaggernat,
your solution puts a line that says "url has moved here". where here is a link to the page I need?
Any way to make it automatically go to that page?
your solution puts a line that says "url has moved here". where here is a link to the page I need?
Any way to make it automatically go to that page?
hmm, intresting.
what is the value of "<c:out value="${form.forward}" />"
redirect normally will forward to the url value.
you can try this too
<c:if test="${param.myVariable == "X" }">
<jsp:forward page="<c:out value="${form.forward}" /> " />
</c:if>
what is the value of "<c:out value="${form.forward}" />"
redirect normally will forward to the url value.
you can try this too
<c:if test="${param.myVariable == "X" }">
<jsp:forward page="<c:out value="${form.forward}" /> " />
</c:if>
the value of <c:out value="${form.forward}" /> must be a .jsp
ASKER
Its an html, file will it work with an html?
ASKER
oops, I mean how can it work with an html file. Obviously its not working.
if 'form' is a bean instance, just call it like:
<% if(myVariable.equals("X")) { %>
<jsp:forward page="<%=form.getForward() %>" />
<%} %>
<% if(myVariable.equals("X"))
<jsp:forward page="<%=form.getForward()
<%} %>
>>Its an html, file will it work with an html?
It should.
redirect should follow this sytax <c:redirect url="abc.html"/>
It should.
redirect should follow this sytax <c:redirect url="abc.html"/>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oops, good catch owen :-)
Thanks. I test it in my WSAD.
Actaully, both <jsp:forward page="<%=form.getForward() %>" /> and <c:redirect url="${form.forward}" /> work OK.
Actaully, both <jsp:forward page="<%=form.getForward()
<jsp:forward page="<%= ((MyForm)request.getAttrib