What am i messing up here? (JSP question)

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
<%@ page language="java" %>

<html>
<head>
<title>Please Work</title>
</head>

<body>
<table border="1" widht="700">
<tr>
<td width="250">
<a href="index.jsp?func=add">Add an Employee</a>

<a href="index.jsp?func=remove">Remove an Employee</a>

<a href="index.jsp?func=mod">Modify and Employee's info</a>

<a href="index.jsp?func=view">View and Query the Database</a></br>
</td>
<td width="450">
<% String func = request.getParameter("func"); %>
<%= func %>
<jsp:include page="<%= func %>.jsp" />
</td>
</tr>
</table>
</body>
</html>

I have add.jsp, remove.jsp, mod.jsp, and view.jsp sitting in the directory. But it gives me this error:


<< java.lang.IllegalArgumentException: Cannot URL decode request path / >>



what am i messing up, it seems so simple

bart
 
Oct 9, 1999
15,216
3
81
i had a quick look (I dont work with JSP) but it looks like your missing path
or its in teh wrong format.
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
god! this always happens, the minute you effing post for help you figure it out...

just added <% String thing = func + ".jsp"; %>
then set it to <jsp:include page="<%= thing %>" />

bart
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
nah the problem is when you use the jsp:include tag you can set page={URL | <%= expression that evaluates to a URL %>}
i was trying to do both at once.

bart
 

manly

Lifer
Jan 25, 2000
11,738
2,697
136
In which case, you could also do

<jsp:include page="<%= func + ".jsp" %>" />

Some JSP containers might get confused by the nested quotes though. Have you looked into the "Model 2" architecture for JSP/servlets yet?
 

Buddha Bart

Diamond Member
Oct 11, 1999
3,064
0
0
"Have you looked into the "Model 2" architecture for JSP/servlets yet?"

Nah, haven't gotten that far in the book, and this is due tuesday. What little I've come across seems to look like that'd be a better setup, but I'm still really really new and i'm not sure what they mean even at the high level (the views).

bart